An allocator which delegates allocations between 2 different allocators based on a size threshold.
More...
|
| | segragator ()=default |
| |
| template<typename Primary , typename = std::enable_if_t<std::is_constructible_v<P, Primary>>> |
| | segragator (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>>> |
| | segragator (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...>>> |
| | segragator (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...>>> |
| | segragator (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...
|
| |
| | segragator (const segragator &)=default |
| |
| | segragator (segragator &&)=default |
| |
| segragator & | operator= (const segragator &)=default |
| |
| segragator & | operator= (segragator &&)=default |
| |
| bool | operator== (const segragator &rhs) const noexcept(detail::has_nothrow_equal_v< P > &&detail::has_nothrow_equal_v< F >) |
| |
| bool | operator!= (const segragator &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<size_t Threshold, typename P, typename F>
class ktl::segragator< Threshold, P, F >
An allocator which delegates allocations between 2 different allocators based on a size threshold.
- Note
- The primary allocator must have an owns(*ptr) method if it also has a construct() method.
- Template Parameters
-
| P | The primary allocator, which is used when size is less than or equal to Threshold |
| F | The fallback allocator, which is used when size is bigger than Threshold |
template<size_t Threshold, typename P , typename F >
template<typename Primary , typename = std::enable_if_t<std::is_constructible_v<P, Primary>>>
Constructor for forwarding a single argument to the primary allocator.
template<size_t Threshold, 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<size_t Threshold, typename P , typename F >
template<typename... Args, typename = std::enable_if_t< std::is_constructible_v<P, Args...>>>
Constructor for forwarding a tuple of arguments to the primary allocator.
template<size_t Threshold, 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...>>>
Constructor for forwarding a tuple of arguments to the primary and fallback allocators.