opDispatch is grand!
so
so at so.do
Sat Apr 10 15:49:14 PDT 2010
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/
More information about the Digitalmars-d
mailing list