PrevUpHomeNext

Function template apply

boost::cnv::apply — Boost.Convert deployment interface with algorithms.

Synopsis

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


template<typename TypeOut, typename TypeIn, typename Converter> 
  reference< Converter, TypeOut, TypeIn > apply(Converter const & cnv);

Description

For example,

std::array<char const*, 3> strs = {{ " 5", "0XF", "not an int" }};
std::vector<int>           ints;
boost::cnv::cstream         cnv;

cnv(std::hex)(std::skipws);

std::transform(
    strs.begin(),
    strs.end(),
    std::back_inserter(ints),
    boost::cnv::apply<int>(std::cref(cnv)).value_or(-1));


PrevUpHomeNext