
Hi all, I couldn't find any boost::get<T> style accessors for boost::any, so I came up with an implementation that looks something along the following lines. #include <boost/any.hpp> #include <boost/call_traits.hpp> namespace boost { template<class T> typename boost::call_traits<T>::reference get(any &a) { return boost::any_cast<typename boost::call_traits<T>::reference>(a); } template<class T> typename boost::call_traits<T>::const_reference get(const any &a) { return boost::any_cast<typename boost::call_traits<T>::const_reference>(a); } } In case it cannot be converted to the desired destination type a bad_any_cast exception is thrown. The above code enables boost.any and boost.variant to be used interchangeably as far as boost::get<T> is concerned. Any thoughts? Best regards, Christoph