32 struct function_traits;
35 template<
typename R,
typename... Args>
36 struct function_traits<R(*)(Args...)> {
39 static constexpr size_t arity =
sizeof...(Args);
40 static constexpr bool is_noexcept =
false;
44 template<
typename R,
typename... Args>
48 static constexpr size_t arity =
sizeof...(Args);
49 static constexpr bool is_noexcept =
true;
53 template<
typename C,
typename R,
typename... Args>
58 static constexpr size_t arity =
sizeof...(Args);
59 static constexpr bool is_noexcept =
false;
63 template<
typename C,
typename R,
typename... Args>
68 static constexpr size_t arity =
sizeof...(Args);
69 static constexpr bool is_noexcept =
false;
91 template<
size_t ThreadCount>
93 static_assert(ThreadCount > 0,
"Thread count must be positive");
94 static_assert(ThreadCount <= 1024,
"Thread count is unreasonably high");
95 static constexpr bool value =
true;
101#ifdef USE_STD_CONCEPTS
105 return std::forward<T>(t);
110 return std::forward<T>(t);
119#ifdef USE_STD_CONCEPTS
122 template<
typename F,
typename = std::enable_if_t<Callable<F>>>
127 static_assert(
sizeof(std::decay_t<F>) <=
sizeof(
storage_),
128 "Callable is too large for inline storage");
129 new (&
storage_) std::decay_t<F>(std::forward<F>(f));
149 other.vtable_ =
nullptr;
153 if (
this != &other) {
159 other.vtable_ =
nullptr;
172 [](
void* ptr) { (*
static_cast<F*
>(ptr))(); },
173 [](
void* ptr) {
static_cast<F*
>(ptr)->~F(); }
186 std::copy_n(str, N,
value);
198 return "unknown_type";
204 template<
typename T,
typename =
void>
Type eraser for heterogeneous callable storage.
callable_eraser & operator=(callable_eraser &&other) noexcept
callable_eraser(const callable_eraser &)=delete
static constexpr vtable_t vtable_for
callable_eraser & operator=(const callable_eraser &)=delete
callable_eraser(callable_eraser &&other) noexcept
typename function_traits< F >::return_type function_return_t
Helper to get function traits.
typename function_traits< F >::argument_types function_args_t
constexpr size_t function_arity_v
constexpr bool has_get_method_v
constexpr auto forward_if_callable(T &&t) -> std::enable_if_t< Callable< T >, T && >
Template helper for perfect forwarding with type constraints.
constexpr auto get_type_name()
Template for generating descriptive error messages.
Compile-time string for template error messages.
constexpr compile_string(const char(&str)[N])
std::tuple< Args... > argument_types
std::tuple< Args... > argument_types
std::tuple< Args... > argument_types
std::tuple< Args... > argument_types
Type trait for function signature analysis.
SFINAE helper to detect if a type has a specific member.
Compile-time validation for thread pool configuration.
static constexpr bool value
C++20 Concepts for thread_system.