On Friday, 27 April 2012 at 11:49:08 UTC, Kevin Cox wrote:
On Apr 27, 2012 7:34 AM, "so" <[email protected]> wrote:
I agree it is ugly. If there is a way out (reason why i
asked), we should
just dump it.
I don't like the idea either because it is confusing. The only
reason I
can imagine is if there was polymorphism on statics which I see
as a fairly
useless feature. I would be interested to hear of possible
use cases
though.
This one is quite important for templates.
struct A(T)
{
static T mini() { return T.min; }
static T maxi() { return T.max; }
}
struct B(T)
{
T[] v;
T mini() { return min(v); }
T maxi() { return max(v); }
}
void test(T)(T a)
{
writeln("min: ", a.mini());
writeln("max: ", a.maxi());
}