Boost logo

Boost Users :

Subject: Re: [Boost-users] [type_traits] data pointers and function pointers
From: John Maddock (john_at_[hidden])
Date: 2009-12-15 05:07:14


> It is difficult in some places in the type_traits documentation to tell
> when the documentation mentions "pointer" whether this refers to data
> pointers, function pointers, member data pointers, and/or member
> function pointers. I assume that if the documentation just refers to
> "pointer" that it should mean all of the above. But here goes:
>
> 1) Does the 'remove_pointer' refer to all of the above ? The examples
> are only for a single one of the above, a data pointer.

It excludes pointers to members, because the result would not be a valid
type.

> 2) The 'is_pointer' doc does say it excludes pointer to members by which
> I assume this means both member data and member functions. Is there any
> way to tell whether a pointer is a function pointer or a data pointer by
> using type_traits since 'is_pointer' includes both ?

is_function<remove_pointer<T>::type>::value

John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net