From: Matthew Towler (towler_at_[hidden])
Date: 2003-04-16 09:42:39
Reece Dunn wrote:
> If I understand the ISO/IEC C++98 standard correctly:
>  const T & ref;
> means that the data type referred to by ref is constant (i.e. you
> cannot modify its internal state).
>  T & const ref;
> means that the *reference* is constant.
No, I don't think you do understand the standard correctly.
This form  does not mean anything different from , references are
implicitly constant in that you cannot 'reseat' them. e.g.
int a, c;
int& b = a;
b = c; // error, as attempting to reseat the reference.
This means that VC++7 is correct in warning "anacronism used :
disregarding additional qualifiers". It also means form  is
pointless as well.
If you want something you can reseat, and that does have the 3 forms you
describe, then you need to use pointers.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk