Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-10-15 20:11:15


It sounds to me like Jesse has only good points here.
-Dave
----- Original Message -----
From: "Jesse Jones" <jesjones_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, October 15, 2000 9:34 PM
Subject: Re: [boost] is_pointer Bug

> >Jesse,
> >
> >>But what if the type is "char* const"? It won't match the specialization
> >>because the pointer itself is const. I think there should be a second
> >>specialization that looks like this:
> >
> >That was how it was in one of the early (pre-release) versions, but was
> >changed to follow the definitions in 3.9.2 (compound types).
>
> I'm sure you've already thrashed this out so I don't want to re-open a
> long ago discussion, but I feel obligated to say this much:
>
> 1) I see nothing in sections 3.9.2 and 3.9.3 that make this sensible. The
> closest I can find is the bit at the start of 3.9.3 that says that the
> cv-qualified and cv-unqualified versions of a type are distinct types.
> So, char* and char* const are distinct types, but they're still both
> pointers.
>
> 2) I expect that many people will be surprised to find that is_pointer
> returns false for const pointers. So, it's important that this be well
> documented (see below). It also wouldn't hurt to include a comment in the
> code.
>
> >BTW the docs
> >make it clear that is_pointer applies to cv-unqualified types,
>
> Where? The type_traits.htm file merely says "True if T is a regular
> pointer type - including function pointers - but excluding pointers to
> member functions (3.9.2 p1 and 8.3.1)." This might be sort of clear if
> "Regular pointers" were defined by the standard, but they're not. As far
> as I'm concerned a char* const *is* a regular pointer.
>
> -- Jesse
>
>
>


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