| 1 | // Copyright Antony Polukhin, 2023-2024. |
|---|---|
| 2 | // |
| 3 | // Distributed under the Boost |
| 4 | // Software License, Version 1.0. (See accompanying file |
| 5 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). |
| 6 | |
| 7 | #include <boost/lexical_cast.hpp> |
| 8 | |
| 9 | #include <boost/core/lightweight_test.hpp> |
| 10 | |
| 11 | #include <boost/lexical_cast.hpp> |
| 12 | |
| 13 | struct oops { |
| 14 | operator int () const { |
| 15 | return 41; |
| 16 | } |
| 17 | }; |
| 18 | |
| 19 | inline std::ostream& operator<<(std::ostream& os, const oops&) { |
| 20 | return os << 42; |
| 21 | } |
| 22 | |
| 23 | int main () { |
| 24 | auto val = boost::lexical_cast<int>(arg: oops{}); |
| 25 | BOOST_TEST_EQ(val, 42); |
| 26 | |
| 27 | return boost::report_errors(); |
| 28 | } |
| 29 |
