🐛 fix GCC16 issue

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2026-06-29 09:13:32 +02:00
parent 1d77ffe695
commit 794ab7d03b
3 changed files with 30 additions and 24 deletions
@@ -13,9 +13,6 @@
#include <tuple> // tuple
#include <type_traits> // false_type, is_constructible, is_integral, is_same, true_type
#include <utility> // declval
#if defined(__cpp_lib_optional) && __cpp_lib_optional >= 201606L
#include <optional> // optional
#endif
#if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L
#include <cstddef> // byte
#endif
@@ -80,15 +77,6 @@ struct is_json_ref : std::false_type {};
template<typename T>
struct is_json_ref<json_ref<T>> : std::true_type {};
// trait to detect std::optional<T> specializations
template<typename>
struct is_std_optional : std::false_type {};
#if defined(__cpp_lib_optional) && __cpp_lib_optional >= 201606L
template<typename T>
struct is_std_optional<std::optional<T>> : std::true_type {};
#endif
//////////////////////////
// aliases for detected //
//////////////////////////
+15
View File
@@ -86,6 +86,21 @@
*/
NLOHMANN_JSON_NAMESPACE_BEGIN
namespace detail
{
// Trait to detect std::optional<T> specializations. It is defined here rather
// than in type_traits.hpp so that adding the <optional> include does not change
// the include order of the C++20 module's global module fragment (the include
// is already pulled in by the conversion headers above); see src/modules/json.cppm.
template<typename>
struct is_std_optional : std::false_type {};
#ifdef JSON_HAS_CPP_17
template<typename T>
struct is_std_optional<std::optional<T>> : std::true_type {};
#endif
} // namespace detail
/*!
@brief a class to store JSON values