const ref in opAssign

Jonathan M Davis jmdavisProg at gmx.com
Tue Jun 26 11:40:47 PDT 2012


On Tuesday, June 26, 2012 20:10:59 Timon Gehr wrote:
> On 06/26/2012 02:44 PM, monarch_dodra wrote:
> > Is there any way to enforce const correctness, ...
> 
> Note that 'const correctness' is a C++ term that does not really have
> an obvious counterpart in D.

Really? I'd have said that a type was const correct if every one of its 
functions that could be const was const, and that applies to D as much as C++. 
It's just that you don't have the same issues with types subverting const in D 
that you have in C++, since there is no mutable keyword and casting away const 
and mutating the object is undefined.

- Jonathan M Davis


More information about the Digitalmars-d mailing list