Because i made a mistake!

struct vector(T, uint N) {
        auto opDispatch(string s) const {
                static if(N>0 && ("x"==s || "r"==s)) return v_[0];
                static if(N>1 && ("y"==s || "g"==s)) return v_[1];
                static if(N>2 && ("z"==s || "b"==s)) return v_[2];
                static if(N>3 && ("w"==s || "a"==s)) return v_[3];
                static assert("boom!");
        }
private:
        T[N] v_;
}

Better...

On Sun, 11 Apr 2010 02:49:14 +0400, so <s...@so.do> wrote:


struct vector(T, uint N) {
        auto opDispatch(string s) const {
                static if(N>0 && ("x"==s || "r"==s)) return v_[0];
                static if(N>1 && ("y"==s || "g"==s)) return v_[0];
                static if(N>2 && ("z"==s || "b"==s)) return v_[0];
                static if(N>3 && ("w"==s || "a"==s)) return v_[0];
                static assert("boom!");
        }
private:
        T[N] v_;
}

No unions, clean and all!
Then why do we need properties?



When i am sick, i try distract myself, this is one of those times, so just ignore me if it doesn't make sense :)
Thanks!



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Reply via email to