From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2003-02-17 08:30:08
Peter Dimov wrote:
> 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.
I think we should consider to define what should not work and what
should not. If we want add_const to reject types that cannot be made
const, we should also consider to make references not compile. The user
can check for references as he can check for functions. Either way would
be fine for me, but the current mixture is IMHO not good. If we reject
several cases, I think it might also be worth to consider a
BOOST_STATIC_ASSERT to help the user to understand what he made wrong.
> I don't see why you expect remove_pointer(T) to work when T is not a
Well, is_pointer doesn't detect member pointers, but for the case of a
member variable pointer, removing the pointer would IMHO make sense. Or
otherwise I would like to have a remove_member_variable_pointer-trait.
-- Daniel Frey aixigo AG - financial training, research and technology Schloß-Rahe-Straße 15, 52072 Aachen, Germany fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99 eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk