#include #include using namespace std; int main() { using boost::lexical_cast; int a = lexical_cast("123"); double b = lexical_cast("123.0123456789"); string s0 = lexical_cast(a); string s1 = lexical_cast(b); cout << "number: " << a << " " << b << endl; cout << "string: " << s0 << " " << s1 << endl; int c = 0; try { c = lexical_cast("abcd"); } catch (boost::bad_lexical_cast& e) { cout << e.what() << endl; } return 0; }