06-Jul-2013 05:34, Manu пишет:
Okay, so I feel like this should be possible, but I can't make it work...
I want to use template deduction to deduce the argument type, but I want
the function arg to be Unqual!T of the deduced type, rather than the
verbatim type of the argument given.
I've tried: void f(T : Unqual!U, U)(T a) {}
and: void f(T)(Unqual!T a) {}
The thing is that if even if you somehow force your way past IFTI what would be generated is:
f!(const int)(int arg);
f!(immutable int)(int arg);
f!(shared int)(int arg);
f!(const shared int)(int arg);
Which IMHO falls short of desired goal.
Short of using a forwarding thunk (that you don't like, but if there was force_inline?) we'd have to hack the compiler.