GCS
0.2.3
|
#include <gu_reserved_container.hpp>
Data Structures | |
struct | rebind |
Public Member Functions | |
T * | address (T &t) const |
const T * | address (const T &t) const |
size_type | max_size () const |
void | construct (T *const p, const T &t) const |
void | destroy (T *const p) const |
bool | operator== (const ReservedAllocator &other) const |
bool | operator!= (const ReservedAllocator &other) const |
ReservedAllocator (Buffer &buf, size_type n=0) | |
ReservedAllocator (const ReservedAllocator &other) | |
template<typename U , size_type c, bool d> | |
ReservedAllocator (const ReservedAllocator< U, c, d > &) | |
T * | allocate (size_type const n, void *hint=NULL) |
void | deallocate (T *const p, size_type const n) |
size_type | used () const |
ReservedAllocator is an allocator for STL containers that can use a prealocated buffer (supplied at construction time) for initial container storage allocation. If the number of elements exceeds buffer capacity, it overflows to heap.
Unlike the Chromium code, this does not derive from std::allocator, but implements the whole thing.
NOTE1: container must support reserve() method.
NOTE2: it won't work with containers that require allocator to have default constructor, like std::basic_string