| Home | Libraries | People | FAQ | More

## Function template convert

boost::convert — Boost.Convert main deployment interface.

## Synopsis

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

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

## Description

For example,

    boost::cnv::cstream cnv;

    boost::optional<int>    i = boost::convert<int>("12", cnv);
    boost::optional<string> s = boost::convert<string>(123.456, cnv);

Parameters: |
`converter` | Converter to be used for conversion
`value_in` | Value of the TypeIn type to be converted to the TypeOut type
Returns: | boost::optional<TypeOut> result of conversion together with the indication of success or failure of the conversion request.