|
template<class ErasedPrototype , class Callable , size_t callable_storage_bytes = default_callable_storage_bytes, class... CallableConstructionArgs> |
constexpr function_ptr< ErasedPrototype, callable_storage_bytes > | emplace_function_ptr (CallableConstructionArgs &&... args) |
| Return a function_ptr<ErasedPrototype> by emplacing Callable(CallableConstructionArgs...) . If Callable is nothrow move constructible and sufficiently small, avoids dynamic memory allocation.
|
|
template<class ErasedPrototype , class Callable , class... CallableConstructionArgs> |
constexpr function_ptr< ErasedPrototype,(sizeof(Callable)+sizeof(void *)+sizeof(void *) - 1) &~(sizeof(void *) - 1)> | emplace_function_ptr_nothrow (CallableConstructionArgs &&... args) noexcept |
| Return a function_ptr<ErasedPrototype> by emplacing Callable(CallableConstructionArgs...) , without dynamically allocating memory. Note that the size of function ptr returned will be exactly the amount to store the callable, which may not be the default size of function_ptr<ErasedPrototype> .
|
|
template<class ErasedPrototype , class Callable , size_t callable_storage_bytes = default_callable_storage_bytes> |
constexpr function_ptr< ErasedPrototype, callable_storage_bytes > | make_function_ptr (Callable &&f) |
| Return a function_ptr<ErasedPrototype> by from an input Callable . If Callable is nothrow move constructible and sufficiently small, avoids dynamic memory allocation.
|
|
template<class ErasedPrototype , class Callable > |
constexpr auto | make_function_ptr_nothrow (Callable &&f) noexcept |
| Return a function_ptr<ErasedPrototype> by from an input Callable , without dynamically allocating memory. Note that the size of function ptr returned will be exactly the amount to store the callable, which may not be the default size of function_ptr<ErasedPrototype> .
|
|
The namespace for the function pointer type.
template<class ErasedPrototype , class Callable , class... CallableConstructionArgs>
constexpr function_ptr< ErasedPrototype,(sizeof(Callable)+sizeof(void *)+sizeof(void *) - 1) &~(sizeof(void *) - 1)> quickcpplib::_xxx::function_ptr::emplace_function_ptr_nothrow |
( |
CallableConstructionArgs &&... |
args | ) |
|
|
inlineconstexprnoexcept |
Return a function_ptr<ErasedPrototype>
by emplacing Callable(CallableConstructionArgs...)
, without dynamically allocating memory. Note that the size of function ptr returned will be exactly the amount to store the callable, which may not be the default size of function_ptr<ErasedPrototype>
.
302 {
303 using type =
function_ptr<ErasedPrototype, (
sizeof(Callable) +
sizeof(
void *) +
sizeof(
void *) - 1) & ~(
sizeof(
void *) - 1)>;
304 static_assert(type::template is_ssoable<Callable>, "The specified callable is not SSOable (probably lacks nothrow move construction)");
305 return type(typename type::template _emplace_t<Callable>(), static_cast<CallableConstructionArgs &&>(args)...);
306 }
template<class ErasedPrototype , class Callable >
constexpr auto quickcpplib::_xxx::function_ptr::make_function_ptr_nothrow |
( |
Callable && |
f | ) |
|
|
inlineconstexprnoexcept |
Return a function_ptr<ErasedPrototype>
by from an input Callable
, without dynamically allocating memory. Note that the size of function ptr returned will be exactly the amount to store the callable, which may not be the default size of function_ptr<ErasedPrototype>
.
324 {
325 return emplace_function_ptr_nothrow<ErasedPrototype, std::decay_t<Callable>>(static_cast<Callable &&>(f));
326 }