On Wednesday, 16 December 2015 at 17:14:50 UTC, Andrei
Alexandrescu wrote:
So, I wrote this beautiful BigO framework: <400 lines all told,
clear code, real nice. Then I got this cold shower:
void insertFrontMany(C, R)(C container, R range)
@BigO(complexity!(C.insertFront) * linearTime)
{
...
}
My hope being of course that for containers with linear
insertion time at the front I'll get quadratic, etc. The hitch
is:
test.d(377): Error: undefined identifier 'C.insertFront'
So... attributes are currently not allowed to depend on
template parameters, which is a serious damper on enthusiasm.
Seems to me this is a bug - different instantiations should
have different attributes etc. Is there any matter of principle
making this not work?
If this won't work at all, I'll need to resort to expressing
complexity via traits. Not as nice!
Thanks,
Andrei
What you are asking the compiler here is ambiguous. It is not
clear if the attribute apply to the template (in which case
argument may not be used) or the instantiated eponymous function
in it.