Logical const

"Jérôme M. Berger" jeberger at free.fr
Tue Nov 30 12:21:38 PST 2010


Walter Bright wrote:
> Steven Schveighoffer wrote:
>> The example that I gave does not seem to you like it would surprise
>> someone?  I passed in a const object and it got modified, even though
>> no casts were used.
> 
> No, it doesn't surprise me. Const on one object does not apply to
> another object.

const C c = C.theCommonOne;
auto old = c.x;
c.foo();
assert (old == c.x); // Fails and this does not surprise you?

		Jerome
-- 
mailto:jeberger at free.fr
http://jeberger.free.fr
Jabber: jeberger at jabber.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20101130/962a9944/attachment.pgp>


More information about the Digitalmars-d mailing list