does anyone know how the default STL allocator class works, I need help implementing this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
template<typename T>
class allocator
{
public:
using size_type = size_t;
using difference_type = ptrdiff_t;
using pointer = T*;
using const_pointer = const T*;
using reference = T&;
using const_reference = const T&;
using value_type = T;
template<typename U>
struct rebind { using other = allocator<U>; };
allocator() noexcept;
allocator(const allocator&) noexcept;
template<typename U>
allocator(const allocator<U>&) noexcept;
~allocator();
pointer address(reference x) const noexcept;
const_pointer const_address(const_reference x) const noexcept;
pointer allocate(size_type n, allocator<void>::const_pointer hint = 0);
void deallocate(pointer p, size_type n);
size_type max_size() const noexcept;
template<typename U, typename... Args>
void construct(U* p, Args&&... args);
template<typename U>
void destroy(U* p);
};
|
help!
Last edited on
@Cubbi thanks I'll have a look at those.