Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2003-04-16 08:39:02

Reece Dunn wrote:
> If I understand the ISO/IEC C++98 standard correctly:
> [1] const T & ref;
> means that the data type referred to by ref is constant (i.e. you cannot
> modify its internal state).
> [2] T & const ref;
> means that the *reference* is constant.

Nope, it's the same as [1]

> [3] const T & const ref;
> both reference and data type are constant.

This is like a double const: 'const const T& ref'. References are
*always* constant, their data may be constant if 'const' is present. I
think you just mixed up pointers and references as anything you said
would be correct if you replace the reference by a pointer.

(And maybe some compilers have/had "extensions" that allow references to
be treated like pointers in this area, but that is not ISO/IEC C++...)

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:

Boost list run by bdawes at, gregod at, cpdaniel at, john at