|
Boost : |
From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-08-31 09:03:37
On Saturday 31 August 2002 06:59 am, Alexander Nasonov wrote:
> Yes, definitely, because exact type matching is not required anymore. for
> example:
>
> struct X { /* ... */ };
> struct Y : X { /* ... */ };
>
> any y = Y();
> X & rx = any_cast<X &>(y); // doesn't throw!
>
> With new 'any' you can walk through hierarchy like you do using
> dynamic_cast. But it's longer distance walk because you can walk through
> non-polymorphic hierarchies, accross them and even visit non-class types:
I've been simulating this type of behavior with 'any' for a while, and would
love to see it available in Boost . Not sure how to handle the naming issue,
but dynamic_any seems fine to me.
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk