Why can't we define re-assignable const reference variable?

Janice Caron caron800 at googlemail.com
Sun Feb 17 08:11:26 PST 2008


On 17/02/2008, Robert Fraser <fraserofthenight at gmail.coim> wrote:
> s1 = s2; // Okay
> c1 = c2; // Okay
> s1.x = 5; // Not okay
> c1.x = 5; // Not okay
>
> When I proposed this, NOBODY agreed with me (that is, everybody who responded wanted structs/classes to act differently for generic programming purposes).

Isn't that rather because modifying s1.x modifies s1?



More information about the Digitalmars-d mailing list