opDispatch
Danny via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Dec 25 07:50:06 PST 2014
Hi,
I'm trying to learn how opDispatch works. Unfortunately, a very
simple example already doesn't work (error: no property 'a' for
type 'Foo'):
import std.stdio : writeln;
struct X {
int a;
}
class Foo {
X value;
template opDispatch(string s) {
value.opDispatch!(s) opDispatch;
}
}
int main() {
auto f = new Foo;
writeln(f.a);
return 0;
}
What am I missing?
Is there another way to make Foo forward all unknown things to X ?
More information about the Digitalmars-d-learn
mailing list