On Saturday, 6 July 2013 at 10:34:04 UTC, Manu wrote:This seems like a defect of the language. Perhaps a new language feature is needed. Something like this:
I'm getting the distinct feeling that what I want is not actually possible.
Which I have to say, is rather surprising.
void foo(inout T)(T t)
{
t.mutate();
}
Pass a variable of type S, const(S), or mutable(S), and the function signature becomes:
void foo(S);
And then fails if your argument cannot be converted to mutable S.