diff --git a/src/aether-miscpp/meta/function_signature.h b/src/aether-miscpp/meta/function_signature.h index a27bf59..655f865 100644 --- a/src/aether-miscpp/meta/function_signature.h +++ b/src/aether-miscpp/meta/function_signature.h @@ -22,8 +22,11 @@ #include "aether-miscpp/meta/type_list.h" namespace ae { +template +struct FunctionSignatureTraits; + template -struct FunctionSignatureImpl { +struct FunctionSignatureTraits { using ret = Ret; using args = TypeList; using signature = ret(args, ...); @@ -31,15 +34,16 @@ struct FunctionSignatureImpl { }; template -auto GetFunctionSignature(R (*)(Args...)) -> FunctionSignatureImpl; +auto GetFunctionSignature(R (*)(Args...)) + -> FunctionSignatureTraits; template auto GetFunctionSignature(R (C::*)(Args...)) - -> FunctionSignatureImpl; + -> FunctionSignatureTraits; template auto GetFunctionSignature(R (C::*)(Args...) const) - -> FunctionSignatureImpl; + -> FunctionSignatureTraits; template auto GetFunctionSignature(Callable) diff --git a/src/aether-miscpp/types/small_function.h b/src/aether-miscpp/types/small_function.h index 63b6742..aa14b07 100644 --- a/src/aether-miscpp/types/small_function.h +++ b/src/aether-miscpp/types/small_function.h @@ -105,9 +105,6 @@ template && - std::is_nothrow_constructible_v && - std::is_nothrow_move_constructible_v && std::invocable && (std::is_void_v || std::is_convertible_v, TRet>); @@ -154,6 +151,11 @@ class SmallFunction { "SmallFunction target size exceeds storage size"); static_assert(alignof(Type) <= Alignment, "SmallFunction target alignment exceeds storage alignment"); + static_assert(std::constructible_from && + std::is_nothrow_constructible_v && + std::is_nothrow_move_constructible_v, + "TFunctor must meet specific construction constraints"); + new (storage_.data()) Type{std::forward(functor)}; } @@ -175,6 +177,12 @@ class SmallFunction { static_assert( alignof(Type) <= Alignment, "SmallFunction MethodPtr target alignment exceeds storage alignment"); + + static_assert(std::constructible_from && + std::is_nothrow_constructible_v && + std::is_nothrow_move_constructible_v, + "MPtr must meet specific construction constraints"); + new (storage_.data()) Type{std::forward(method_ptr)}; }