Banuba SDK
Loading...
Searching...
No Matches
bnb::static_pool_allocator_fallback< T, MAX_ELEMENTS, Alloc_fallback > Class Template Reference
Inheritance diagram for bnb::static_pool_allocator_fallback< T, MAX_ELEMENTS, Alloc_fallback >:
bnb::static_pool_allocator< T, MAX_ELEMENTS >

Public Member Functions

T * allocate (std::size_t n)
 
void deallocate (T *p, std::size_t n)
 
- Public Member Functions inherited from bnb::static_pool_allocator< T, MAX_ELEMENTS >
template<class U >
constexpr static_pool_allocator (const static_pool_allocator< U, MAX_ELEMENTS > &u) noexcept
 
T * allocate (std::size_t n)
 
T * allocate (std::size_t n, const std::nothrow_t &) noexcept
 
void deallocate (T *p, std::size_t n)
 
bool is_mine (T *p)
 

Additional Inherited Members

- Public Types inherited from bnb::static_pool_allocator< T, MAX_ELEMENTS >
using value_type = T
 

Detailed Description

template<typename T, size_t MAX_ELEMENTS, template< typename > class Alloc_fallback = std::allocator>
class bnb::static_pool_allocator_fallback< T, MAX_ELEMENTS, Alloc_fallback >

Definition at line 67 of file static_pool_allocator.hpp.

Member Function Documentation

◆ allocate()

template<typename T , size_t MAX_ELEMENTS, template< typename > class Alloc_fallback = std::allocator>
T * bnb::static_pool_allocator_fallback< T, MAX_ELEMENTS, Alloc_fallback >::allocate ( std::size_t n)
inline

Definition at line 72 of file static_pool_allocator.hpp.

73 {
74 if (T* p = static_pool_allocator<T, MAX_ELEMENTS>::allocate(n, std::nothrow); p != nullptr) {
75 return p;
76 } else {
77 return alloc.allocate(n);
78 }
79 }

◆ deallocate()

template<typename T , size_t MAX_ELEMENTS, template< typename > class Alloc_fallback = std::allocator>
void bnb::static_pool_allocator_fallback< T, MAX_ELEMENTS, Alloc_fallback >::deallocate ( T * p,
std::size_t n )
inline

Definition at line 80 of file static_pool_allocator.hpp.

81 {
82 if (static_pool_allocator<T, MAX_ELEMENTS>::is_mine(p)) {
83 static_pool_allocator<T, MAX_ELEMENTS>::deallocate(p, n);
84 } else {
85 alloc.deallocate(p, n);
86 }
87 }

The documentation for this class was generated from the following file: