templates
Pointers and recursive templates
Submitted by bwy on Wed, 02.09.2009 - 07:18How do you get the 'pointed-to' type in C++?
template<typename T>
struct RemovePointer
{
typedef T value_type;
};
template<typename T>
struct RemovePointer<T*>
{
typedef typename RemovePointer<T>::value_type value_type;
};
What's the point? With a bit of boost magic, you can use pointers transparently in generic code: