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.

Reply via email to