Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-02-17 07:53:21


From: "Daniel Frey" <d.frey_at_[hidden]>
> 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.

I wasn't sure what you expected from add_const< int (int) >; you might have
wanted "int (int) const" as a result.

Anyway, add_const(T) returns "T const", whatever that means. References
shrug off cv-qualifiers. Function types generate errors. They'll start
shrugging off cv-qualifiers once compilers implement CWG#295.

I don't see why you expect remove_pointer(T) to work when T is not a
pointer.


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