On Sat, 15 Feb 2003 19:01:08 +0100, Peter Dimov wrote:

> Daniel Frey wrote:
>>     typedef test::remove_pointer< int A::* >::type t1; typedef
>>     test::remove_pointer< int A::* const >::type t2; typedef
>>     test::remove_pointer< int A::* volatile >::type t3; typedef
>>     test::remove_pointer< int A::* const volatile >::type t4;
>> 
>>     typedef test::add_const< int( int ) >::type t5; typedef
>>     test::add_volatile< int( int ) >::type t6; typedef test::add_cv<
>>     int( int ) >::type t7;
> 
> Why do you expect these to work?

Because add_const< int& > returns int&. I was under the impression that
a) type-traits should compile if possible and b) that in the case of
add_const the input type is returned unmodified if it cannot exist as a
const version. If a user wants to make sure that it actually added a
const, he can use is_const, is_same, etc. to make that sure - without
compile failures. But I may be wrong on this one as I was for all other
cases where I tried to understand the code.

>>     typedef char t8[ test::is_convertible< double, int >::value ];
>>     typedef char t9[ !test::is_class< int( int ) >::value ]; typedef
>>     char t10[ !test::is_enum< int( int ) >::value ];
> 
> These should work. If they don't, the implementation is broken. :-)

The first one only gives a warning, is_class and is_enum fail. Can anyone
comfirm this or am I again missing something?

Regards, Daniel

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to