// Boost.Convert test and usage example // Copyright (c) 2009-2014 Vladimir Batov. // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. See http://www.boost.org/LICENSE_1_0.txt. #include #include #include //[default_converter_declaration struct boost::cnv::by_default : public boost::cnv::lexical_cast {}; //] //[default_converter_headers1 using std::string; using boost::convert; //] int main(int argc, char const* argv[]) { //[default_converter_example1 int i = convert("123").value(); string s = convert(123).value(); // No explicit converter provided. boost::cnv::by_default is used. BOOST_TEST(i == 123); BOOST_TEST(s == "123"); //] }