Why can't enums be used as types in this (simplified) example?

enum Positivity
{
        Positive,
        Negative
}

struct Wave
{
public:
        Positivity slope;
}

enum Waves
{
        Sin = Wave(Positivity.Positive),
        Cos = Wave(Positivity.Negative)
}

int nth_value(T : Waves)(int n);

int nth_value(T : Waves.Sin)(int n)
{
        return n % 2 ? 1 : -1;
}

int nth_value(T : Waves.Cos)(int n)
{
        return n % 2 ? -1 : 1;
}

void main()
{
        import std.stdio;

        writeln(nth_value!(Waves.Sin)(1));
}

Reply via email to