Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2000-12-21 13:48:43


FWIW, remove_pointer could handily be used to implement is_pointer:

template <class T> struct is_pointer
        {static const bool value = !is_same<T, typename
remove_pointer<T>::type>::value;};

(assuming of course that remove_pointer removed pointers and top-level
cv-qualified pointers, else returned the original type)

template <class T> struct remove_pointer {typedef T
type;};
template <class T> struct remove_pointer<T*> {typedef T
type;};
template <class T> struct remove_pointer<T*const> {typedef T
type;};
template <class T> struct remove_pointer<T*volatile> {typedef T
type;};
template <class T> struct remove_pointer<T*const volatile> {typedef T
type;};

-Howard

David Abrahams wrote on 12/21/2000 11:05 AM
>I notice there is a remove_reference<T> but no remove_pointer<T> in
>type_traits. Oversight? Rationale?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk