boost::convert
// In header: <boost/convert/api.hpp> template<typename TypeOut> struct convert { // types typedef boost::convert< TypeOut > this_type; typedef unspecified out_type; typedef this_type::result result_type; // member classes/structs/unions template<typename TypeIn, typename Converter> struct algorithm_helper { // types typedef algorithm_helper this_type; // construct/copy/destruct algorithm_helper(Converter const &); // public member functions template<typename FallbackType> with_fallback value_or(FallbackType const &); TypeOut operator()(TypeIn const &); }; template<typename TypeIn, typename Converter> struct algorithm_helper<TypeIn, Converter> { // types typedef boost::convert< TypeOut >::algorithm_helper< TypeIn, Converter >::with_fallback this_type; typedef boost::convert< TypeOut >::algorithm_helper< TypeIn, Converter > base_type; // public member functions with_fallback(base_type const &, TypeOut const &); TypeOut operator()(TypeIn const &); // public data members out_type fallback_; }; struct result { // types typedef result this_type; typedef boost::safebool< result > safebool; // construct/copy/destruct result(out_type const &); // public member functions bool operator!() const; operator typename safebool::type() const; out_type const & value() const; template<typename FallbackType> out_type value_or(FallbackType const &) const; // private member functions this_type & operator()(bool); }; // public static functions static out_type create_storage(); template<typename TypeIn, typename Converter> static result_type from(TypeIn const &, Converter const &); template<typename TypeIn, typename Converter> static algorithm_helper< TypeIn, Converter > from(Converter const &); };
convert public static functionsstatic out_type create_storage();
template<typename TypeIn, typename Converter> static result_type from(TypeIn const & value_in, Converter const & converter);
template<typename TypeIn, typename Converter> static algorithm_helper< TypeIn, Converter > from(Converter const & cnv);