On 9/19/13 12:44 PM, Benjamin Thaut wrote:
Can't we make the compiler deduce the static attribute? If a template
method or a method of a template struct / class does not access any of
its members it becomes static automatically?
That would be nice for this case, but it's a breaking change and I'm not
sure how confusing it would be in general.
Allowing static/nonstatic overloading would help because at least I
could do this:
int method() { return 1 + _theT.method(); }
static if (!hasState)
static int method() { return S().method(); }
which still is quite a bit of work, but less net duplication.
Andrei