On 1/7/15 1:27 PM, Julian Kranz wrote:
On Monday, 29 December 2014 at 20:24:13 UTC, Steven Schveighoffer wrote:
OK, it's not inferring the const on 'this'. It ONLY does this if you
have a 'this' template parameter in the template list. This works:
void blah(T, this _)(void function(T t) f)
interesting, can someone explain this requirement?
I'd really like to know that, too ;-). Thank you again for all your
answers!
Yeah, I think this is a missed opportunity.
1. A template is (most of the time) automatically not virtual.
2. If a template can be inferred const or inout, it can be called with
more instances for free.
3. In some cases, when the template parameters itself may determine the
ability of the function to be const or not, it's not possible to slap a
"const" on there, or split it up.
I notice there are already a couple of reports about this:
https://issues.dlang.org/show_bug.cgi?id=7521
https://issues.dlang.org/show_bug.cgi?id=8407
-Stev