Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Function template convert

boost::convert — Boost.Convert deployment interface with the default converter.

Synopsis

// In header: <boost/convert.hpp>


template<typename TypeOut, typename TypeIn> 
  boost::optional< TypeOut > convert(TypeIn const & value_in);

Description

For example,

    struct boost::cnv::by_default : public boost::cnv::cstream {};

    // boost::cnv::cstream (through boost::cnv::by_default) is deployed
    // as the default converter when no converter is provided explicitly.
    boost::optional<int>    i = boost::convert<int>("12");
    boost::optional<string> s = boost::convert<string>(123.456);


PrevUpHomeNext