const Propagation

Julian Kranz via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 29 05:20:39 PST 2014


Thank you for your answer. This kind of thing also works for C++, 
but that would mean that I would implement the whole visitor 
twice - one const and one non-const version. Is that really the 
only way? Can't I tell the D compiler that "the argument of that 
lambda shares the const-ness of the current object"?

D offers "inout"; this actually aims into the right directing, 
but I guess it does not help here.

Is there any "static if"-something construct to check the 
const-ness of an object?


More information about the Digitalmars-d mailing list