Ticket #8124: test_lc.cpp
| File test_lc.cpp, 360 bytes (added by , 10 years ago) |
|---|
| Line | |
|---|---|
| 1 | #include <string> |
| 2 | #include <iostream> |
| 3 | #include <boost/lexical_cast.hpp> |
| 4 | |
| 5 | using namespace std; |
| 6 | |
| 7 | int main(int, char**) |
| 8 | { |
| 9 | try { |
| 10 | unsigned int a = boost::lexical_cast<unsigned int>(std::string("-1000")); |
| 11 | cout << "a = " << a << endl; |
| 12 | } catch (const boost::bad_lexical_cast &e) |
| 13 | { |
| 14 | cout << "exc. caught: " << e.what() << endl; |
| 15 | } |
| 16 | return 0; |
| 17 | } |
