Inout unclearness

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 22 00:49:06 PDT 2015


How about this?

const(A) f(const(B) b);
auto constBack(R,P)(const R r, P p);

Then invoke:

B b;
A a = f(b).constBack(b);

So `f` takes const parameters and returns const result, you feed 
the result to the function `constBack` with one of parameters and 
it infers constness from that parameter and casts the result to 
the inferred constness.


More information about the Digitalmars-d mailing list