Fix CI: astyle and clang-tidy for sweep_allocator::construct()

astyle 3.4.13 reformats the enable_if<!...> default template argument
(Check amalgamation). Delete the const overload instead, which makes the
libc++ probe for const objects fail in the SFINAE context just the same
and needs no <type_traits>.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N5NasEsrzHhSNouxSoEwqz
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels LohmannandClaude Sonnet 5.5 committed 2026-11-07 09:08:20 +00:00
1 parent ee378e1e75
commit bfd8e867b6
1 file changed
+6 -4
+6 -4
View File
@@ -14,7 +14,6 @@ using nlohmann::json;
#include <functional>
#include <limits>
#include <type_traits>
#include <valarray>
#if JSON_HAS_RANGES
#include <ranges>
@@ -1074,14 +1073,17 @@ struct sweep_allocator
return (std::numeric_limits<std::size_t>::max)() / sizeof(T);
}
// libc++ probes whether construct() is usable for const objects (when
// checking for trivial copies); this must not be viable then
template<class U, class... Args, typename = typename std::enable_if<!std::is_const<U>::value>::type>
template<class U, class... Args>
void construct(U* p, Args&& ... args) noexcept(noexcept(::new (static_cast<void*>(p)) U(std::forward<Args>(args)...)))
{
::new (static_cast<void*>(p)) U(std::forward<Args>(args)...);
}
// libc++ probes whether construct() is usable for const objects (when
// checking for trivial copies); this must not be viable then
template<class U, class... Args>
void construct(const U* /*unused*/, const Args& ... /*unused*/) = delete;
template<class U>
void destroy(U* p) noexcept
{