From 8c2b26de4a9886751b8c7d88b788dc33c515f9f0 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Thu, 7 May 2020 10:17:32 +0200 Subject: [PATCH] :alembic: do not include with C++20 #2089 --- include/nlohmann/detail/boolean_operators.hpp | 8 +- single_include/nlohmann/json.hpp | 86 +++++++++---------- 2 files changed, 45 insertions(+), 49 deletions(-) diff --git a/include/nlohmann/detail/boolean_operators.hpp b/include/nlohmann/detail/boolean_operators.hpp index ed4b0435..06335866 100644 --- a/include/nlohmann/detail/boolean_operators.hpp +++ b/include/nlohmann/detail/boolean_operators.hpp @@ -1,12 +1,8 @@ #pragma once -#include - -// Header 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 is removed in C++20. // See for more information. -#if !JSON_HEDLEY_MSVC_VERSION_CHECK(15,5,0) +#if __cplusplus <= 201703L #include // and, not, or #endif diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 6eeef012..b1ed374f 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -70,6 +70,49 @@ SOFTWARE. // #include +// Header is removed in C++20. +// See for more information. + +#if __cplusplus <= 201703L + #include // and, not, or +#endif + +// #include + + +#include // exception +#include // runtime_error +#include // to_string + +// #include + + +#include // 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 @@ -2107,49 +2150,6 @@ JSON_HEDLEY_DIAGNOSTIC_POP AllocatorType, JSONSerializer, BinaryType> -#if !JSON_HEDLEY_MSVC_VERSION_CHECK(15,5,0) - #include // and, not, or -#endif - -// #include - - -#include // exception -#include // runtime_error -#include // to_string - -// #include - - -#include // 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 - - namespace nlohmann { namespace detail