diff --git a/include/nlohmann/detail/conversions/from_json.hpp b/include/nlohmann/detail/conversions/from_json.hpp index 93dc1637f..e7bae4572 100644 --- a/include/nlohmann/detail/conversions/from_json.hpp +++ b/include/nlohmann/detail/conversions/from_json.hpp @@ -362,14 +362,16 @@ std::array from_json_inplace_array_impl(const BasicJsonType& return { { j.at(Idx).template get()... } }; } -// std::is_trivial is deprecated in C++26 (see binary_writer::to_char_type) +// std::is_trivial is deprecated in C++26 (see binary_writer::to_char_type); +// a struct rather than an alias, as astyle indents an #ifdef block of aliases +template +struct is_trivial_element #ifdef JSON_HAS_CPP_26 - template - using is_trivial_element = conjunction, std::is_trivially_default_constructible>; + : conjunction, std::is_trivially_default_constructible> #else - template - using is_trivial_element = std::is_trivial; + : std::is_trivial #endif +{}; // the element type may not be default constructible: construct every element // in place (a pack expansion that is unrolled N times) diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index f2c58fdb9..b991dddbf 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -6386,14 +6386,16 @@ std::array from_json_inplace_array_impl(const BasicJsonType& return { { j.at(Idx).template get()... } }; } -// std::is_trivial is deprecated in C++26 (see binary_writer::to_char_type) +// std::is_trivial is deprecated in C++26 (see binary_writer::to_char_type); +// a struct rather than an alias, as astyle indents an #ifdef block of aliases +template +struct is_trivial_element #ifdef JSON_HAS_CPP_26 - template - using is_trivial_element = conjunction, std::is_trivially_default_constructible>; + : conjunction, std::is_trivially_default_constructible> #else - template - using is_trivial_element = std::is_trivial; + : std::is_trivial #endif +{}; // the element type may not be default constructible: construct every element // in place (a pack expansion that is unrolled N times)