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:
1 parent
ee378e1e75
commit
bfd8e867b6
1 file changed
+6
-4
@@ -14,7 +14,6 @@ using nlohmann::json;
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <type_traits>
|
|
||||||
#include <valarray>
|
#include <valarray>
|
||||||
#if JSON_HAS_RANGES
|
#if JSON_HAS_RANGES
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
@@ -1074,14 +1073,17 @@ struct sweep_allocator
|
|||||||
return (std::numeric_limits<std::size_t>::max)() / sizeof(T);
|
return (std::numeric_limits<std::size_t>::max)() / sizeof(T);
|
||||||
}
|
}
|
||||||
|
|
||||||
// libc++ probes whether construct() is usable for const objects (when
|
template<class U, class... Args>
|
||||||
// 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>
|
|
||||||
void construct(U* p, Args&& ... args) noexcept(noexcept(::new (static_cast<void*>(p)) U(std::forward<Args>(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)...);
|
::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>
|
template<class U>
|
||||||
void destroy(U* p) noexcept
|
void destroy(U* p) noexcept
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user