⚗️ do not include <ciso646> with C++20 #2089

This commit is contained in:
Niels Lohmann 2020-05-07 10:17:32 +02:00
parent 9adb1c0235
commit 8c2b26de4a
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
2 changed files with 45 additions and 49 deletions

View file

@ -1,12 +1,8 @@
#pragma once
#include <nlohmann/detail/macro_scope.hpp>
// Header <ciso646> is needed for older MSVC versions to allow to use the
// alternative operator representations "and", "or", and "not". As the header
// is removed in C++20, we must only include it for old MSVC versions.
// Header <ciso646> is removed in C++20.
// See <https://github.com/nlohmann/json/issues/2089> for more information.
#if !JSON_HEDLEY_MSVC_VERSION_CHECK(15,5,0)
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif

View file

@ -70,6 +70,49 @@ SOFTWARE.
// #include <nlohmann/detail/boolean_operators.hpp>
// Header <ciso646> is removed in C++20.
// See <https://github.com/nlohmann/json/issues/2089> for more information.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
// #include <nlohmann/detail/exceptions.hpp>
#include <exception> // exception
#include <stdexcept> // runtime_error
#include <string> // to_string
// #include <nlohmann/detail/input/position_t.hpp>
#include <cstddef> // size_t
namespace nlohmann
{
namespace detail
{
/// struct to capture the start position of the current token
struct position_t
{
/// the total number of characters read
std::size_t chars_read_total = 0;
/// the number of characters read in the current line
std::size_t chars_read_current_line = 0;
/// the number of lines read
std::size_t lines_read = 0;
/// conversion to size_t to preserve SAX interface
constexpr operator size_t() const
{
return chars_read_total;
}
};
} // namespace detail
} // namespace nlohmann
// #include <nlohmann/detail/macro_scope.hpp>
@ -2107,49 +2150,6 @@ JSON_HEDLEY_DIAGNOSTIC_POP
AllocatorType, JSONSerializer, BinaryType>
#if !JSON_HEDLEY_MSVC_VERSION_CHECK(15,5,0)
#include <ciso646> // and, not, or
#endif
// #include <nlohmann/detail/exceptions.hpp>
#include <exception> // exception
#include <stdexcept> // runtime_error
#include <string> // to_string
// #include <nlohmann/detail/input/position_t.hpp>
#include <cstddef> // size_t
namespace nlohmann
{
namespace detail
{
/// struct to capture the start position of the current token
struct position_t
{
/// the total number of characters read
std::size_t chars_read_total = 0;
/// the number of characters read in the current line
std::size_t chars_read_current_line = 0;
/// the number of lines read
std::size_t lines_read = 0;
/// conversion to size_t to preserve SAX interface
constexpr operator size_t() const
{
return chars_read_total;
}
};
} // namespace detail
} // namespace nlohmann
// #include <nlohmann/detail/macro_scope.hpp>
namespace nlohmann
{
namespace detail