-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Description
namespace example {
struct Person {
std::string name;
std::uint32_t age_years;
std::uint8_t height_inches;
std::uint16_t weight_pounds;
NOP_STRUCTURE(Person, name, age_years, height_inches, weight_pounds);
};
} // namespace example
int main(int argc, char** argv) {
using Writer = nop::StreamWriter<std::stringstream>;
nop::Serializer<Writer> serializer;
serializer.Write(example::Person{ "John Doe", 37, 72, 180 });
serializer.Write(std::vector<example::Person>{
{"John Doe", 37, 72, 180}, { "Jane Doe", 36, 69, 130 }});
const std::string data = serializer.writer().stream().str();
std::cout << "Wrote " << data.size() << " bytes." << std::endl;
// [write to file]
std::ofstream saveFile("e.bin", std::ios::binary);
saveFile.write(data.c_str(), data.size());
saveFile.flush();
saveFile.close();
return 0;
}
MSVC 2022 Result:
Wrote 8 bytes.
Warnings
- warning C4003: not enough arguments for function-like macro invocation '_NOP_FIRST_ARG'
- warning C4003: not enough arguments for function-like macro invocation '_NOP_REST_ARG'
CLANG LLVM Result:
Wrote 50 bytes.
why this not working with MSVC 2022?!
themarpe
Metadata
Metadata
Assignees
Labels
No labels