Make is_trivial_element a struct so astyle does not indent it

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-24 07:20:57 +02:00
1 parent cf0c72cd95
commit 469e29334b
2 files changed
+14 -10

No files matched your search

@@ -362,14 +362,16 @@ std::array<T, sizeof...(Idx)> from_json_inplace_array_impl(const BasicJsonType&
return { { j.at(Idx).template get<T>()... } }; return { { j.at(Idx).template get<T>()... } };
} }
// 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<typename T>
struct is_trivial_element
#ifdef JSON_HAS_CPP_26 #ifdef JSON_HAS_CPP_26
template<typename T> : conjunction<std::is_trivially_copyable<T>, std::is_trivially_default_constructible<T>>
using is_trivial_element = conjunction<std::is_trivially_copyable<T>, std::is_trivially_default_constructible<T>>;
#else #else
template<typename T> : std::is_trivial<T>
using is_trivial_element = std::is_trivial<T>;
#endif #endif
{};
// the element type may not be default constructible: construct every element // the element type may not be default constructible: construct every element
// in place (a pack expansion that is unrolled N times) // in place (a pack expansion that is unrolled N times)
+7 -5
View File
@@ -6386,14 +6386,16 @@ std::array<T, sizeof...(Idx)> from_json_inplace_array_impl(const BasicJsonType&
return { { j.at(Idx).template get<T>()... } }; return { { j.at(Idx).template get<T>()... } };
} }
// 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<typename T>
struct is_trivial_element
#ifdef JSON_HAS_CPP_26 #ifdef JSON_HAS_CPP_26
template<typename T> : conjunction<std::is_trivially_copyable<T>, std::is_trivially_default_constructible<T>>
using is_trivial_element = conjunction<std::is_trivially_copyable<T>, std::is_trivially_default_constructible<T>>;
#else #else
template<typename T> : std::is_trivial<T>
using is_trivial_element = std::is_trivial<T>;
#endif #endif
{};
// the element type may not be default constructible: construct every element // the element type may not be default constructible: construct every element
// in place (a pack expansion that is unrolled N times) // in place (a pack expansion that is unrolled N times)