mirror of
https://github.com/nlohmann/json.git
synced 2026-07-03 01:04:18 +00:00
Overwork project infrastructure (#5218)
* 📝 overwork project infrastructure Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🐛 fix GCC16 issue Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🐛 fix GCC16 issue Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🐛 only build module for GCC Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🐛 fix build Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 📝 fix documentation Closes #5012: fix the error_handler_t::ignore wording Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 📝 fix documentation Closes #4354: fix "Custom data source" example Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1937,6 +1952,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
#endif
|
||||
#if defined(JSON_HAS_CPP_17) && JSON_HAS_STATIC_RTTI
|
||||
detail::negation<std::is_same<ValueType, std::any>>,
|
||||
#endif
|
||||
#if defined(JSON_HAS_CPP_17)
|
||||
// std::optional<T> can construct itself from basic_json; excluding it
|
||||
// here avoids an ambiguity with that constructor (e.g., under C++26)
|
||||
detail::negation<detail::is_std_optional<ValueType>>,
|
||||
#endif
|
||||
detail::is_detected_lazy<detail::get_template_function, const basic_json_t&, ValueType>
|
||||
>::value, int >::type = 0 >
|
||||
|
||||
Reference in New Issue
Block a user