4 ms·
But you can generate them with macros. The Boost preprocessor library can help a lot. At work we use kind of a hybrid approach. We have generator macros that
by jlarocco 11y ago
But you can generate them with macros. The Boost preprocessor library can help a lot.
At work we use kind of a hybrid approach. We have generator macros that spit out named tuple classes that use a bunch of magic and template meta-programming.
It should go without saying that the macro implementation is ugly and only a few people understand it very well, but we don't have to change them much any more, and the resulting named tuples are easy to use and generally work exactly as expected.
- cbsmith 11y agoYes, lots of people do named tuples with preprocessor logic of one kind or another (protoc and a variety of serialization libraries basically give this to you). It's much cleaner if you can use the type system to do the job for you.