Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-07-08 16:54:06


Tobias Schwinger wrote:

[...]

>>>> typedef int my_const_function() const;

> Where do I find it in the standard and/or what should happen in the
> following two cases?

Don't know about the standard, but...

> template<typename T>
> struct remove_member_pointer { typedef T type; };
>
> template<typename T, typename C>
> struct remove_member_pointer< T C::* > { typedef T type; };
>
> remove_member_pointer< my_const_function >::type // <-- case 1

The specialization doesn't match, because int () const is not of the form T
C::*, so the primary template is selected and echoes my_const_function back.

> template<typename T, typename C> struct add_member_pointer
> { typedef T C::*type; };
>
> class X;
>
> add_member_pointer< my_const_function, X >::type // <-- case 2

int (X::*) () const. If you pass that to remove_member_pointer, it would
give you my_const_function.


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