how to get the type of a deferred template parameter
- by smerlin
Is there a way to get the defered type of a class template parameter ?
template <class TPtr>
struct foo {
typedef TPtr ptr_type;
typedef ??? element_type; /* shall be the type of a deferred TPtr*/
};
so foo<const char*>::element_type results in const char, and foo<std::vector<int>::iterator_type>::element_type results in int.
i am aware of that i can use the value_type typedef for c++ iterators (like std::vector<int>::iterator_type::value_type), but raw pointers havent got a value_type typedef, so i am out of luck there.