Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:38:57

0001 // Copyright 2023 Matt Borland
0002 // Distributed under the Boost Software License, Version 1.0.
0003 // https://www.boost.org/LICENSE_1_0.txt
0004 
0005 #ifndef BOOST_JSON_DETAIL_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP
0006 #define BOOST_JSON_DETAIL_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP
0007 
0008 #include <system_error>
0009 
0010 namespace boost { namespace json { namespace detail { namespace charconv {
0011 
0012 // 22.13.3, Primitive numerical input conversion
0013 
0014 template <typename UC>
0015 struct from_chars_result_t
0016 {
0017     const UC* ptr;
0018 
0019     // Values:
0020     // 0 = no error
0021     // EINVAL = invalid_argument
0022     // ERANGE = result_out_of_range
0023     std::errc ec;
0024 
0025     friend constexpr bool operator==(const from_chars_result_t<UC>& lhs, const from_chars_result_t<UC>& rhs) noexcept
0026     {
0027         return lhs.ptr == rhs.ptr && lhs.ec == rhs.ec;
0028     }
0029 
0030     friend constexpr bool operator!=(const from_chars_result_t<UC>& lhs, const from_chars_result_t<UC>& rhs) noexcept
0031     {
0032         return !(lhs == rhs);
0033     }
0034 };
0035 using from_chars_result = from_chars_result_t<char>;
0036 
0037 }}}} // Namespaces
0038 
0039 #endif // BOOST_JSON_DETAIL_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP