7 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
14 explicit A1(int id = 0) : id_(id) {}
18 int id() const {return id_;}
20 static bool copy_called;
21 static bool move_called;
22 static bool allocate_called;
23 static std::pair<T*, std::size_t> deallocate_called;
25 A1(const A1& a) : id_(a.id()) {copy_called = true;}
26 A1(A1&& a) : id_(a.id()) {move_called = true;}
29 A1(const A1<U>& a) : id_(a.id()) {copy_called = true;}
31 A1(A1<U>&& a) : id_(a.id()) {move_called = true;}
33 T* allocate(std::size_t n)
35 allocate_called = true;
39 void deallocate(T* p, std::size_t n)
41 deallocate_called = std::pair<T*, std::size_t>(p, n);
44 std::size_t max_size() const {return id_;}
47 template <class T> bool A1<T>::copy_called = false;
48 template <class T> bool A1<T>::move_called = false;
49 template <class T> bool A1<T>::allocate_called = false;
50 template <class T> std::pair<T*, std::size_t> A1<T>::deallocate_called;
52 template <class T, class U>
54 bool operator==(const A1<T>& x, const A1<U>& y)
56 return x.id() == y.id();
59 template <class T, class U>
61 bool operator!=(const A1<T>& x, const A1<U>& y)
71 explicit A2(int id = 0) : id_(id) {}
75 typedef unsigned size_type;
76 typedef int difference_type;
78 typedef std::true_type propagate_on_container_move_assignment;
80 int id() const {return id_;}
82 static bool copy_called;
83 static bool move_called;
84 static bool allocate_called;
86 A2(const A2& a) : id_(a.id()) {copy_called = true;}
87 A2(A2&& a) : id_(a.id()) {move_called = true;}
89 T* allocate(std::size_t n, const void* hint)
91 allocate_called = true;
96 template <class T> bool A2<T>::copy_called = false;
97 template <class T> bool A2<T>::move_called = false;
98 template <class T> bool A2<T>::allocate_called = false;
100 template <class T, class U>
102 bool operator==(const A2<T>& x, const A2<U>& y)
104 return x.id() == y.id();
107 template <class T, class U>
109 bool operator!=(const A2<T>& x, const A2<U>& y)
119 explicit A3(int id = 0) : id_(id) {}
121 typedef T value_type;
123 typedef std::true_type propagate_on_container_copy_assignment;
124 typedef std::true_type propagate_on_container_swap;
126 int id() const {return id_;}
128 static bool copy_called;
129 static bool move_called;
130 static bool constructed;
131 static bool destroy_called;
133 A3(const A3& a) : id_(a.id()) {copy_called = true;}
134 A3(A3&& a) : id_(a.id()) {move_called = true;}
136 template <class U, class ...Args>
137 void construct(U* p, Args&& ...args)
139 ::new (p) U(std::forward<Args>(args)...);
147 destroy_called = true;
150 A3 select_on_container_copy_construction() const {return A3(-1);}
153 template <class T> bool A3<T>::copy_called = false;
154 template <class T> bool A3<T>::move_called = false;
155 template <class T> bool A3<T>::constructed = false;
156 template <class T> bool A3<T>::destroy_called = false;
158 template <class T, class U>
160 bool operator==(const A3<T>& x, const A3<U>& y)
162 return x.id() == y.id();
165 template <class T, class U>
167 bool operator!=(const A3<T>& x, const A3<U>& y)
172 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
174 #endif // ALLOCATORS_H