https://issues.dlang.org/show_bug.cgi?id=24688

--- Comment #6 from Dominikus Dittes Scherkl <[email protected]> ---
Ok, it's possible to optimize it to one extra line:

T tpl(T)(T x)
{
   ...
}

becomes

T tpl(T)(T x)
{
   static if(is(T==const)) return tpl(cast(T)x);
   ...
}

But I have to add this to pretty much *every* template in my code, as this is a
pattern that I use almost always. And I can only hope, the compiler is smart
enough to optimize this extra call and additional copy of x away.

--

Reply via email to