Public Member Functions | |
capped_allocator (detail::value_or_reference< Counter > count, const Alloc &alloc={}, bool subtract_on_deallocate=true) | |
Constructs capped allocator adapter. | |
template<typename C = Counter, typename boost::enable_if< std::uses_allocator< C, Alloc > >::type * = nullptr> | |
capped_allocator (typename C::value_type max_value, const Alloc &alloc={}, bool subtract_on_deallocate=true) | |
Constructs capped allocator adapter. | |
template<typename OtherAlloc, typename boost::enable_if< std::is_convertible< OtherAlloc, Alloc > >::type * = nullptr> | |
capped_allocator (const capped_allocator< OtherAlloc, Counter > &other) | |
Converts from a compatible allocator. | |
STL-compatible allocator adapter that fails allocations by throwing std::bad_alloc
if the maximum number of bytes to be allocated is exceeded
Alloc | underlying allocator type. |
Counter | underlying counter type. |
|
explicit |
Constructs capped allocator adapter.
count | counter value to use (see remarks for more details). |
alloc | the base allocator instance. |
subtract_on_deallocate | flag to indicate if counter must be adjusted for deallocation. |
Counter
is not a reference type, then count
can be one ofCounter
in which case it will be passed by-value,Counter
in which case only a reference will be held,Counter
which will be used to construct one.When Counter
is a reference type, then only a reference to an existing instance can be passed.
|
explicit |
Constructs capped allocator adapter.
max_value | max counter value. |
alloc | the base allocator instance. |
subtract_on_deallocate | flag to indicate if counter must be adjusted for deallocation. |
Counter
is allocator-aware. bond::ext::capped_allocator< Alloc, Counter >::capped_allocator | ( | const capped_allocator< OtherAlloc, Counter > & | other | ) |
Converts from a compatible allocator.