3 ms·
If you wanted to maintain C++03 compatibility, a dispatching macro might be useful to select the appropriate Signal template arity: http://stackoverflow.com/que
by tcbawo 11y ago
If you wanted to maintain C++03 compatibility, a dispatching macro might be useful to select the appropriate Signal template arity:
http://stackoverflow.com/questions/16683146/can-macros-be-overloaded-by-number-of-arguments http://stackoverflow.com/questions/16683146/can-macros-be-ov...
- zura 11y agoYes (a shameful plug :)), I've used macros to generate code for different number of arguments for std::function like lib for pre-C++11 compilers (back in 2009): https://github.com/zura-kh/yaf.Function https://github.com/zura-kh/yaf.Function
- gpderetta 11y agoNo need for a dispatching macro, the usual solution in c++03 was to have a template with a fixed maximum arity like this: template<class T1 = default_, class T2 = default ..., class T10 = default_> struct Signal; where default is a placeholder type, and then have it dispatch internally to the correct Signal/N/ via template specialization. The template specialization themselves were generated either via preprocessor metaprogramming or by an external tool.