Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2006-02-28 08:56:58


> Unless that is not what you are referring to, in which case I really
> do need educating!

Adding a cv-qualifier to a reference type has no effect:

typedef int& ref;
typdef const ref cref;

here ref and cref are actually the same type.

The bug in Borland's compiler is that the above produces "int&const" for
cref which is *not* a legal type in the C++ type system and is distinct from
"const int&".

This is in contrast to pointers, where "int*const" is a legal type (and
distinct from "int const*").

So:

add_const<add_reference<int>::type>::type is "int&"
add_reference<add_const<int>::type::type is "const int &"

John.


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