Boost logo

Boost :

From: Alexander Nasonov (alnsn-mycop_at_[hidden])
Date: 2003-01-16 04:06:52


Unai Uribarri Rodríguez wrote:

> any_cast, as is implemented in boost 1.29, has one weakness; it doesn't
> allow to compile this piece of code:
>
> any x=int(5);
> ++any_cast<int&>(x);
>
> because any_cast tries to instanciate a pointer to int&. The attached
> patch solved this problem using boost::remove_reference from
> boost/type_traits.hpp.
>
> any_cast<T&>(x) will return a reference to value contained in x if its
> type is T, or raise bad_cast otherwise.

Boost.dynamic_any has extract functinos which work this way.

-- 
Alexander Nasonov
Remove -mycop from my e-mail address for timely response

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk