What guarantees does D 'const' provide, compared to C++?
Mehrdad
wfunction at hotmail.com
Thu Aug 16 19:20:14 PDT 2012
On Friday, 17 August 2012 at 02:09:09 UTC, Mehrdad wrote:
> On Friday, 17 August 2012 at 02:02:56 UTC, Jonathan M Davis
> wrote:
>> How is it a bug? The variable that you're altering is not part
>> of the object.
>
>
> It doesn't need to be.
Not to say it /can't/ be, of course... a const method can
certainly legally modify its own object's members. All you need
is some aliasing.
http://forum.dlang.org/thread/gjccnstbihxbrwhwwucs@forum.dlang.org?page=3#post-mailman.1286.1345168975.31962.digitalmars-d:40puremagic.com
More information about the Digitalmars-d
mailing list