Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2005-07-08 15:44:19


Peter Dimov wrote:
> Tobias Schwinger wrote:
>
>
>>>It is not too clear whether it applies to partial template
>>>specialization, since we don't really "form" a type - we just
>>>consider a possibitity:
>>>
>>> typedef int my_const_function() const;
>>>
>>> template<typename T> struct remove_const
>>> { typedef T type; };
>>>
>>> template<typename T> struct remove_const< T const >
>>> { typedef T type; };
>>>
>>> // somwhere else
>>> remove_const<my_const_function>::type // ill-formed?
>
>
> Well formed, returns my_const_function.

Wasn't anywhere near obvious to me before reading #295, though...

> The specialization doesn't match.
>

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

   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

   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

Thanks,

Tobias


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