Templates convariance
Tom S
h3r3tic at remove.mat.uni.torun.pl
Tue Jun 20 10:57:24 PDT 2006
michal.minich at gmail.com wrote:
> Thank you for casting solution. It should works perfect for my problem. But
> could you explain me how this can mess things up?
Basically, the fact that Foo is castable to Bar doesn't mean that
Baz!(Foo) should be castable to Baz!(Bar). Their implementation may be
totally different based on some static if's and other fancy stuff. IMO
they are two totally separate classes. If that kind of invariance would
be to be allowed, then one would sometimes need to specify explicitly
that a given Baz!(Bar) should not be casted to a Baz!(Foo). And in that
case, why not reverse the idea and just use the method I provided in the
remaining cases ? :)
--
Tomasz Stachowiak /+ a.k.a. h3r3tic +/
More information about the Digitalmars-d
mailing list