1 #ifndef CPP3DS_LINEARALLOCATOR_HPP
2 #define CPP3DS_LINEARALLOCATOR_HPP
5 #include <bits/c++allocator.h>
6 #if __cplusplus >= 201103L
16 typedef size_t size_type;
17 typedef ptrdiff_t difference_type;
19 typedef const T* const_pointer;
21 typedef const T& const_reference;
28 #if __cplusplus >= 201103L
31 typedef std::true_type propagate_on_container_move_assignment;
37 : std::__allocator_base<T>(__a) { }
40 LinearAllocator(
const LinearAllocator<T1>&) throw() { }
42 ~LinearAllocator() throw() { }
47 allocate(size_type __n,
const void* = 0)
49 if (__n > this->max_size())
50 std::__throw_bad_alloc();
51 return static_cast<T*
>(linearAlloc(__n *
sizeof(T)));
56 deallocate(pointer __p, size_type)
64 return size_t(-1) /
sizeof(T);
72 #endif // CPP3DS_LINEARALLOCATOR_HPP
This allocator class is useful for when you want to use a STL container (e.g.