Hi,
I wonder why I can't use Algebraic like this:
struct Foo(bool flag)
{
size_t bar() { return flag ? 42 : 0; }
}
Foo!false f;
Foo!true t;
Algebraic!(typeof(t), typeof(f)) v;
v = t;
Variant i = v.bar(); // or an Algebraic of the return types.
This doesn't compile anyway
assert(i.type == typeof(size_t));
assert(i.get!size_t() == 42);
Essentially what I miss is opDispatch implemented on Variant.
There seemed to be a discussion with a proposal for an Any type
in std.typecons some time ago
(http://forum.dlang.org/thread/20100708100757.GA4412@dsource),
but for some reason none of it has made it into Phobos.
Can anyone explain about why it isn't implemented? Seems like I
missed something...