|
Boost : |
From: Fredrik Blomqvist (fredrik_blomqvist_at_[hidden])
Date: 2003-04-16 12:14:10
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.
>
> [3] const T & const ref;
> both reference and data type are constant.
>
This should answer most of your questions.
http://www.parashift.com/c++-faq-lite/const-correctness.html#faq-18.5
(Most importantly [1] and [2] are Not the same.)
Also see the 8.3.2.1 paragraph in the standard why [2] is incorrect.
The const issue is also discussed in for example EC++ item 21.
regards
/Fredrik
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk