it’s possible to have access to template “type”, for instance in the std
std::vector<int>::size_type
is it possible to have the same thing for objects passed as template parameters?
For instance:
template<int i>
class A {
//?
};
A<3> instance;
int number = instance::???? //<--- assigns 3 to number
is it possible to get the 3 passed in the object type again at runtime? Without creating a specific member in the A class (which would increase the size of the object)
thanks
The type of the variable is known to the compiler at compile time, it’s just a matter of getting it to give it up.