3 ms·
For what it's worth, C++ has a better way to do this. http://en.cppreference.com/w/cpp/language/parameter_pack http://en.cppreference.com/w/cpp/language/parame
by looneysquash 11y ago
For what it's worth, C++ has a better way to do this.
http://en.cppreference.com/w/cpp/language/parameter_pack http://en.cppreference.com/w/cpp/language/parameter_pack
You might want to skip down to the example, a type safe printf.
- anon4 11y agoYeah, but then you have to compile the function in every single cpp file and your linking time increases and you're at risk of violating ODR and you have to give people the full definition of your function if you're making a library rather than just the declaration and a .a/.obj/.so.
- gpderetta 11y agoYou provide a type safe variadic template interface which forwards to a type erased out of line layer. It would compile down to the same code as the macro.