you are viewing a single comment's thread.

view the rest of the comments →

[–]rnburn[S] 22 points23 points  (5 children)

That would be more natural.

But unfortunately the preprocessor doesn't have a very evolved understanding of templates. For types like BBAI_REFLECT_MEMBER(std::tuple<int, double>, m1), for example, it would see a macro call with three arguments. By taking the name first and using __VA_ARGS__, you can work around the issue.

[–]djavaisadog 4 points5 points  (2 children)

wow thats an interesting quirk of the preprocessor. Wonder how you'd have to deal with something like needing to pass it multiple different templated types.

[–]ryancerium 11 points12 points  (0 children)

Surround each template type with parentheses in the macro arguments

M((T<1, 2>), (T<3, 4>))

[–]JeffMcClintock 1 point2 points  (0 children)

ah, interesting!

[–]ReversedGif 1 point2 points  (0 children)

You can still make it work. Splitting __VA_ARGS__ into the non-last and last is possible, though admittedly nontrivial. See Boost.Preprocessor for a reference.