how to get the type of a deferred template parameter
Posted
by smerlin
on Stack Overflow
See other posts from Stack Overflow
or by smerlin
Published on 2010-06-17T06:26:06Z
Indexed on
2010/06/17
6:33 UTC
Read the original article
Hit count: 281
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.
© Stack Overflow or respective owner