A class can expose types without instantiating it. For example:
class bar {
typedef int GET_TYPE;
};
template<class T>
void foo() {
typename T::GET_TYPE t;
// do something with t
}
foo<bar>();
Can a integer number be exposed in a similar way? In the sense that template parameters can be either types or built-in types.
enumis good for that.This only works for integral values, but works with all versions of C++.
For non-integral values, see CatPlusPlus’s modern solution (C++11-only).