libbmb
Modern implementation of STL
Loading...
Searching...
No Matches
bmb::PrimitiveAllocator Class Reference

Allocator-proxy for new/delete operators. More...

#include <allocator.h>

Public Member Functions

template<typename T >
Tallocate (size_t n)
 Allocates raw memory for n objects of type T.
 
template<typename T >
void deallocate (T *ptr, size_t) noexcept
 Deallocates memory under ptr.
 
bool operator== (const PrimitiveAllocator &) const
 

Detailed Description

Allocator-proxy for new/delete operators.

This allocator doesn't manage any memory but simply calls new/delete

Member Function Documentation

◆ allocate()

template<typename T >
T * bmb::PrimitiveAllocator::allocate ( size_t  n)
inline

Allocates raw memory for n objects of type T.

Parameters
nNumber of objects to allocate
Returns
Pointer to the allocated memory
Exceptions
Samespecification as for new operator

◆ deallocate()

template<typename T >
void bmb::PrimitiveAllocator::deallocate ( T ptr,
size_t   
)
inlinenoexcept

Deallocates memory under ptr.

Takes dummy argument which semantically means "how many objects were allocated at that memory". This is done for unifying interface with any allocator that might need this number.

Parameters
ptrPointer to the previously allocated memory
_Dummy argument
Exceptions
noexcept

◆ operator==()

bool bmb::PrimitiveAllocator::operator== ( const PrimitiveAllocator ) const
inline

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