| 1 | // Copyright 2023 Matt Borland |
| 2 | // Distributed under the Boost Software License, Version 1.0. |
| 3 | // https://www.boost.org/LICENSE_1_0.txt |
| 4 | |
| 5 | #ifndef BOOST_CHARCONV_DETAIL_TO_CHARS_RESULT_HPP |
| 6 | #define BOOST_CHARCONV_DETAIL_TO_CHARS_RESULT_HPP |
| 7 | |
| 8 | #include <system_error> |
| 9 | |
| 10 | // 22.13.2, Primitive numerical output conversion |
| 11 | |
| 12 | namespace boost { namespace charconv { |
| 13 | |
| 14 | struct to_chars_result |
| 15 | { |
| 16 | char *ptr; |
| 17 | std::errc ec; |
| 18 | |
| 19 | constexpr friend bool operator==(const to_chars_result &lhs, const to_chars_result &rhs) noexcept |
| 20 | { |
| 21 | return lhs.ptr == rhs.ptr && lhs.ec == rhs.ec; |
| 22 | } |
| 23 | |
| 24 | constexpr friend bool operator!=(const to_chars_result &lhs, const to_chars_result &rhs) noexcept |
| 25 | { |
| 26 | return !(lhs == rhs); |
| 27 | } |
| 28 | |
| 29 | constexpr explicit operator bool() const noexcept { return ec == std::errc{}; } |
| 30 | }; |
| 31 | |
| 32 | }} // Namespaces |
| 33 | |
| 34 | #endif //BOOST_CHARCONV_DETAIL_TO_CHARS_RESULT_HPP |
| 35 | |