Templates are good for programming functions and template classes, so we can use it to shorten our code and give the compiler some work for us.
In my case, I want to use a template class, for example.
template <typename T, typename G> class unicorn { T value01; G value02; <- not used in ever instance of class unicorn };
Is there a way for the compiler to create an instance with a name of type T = int and , if it was not used or not specified , a version without typename G?
To make the result look like this:
unicorn <double, int>; class unicorn { double value01; int value02; };
And without an argument or a given type name G
unicorn <double> class unicorn { T value01;
c ++ templates dynamic-programming variadic-functions
dreiti
source share