Why the need for an only const ref?

Jesse Phillips jessekphillips at gmail.com
Fri Nov 30 15:21:44 PST 2007


I've been following the const stuff to learn about it and start thinking 
of applications for it. I've made a post about a suggested syntax for 
declaring different parts const, but I'm starting to wander why a 
constant reference with mutable data is needed. Currently const is 
transitive so a const ref would make const data. I do not see a need for 
syntax change if we don't need this.

What is the need for a X const x which lets you change the object in x 
but not reassign it to another X?



More information about the Digitalmars-d mailing list