Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 08:19:40

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_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP
0006 #define BOOST_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP
0007 
0008 #include <system_error>
0009 
0010 namespace boost { 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); // NOLINT : Expression can not be simplified since this is the definition
0033     }
0034 
0035     constexpr explicit operator bool() const noexcept { return ec == std::errc{}; }
0036 };
0037 using from_chars_result = from_chars_result_t<char>;
0038 
0039 }} // Namespaces
0040 
0041 #endif // BOOST_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP