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.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to