Destructors, const structs, and opEquals

foobar foo at bar.com
Fri Dec 10 16:10:45 PST 2010


Don Wrote:

> Steven Schveighoffer wrote:
> > To summarize for those looking for the C++ behavior, the equivalent 
> > would be:
> > 
> > void foo(auto ref const Widget)
> 
> That use of 'auto' is an abomination.

I agree with don. 
IMHO, this is incredibly silly given Andrei's use case, since D can have instead: 
void foo(const Widget);
and have an optimization inside the compiler for value types to pass by ref. 

by specifying "const ref" you explicitly require that only a ref to an l-value be provided, whereas without the "ref" an r-value is also allowed a-la c++. 

much KISSer.


More information about the Digitalmars-d mailing list