Boost logo

Boost :

From: John Swartzentruber (johnslists_at_[hidden])
Date: 2003-04-16 11:29:45


On Wed, 16 Apr 2003 16:59:29 +0100, Kevlin Henney wrote:

>>[1] const T & ref;
>>means that the data type referred to by ref is constant (i.e. you cannot
>>modify its internal state).
>
>To be precise, you cannot modify the object referred to by ref via ref:
>it may be a non-const object, in which case it could change, just not
>via the ref.
>
>>[2] T & const ref;
>>means that the *reference* is constant.
>>
>>[3] const T & const ref;
>>both reference and data type are constant.
>
>The fundamental difference is that [1] is legal and both [2] and [3] are
>illegal: you cannot cv-qualify a reference.

There have been a couple different answers to this question (although
fundamentally the same). This one makes the most sense to me and the
ones that said [1] and [2] were the same didn't. Does anyone have a
reference that would indicate that [1] and [2] are the same, or that
[2] is illegal (or merely redundant)?


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