Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2003-02-17 09:03:20


David Abrahams wrote:
>
> "Peter Dimov" <pdimov_at_[hidden]> writes:
>
> > From: "David Abrahams" <dave_at_[hidden]>
> >> "Peter Dimov" <pdimov_at_[hidden]> writes:
> >>
> >> > I don't see why you expect remove_pointer(T) to work when T is not a
> >> > pointer.
> >>
> >> I think that's a reasonable expectation, if by "work" you mean return
> >> the original type without modification. That's what it does for "int"
> >> arguments, for example.
> >
> > I would argue that remove_pointer should cause a compile-time error when
> > applied to a non-pointer. *p doesn't just "conveniently" return p when
> > applied to a non-pointer.
> >
> > Either way though, it should be consistent, i.e. if it works for int, it
> > should work for everything.
>
> I think silent non-modification is a more-useful behavior; it saves on
>
> if_<is_pointer<T>, remove_pointer<T>, identity<T> >
>
> which is sometimes what you want.

I feel the same, especially looking at remove_const, remove_volatile and
remove_cv. Of course we could decide to treat those three different from
the rest, but this is IMHO neither needed nor useful.

Regards, Daniel

-- 
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