|
Boost Users : |
Subject: Re: [Boost-users] [type_traits] data pointers and function pointers
From: Edward Diener (eldiener_at_[hidden])
Date: 2009-12-15 10:11:38
John Maddock wrote:
>> 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.
Could this please be added to the documentation ? I will make the
suggestion on Trac.
>
>> 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
Excellent ! Thanks ! Perhaps an is_object_pointer ( data pointer ) and
is_function_pointer would be nice in type_traits, as a convenience, as
this completes the four specific pointer types along with the already
existing is_member_function_pointer and is_member_object_pointer. I'll
make the suggestion on Trac.
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