Maybe I will have a stupid question. The C++14 standard brings a concept of a template variable. Is it possible to do a similar thing using the C++11 standard?
Thank you, Marek
Maybe I will have a stupid question. The C++14 standard brings a concept of a template variable. Is it possible to do a similar thing using the C++11 standard?
Thank you, Marek
The usual way to achieve the effect of variable templates in C++11 is to place them as static variable in a class template:
template<typename T, T V>
T my_value = V;
becomes
template<typename T, T V>
struct value_helper {
static T value = V;
};
(I am bad at naming things, though.)