5 #ifndef _STL_ALLOCATOR_H 6 #define _STL_ALLOCATOR_H 11 #include "xallocator.h" 18 typedef void* pointer;
19 typedef const void* const_pointer;
21 typedef void value_type;
37 typedef size_t size_type;
38 typedef ptrdiff_t difference_type;
40 typedef const T* const_pointer;
42 typedef const T& const_reference;
62 pointer
address(reference x)
const {
return &x; }
66 const_pointer
address(const_reference x)
const {
return &x; }
70 size_type
max_size()
const throw() {
return size_t(-1) /
sizeof(value_type); }
78 return static_cast<pointer
>(xmalloc(n *
sizeof(T)));
91 new (
static_cast<void*
>(p)) T(val);
97 void construct(pointer p) {
new (
static_cast<void*
>(p)) T(); }
105 template <
typename T,
typename U>
110 template <
typename T,
typename U>
119 #define STD_ALLOC_CDECL __cdecl 121 #define STD_ALLOC_CDECL 125 template <
class _Tp1,
class _Tp2>
131 template <
class _Tp1,
class _Tp2>
Definition: stl_allocator.h:56
stl_allocator(const stl_allocator< U > &)
Copy constructor.
Definition: stl_allocator.h:53
void deallocate(pointer p, size_type n)
Definition: stl_allocator.h:84
stl_allocator is STL-compatible allocator used to provide fixed block allocations.
Definition: stl_allocator.h:14
pointer allocate(size_type n, stl_allocator< void >::const_pointer hint=nullptr)
Definition: stl_allocator.h:76
void construct(pointer p, const T &val)
Definition: stl_allocator.h:90
Definition: stl_allocator.h:124
size_type max_size() const
Definition: stl_allocator.h:70
~stl_allocator()
Destructor.
Definition: stl_allocator.h:49
pointer address(reference x) const
Definition: stl_allocator.h:62
const_pointer address(const_reference x) const
Definition: stl_allocator.h:66
stl_allocator()
Constructor.
Definition: stl_allocator.h:46
void destroy(pointer p)
Definition: stl_allocator.h:102
void construct(pointer p)
Definition: stl_allocator.h:97