3 * - By John Hodge (thePowersGang)
8 #ifndef _LIBCXX_ALLOCATOR_
9 #define _LIBCXX_ALLOCATOR_
11 #include "_libcxx_helpers.h"
19 template <class T> class allocator;
30 typedef const T* const_pointer;
31 typedef const T& const_reference;
32 typedef size_t size_type;
33 typedef ptrdiff_t difference_type;
38 typedef allocator<Type> other;
41 allocator_real() throw() {
43 allocator_real(const allocator_real& alloc __attribute__((unused))) throw() {
46 allocator_real(const allocator_real<U>& alloc) throw() {
48 ~allocator_real() throw() {
51 pointer address(reference x) const {
54 const_pointer address(const_reference x) const {
57 pointer allocate(size_type n, const void* hint=0) {
59 return static_cast<pointer>( ::operator new (n * sizeof(value_type)) );
61 void deallocate(pointer p, size_type n) {
65 size_type max_size() {
66 return ((size_type)-1) / sizeof(value_type);
68 void construct( pointer p, const_reference val ) {
69 new ((void*)p) value_type (val);
73 template<class U, class... Args>
74 void construct( U* p, Args&&... args ) {
75 ::new ((void*)p) U (::std::forward<Args>(args)...);
78 void destroy(pointer p) {
84 class allocator_noconstruct:
85 public ::std::_bits::allocator_real<T>
88 void construct( typename allocator_real<T>::pointer p, typename allocator_real<T>::const_reference val ) {
91 void destroy(typename allocator_real<T>::pointer p) {
99 public _bits::allocator_real<T>
105 class allocator<unsigned char>:
106 public _bits::allocator_noconstruct<unsigned char>
110 class allocator<unsigned long>:
111 public _bits::allocator_noconstruct<unsigned long>