An allocator which delegates allocations between 2 different allocators. It first attempts to allocate with the primary allocator, but upon failure will use the fallback allocator.
More...
|
| fallback ()=default |
|
template<typename Primary , typename = std::enable_if_t<std::is_constructible_v<P, Primary>>> |
| fallback (Primary &&primary) noexcept(std::is_nothrow_constructible_v< P, Primary > &&std::is_nothrow_default_constructible_v< F >) |
| Constructor for forwarding a single argument to the primary allocator. More...
|
|
template<typename Primary , typename Fallback , typename = std::enable_if_t< std::is_constructible_v<P, Primary> && std::is_constructible_v<F, Fallback>>> |
| fallback (Primary &&primary, Fallback &&fallback) noexcept(std::is_nothrow_constructible_v< P, Primary > &&std::is_nothrow_constructible_v< F, Fallback >) |
| Constructor for forwarding a single argument to the primary and fallback allocators. More...
|
|
template<typename... Args, typename = std::enable_if_t< std::is_constructible_v<P, Args...>>> |
| fallback (std::tuple< Args... > &&primary) noexcept(std::is_nothrow_constructible_v< P, Args... > &&std::is_nothrow_default_constructible_v< F >) |
| Constructor for forwarding a tuple of arguments to the primary allocator. More...
|
|
template<typename... ArgsP, typename... ArgsF, typename = std::enable_if_t< std::is_constructible_v<P, ArgsP...>&& std::is_constructible_v<F, ArgsF...>>> |
| fallback (std::tuple< ArgsP... > &&primary, std::tuple< ArgsF... > &&fallback) noexcept(std::is_nothrow_constructible_v< P, ArgsP... > &&std::is_nothrow_constructible_v< F, ArgsF... >) |
| Constructor for forwarding a tuple of arguments to the primary and fallback allocators. More...
|
|
| fallback (const fallback &)=default |
|
| fallback (fallback &&)=default |
|
fallback & | operator= (const fallback &)=default |
|
fallback & | operator= (fallback &&)=default |
|
bool | operator== (const fallback &rhs) const noexcept(detail::has_nothrow_equal_v< P > &&detail::has_nothrow_equal_v< F >) |
|
bool | operator!= (const fallback &rhs) const noexcept(detail::has_nothrow_not_equal_v< P > &&detail::has_nothrow_not_equal_v< F >) |
|
void * | allocate (size_t n) noexcept(detail::has_nothrow_allocate_v< P > &&detail::has_nothrow_allocate_v< F >) |
|
void | deallocate (void *p, size_t n) noexcept(detail::has_nothrow_deallocate_v< P > &&detail::has_nothrow_deallocate_v< F >) |
|
template<typename T , typename... Args> |
std::enable_if< detail::has_construct_v< P, T *, Args... >||detail::has_construct_v< F, T *, Args... >, void >::type | construct (T *p, Args &&... args) noexcept((!detail::has_construct_v< P, T *, Args... >||detail::has_nothrow_construct_v< P, T *, Args... >) &&(!detail::has_construct_v< F, T *, Args... >||detail::has_nothrow_construct_v< F, T *, Args... >) &&std::is_nothrow_constructible_v< T, Args... >) |
|
template<typename T > |
std::enable_if< detail::has_destroy_v< P, T * >||detail::has_destroy_v< F, T * >, void >::type | destroy (T *p) noexcept((!detail::has_destroy_v< P, T * >||detail::has_nothrow_destroy_v< P, T * >) &&(!detail::has_destroy_v< F, T * >||detail::has_nothrow_destroy_v< F, T * >) &&std::is_nothrow_destructible_v< T >) |
|
template<typename Primary = P, typename Fallback = F> |
std::enable_if< detail::has_max_size_v< Primary > &&detail::has_max_size_v< Fallback >, size_type >::type | max_size () const noexcept(detail::has_nothrow_max_size_v< Primary > &&detail::has_nothrow_max_size_v< Fallback >) |
|
template<typename Primary = P, typename Fallback = F> |
std::enable_if< detail::has_owns_v< Primary > &&detail::has_owns_v< Fallback >, bool >::type | owns (void *p) const noexcept(detail::has_nothrow_owns_v< Primary > &&detail::has_nothrow_owns_v< Fallback >) |
|
template<typename P, typename F>
class ktl::fallback< P, F >
An allocator which delegates allocations between 2 different allocators. It first attempts to allocate with the primary allocator, but upon failure will use the fallback allocator.
- Note
- The primary allocator must have an owns(*ptr) method.
- Template Parameters
-
P | The primary allocator |
F | The fallback allocator, which is used when the primary allocator fails |
template<typename P , typename F >
template<typename Primary , typename Fallback , typename = std::enable_if_t< std::is_constructible_v<P, Primary> && std::is_constructible_v<F, Fallback>>>
Constructor for forwarding a single argument to the primary and fallback allocators.
template<typename P , typename F >
template<typename... ArgsP, typename... ArgsF, typename = std::enable_if_t< std::is_constructible_v<P, ArgsP...>&& std::is_constructible_v<F, ArgsF...>>>
ktl::fallback< P, F >::fallback |
( |
std::tuple< ArgsP... > && |
primary, |
|
|
std::tuple< ArgsF... > && |
fallback |
|
) |
| |
|
inlineexplicitnoexcept |
Constructor for forwarding a tuple of arguments to the primary and fallback allocators.