why can't I call const methods on shared objects?

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 9 14:41:13 PDT 2014


On Fri, 09 May 2014 17:37:35 -0400, Vlad Levenfeld <vlevenfeld at gmail.com>  
wrote:

> Error: non-shared const method is not callable using a shared mutable  
> object
>
> Why not? If the method is const, it can't modify the object anyway.

Non-shared methods cannot be called on shared objects. Otherwise, you  
could have unintended race conditions.

-Steve


More information about the Digitalmars-d-learn mailing list