diff --git a/src/ll/api/data/AnyFunction.h b/src/ll/api/data/AnyFunction.h index 3326889ac4..835772c6dd 100644 --- a/src/ll/api/data/AnyFunction.h +++ b/src/ll/api/data/AnyFunction.h @@ -49,10 +49,10 @@ class AnyFunctionData : public AnyFunctionDataBase { template std::any invokeImpl(std::span args, std::index_sequence) { if constexpr (std::is_void_v) { - (void)fn(getArg(args[I])...); + (void)std::invoke(std::forward(fn), getArg(args[I])...); return {}; } else { - return std::make_any(fn(getArg(args[I])...)); + return std::make_any(std::invoke(std::forward(fn), getArg(args[I])...)); } } @@ -112,12 +112,12 @@ class alignas(std::max_align_t) AnyFunction { dataPtr = nullptr; } } - void resetCopy(AnyFunction const& other) { + void copy(AnyFunction const& other) { if (other) { dataPtr = other.dataPtr->copy(&soo); } } - void resetMove(AnyFunction&& other) noexcept { + void move(AnyFunction&& other) noexcept { if (other) { if (other.isLarge()) { dataPtr = other.dataPtr; @@ -129,7 +129,7 @@ class alignas(std::max_align_t) AnyFunction { } } template - void reset(Fn&& fn) { + void construct(Fn&& fn) { if constexpr (std::is_pointer_v || traits::is_specialization_of_v || std::is_member_pointer_v) { if (!fn) { @@ -144,20 +144,20 @@ class alignas(std::max_align_t) AnyFunction { AnyFunction(std::nullptr_t) {} ~AnyFunction() { tidy(); } - AnyFunction(AnyFunction const& other) { resetCopy(other); } - AnyFunction(AnyFunction&& other) noexcept { resetMove(std::move(other)); } + AnyFunction(AnyFunction const& other) { copy(other); } + AnyFunction(AnyFunction&& other) noexcept { move(std::move(other)); } AnyFunction& operator=(AnyFunction const& other) { if (this != std::addressof(other)) { tidy(); - resetCopy(other); + copy(other); } return *this; } AnyFunction& operator=(AnyFunction&& other) noexcept { if (this != std::addressof(other)) { tidy(); - resetMove(std::move(other)); + move(std::move(other)); } return *this; } @@ -166,16 +166,16 @@ class alignas(std::max_align_t) AnyFunction { std::swap(dataPtr, other.dataPtr); } else { AnyFunction temp; - temp.resetMove(std::move(*this)); - resetMove(std::move(other)); - other.resetMove(std::move(temp)); + temp.move(std::move(*this)); + move(std::move(other)); + other.move(std::move(temp)); } } template requires(std::invocable) AnyFunction(std::in_place_type_t, Fn&& fn) { - reset(std::forward(fn)); + construct(std::forward(fn)); } template