| 1 | #include <stdexcept>
|
|---|
| 2 | #include <iostream>
|
|---|
| 3 | #include <boost/lexical_cast.hpp>
|
|---|
| 4 |
|
|---|
| 5 | #define ECHO(S) std::cerr << S << std::endl
|
|---|
| 6 |
|
|---|
| 7 | struct Escape
|
|---|
| 8 | {
|
|---|
| 9 | Escape(const std::string& s)
|
|---|
| 10 | : str_(s)
|
|---|
| 11 | {}
|
|---|
| 12 |
|
|---|
| 13 | std::string str_;
|
|---|
| 14 | };
|
|---|
| 15 |
|
|---|
| 16 | inline
|
|---|
| 17 | std::ostream&
|
|---|
| 18 | operator<< (std::ostream& o, const Escape& rhs)
|
|---|
| 19 | {
|
|---|
| 20 | return o << rhs.str_;
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | int
|
|---|
| 24 | main()
|
|---|
| 25 | {
|
|---|
| 26 | try
|
|---|
| 27 | {
|
|---|
| 28 | std::cerr << boost::lexical_cast<std::string>(Escape("")) << std::endl;
|
|---|
| 29 | ECHO("pass");
|
|---|
| 30 | }
|
|---|
| 31 | catch (std::exception& e)
|
|---|
| 32 | {
|
|---|
| 33 | ECHO("FAIL: " << e.what());
|
|---|
| 34 | }
|
|---|
| 35 | }
|
|---|