const, auto and struct/class methods

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Mon Nov 25 04:13:36 PST 2013


On 25/11/13 12:00, bearophile wrote:
> Is this acceptable?

Actually, your suggestion made me realize I could do even better -- here's the 
patch I came up with in the end:
https://github.com/WebDrake/Dgraph/commit/34d6cfacee928b74d084cff7c2f6c438f5144436

The arrays in question are only ever assigned as slices of underlying data, so 
they can be const(size_t)[][] from the start.

So, thank you! :-)

I would still like to know if there's a way of enforcing const-ness in an auto 
return type, though.  You never know when it could be useful.


More information about the Digitalmars-d-learn mailing list