any news on const/invariant?

Bruce Adams tortoise_74 at yeah.who.co.uk
Thu Nov 29 00:50:06 PST 2007


On Thu, 29 Nov 2007 05:02:29 -0000, Walter Bright  
<newshound1 at digitalmars.com> wrote:

> Steven Schveighoffer wrote:
>
>> invariant int* f2() const {...}
>
> An invariant function returning an int*. The invariant overrides the  
> const.
>
What would be the point of an invariant method? A const method promises not
to change any contents of the object. An invariant method makes the same  
promise.
So there is no difference to the caller of such a method.
I can't see that it make any difference inside the method either.

Regards,

Bruce.




More information about the Digitalmars-d mailing list