Is there a macro that tells me whether or not my compiler supports variadic templates?
#ifdef VARIADIC_TEMPLATES_AVAILABLE
template<typename... Args> void coolstuff(Args&&... args);
#else
???
#endif
If they are not supported, I guess I would simulate them with a bunch of overloads. Any better ideas? Maybe there are preprocessor libraries that can ease the job?
Maybe: #ifndef BOOST_NO_VARIADIC_TEMPLATES
?
If variadic templates are not supported, you might think of using the boost tuple library:
template<typename Tuple> void coolstuff(Tuple&& args);
And:
coolstuff(boost::make_tuple(1, 2, 3));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With