Template Class stl_allocator
Defined in File stl_allocator.h
Nested Relationships
Nested Types
Template Parameter Order
typename T
Class Documentation
-
template<typename T>
class stl_allocator stl_allocator is STL-compatible allocator used to provide fixed block allocations.
The default allocator for the STL is the global heap. The stl_allocator is custom allocator where xmalloc/xfree is used to obtain and release memory.
Public Functions
-
inline stl_allocator()
Constructor.
-
inline ~stl_allocator()
Destructor.
-
template<class U>
inline stl_allocator(const stl_allocator<U>&) Copy constructor.
-
inline const_pointer address(const_reference x) const
Return reference address.
- Returns
Const pointer to T memory.
-
inline size_type max_size() const
Get the maximum size of memory.
- Returns
Max memory size in bytes.
-
inline pointer allocate(size_type n, stl_allocator<void>::const_pointer hint = nullptr)
Allocates a fixed block of memory
- Parameters
n – [in] - size of memory to allocate in bytes
hint – [in]
- Returns
Pointer to the allocated memory.
-
inline void deallocate(pointer p, size_type n)
Deallocate a previously allocated fixed memory block.
- Parameters
p – [in] - pointer to the memory block
n – [in] - size of memory in bytes
-
inline void construct(pointer p, const T &val)
Constructs a new instance.
- Parameters
p – [in] - pointer to the memory where the instance is constructed using placement new.
val – [in] - instance of object to copy construct.
-
template<class U>
struct rebind Public Types
-
typedef stl_allocator<U> other
-
typedef stl_allocator<U> other
-
inline stl_allocator()