Boost logo

Boost :

From: Kevlin Henney (kevlin_at_[hidden])
Date: 2003-04-16 10:59:29


In article <BAY7-F60sAuwsd1C5vK00008129_at_[hidden]>, Reece Dunn
<msclrhd_at_[hidden]> writes
>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).

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.

Kevlin
____________________________________________________________

  Kevlin Henney phone: +44 117 942 2990
  mailto:kevlin_at_[hidden] mobile: +44 7801 073 508
  http://www.curbralan.com fax: +44 870 052 2289
  Curbralan: Consultancy + Training + Development + Review
____________________________________________________________


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