Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===-------------------------- scoped_allocator --------------------------===// |
| 3 | // |
| 4 | // The LLVM Compiler Infrastructure |
| 5 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 6 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 7 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | #ifndef _LIBCPP_SCOPED_ALLOCATOR |
| 12 | #define _LIBCPP_SCOPED_ALLOCATOR |
| 13 | |
| 14 | /* |
| 15 | scoped_allocator synopsis |
| 16 | |
| 17 | namespace std |
| 18 | { |
| 19 | |
| 20 | template <class OuterAlloc, class... InnerAllocs> |
| 21 | class scoped_allocator_adaptor : public OuterAlloc |
| 22 | { |
| 23 | typedef allocator_traits<OuterAlloc> OuterTraits; // exposition only |
Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 24 | scoped_allocator_adaptor<InnerAllocs...> inner; // exposition only |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 25 | public: |
| 26 | |
| 27 | typedef OuterAlloc outer_allocator_type; |
| 28 | typedef see below inner_allocator_type; |
| 29 | |
| 30 | typedef typename OuterTraits::value_type value_type; |
| 31 | typedef typename OuterTraits::size_type size_type; |
| 32 | typedef typename OuterTraits::difference_type difference_type; |
| 33 | typedef typename OuterTraits::pointer pointer; |
| 34 | typedef typename OuterTraits::const_pointer const_pointer; |
| 35 | typedef typename OuterTraits::void_pointer void_pointer; |
| 36 | typedef typename OuterTraits::const_void_pointer const_void_pointer; |
| 37 | |
| 38 | typedef see below propagate_on_container_copy_assignment; |
| 39 | typedef see below propagate_on_container_move_assignment; |
| 40 | typedef see below propagate_on_container_swap; |
Marshall Clow | f0324bc | 2015-06-02 16:34:03 +0000 | [diff] [blame^] | 41 | typedef see below is_always_equal; |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 42 | |
| 43 | template <class Tp> |
| 44 | struct rebind |
| 45 | { |
| 46 | typedef scoped_allocator_adaptor< |
| 47 | OuterTraits::template rebind_alloc<Tp>, InnerAllocs...> other; |
| 48 | }; |
| 49 | |
| 50 | scoped_allocator_adaptor(); |
| 51 | template <class OuterA2> |
| 52 | scoped_allocator_adaptor(OuterA2&& outerAlloc, |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 53 | const InnerAllocs&... innerAllocs) noexcept; |
| 54 | scoped_allocator_adaptor(const scoped_allocator_adaptor& other) noexcept; |
| 55 | scoped_allocator_adaptor(scoped_allocator_adaptor&& other) noexcept; |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 56 | template <class OuterA2> |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 57 | scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other) noexcept; |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 58 | template <class OuterA2> |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 59 | scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other) noexcept; |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 60 | |
| 61 | ~scoped_allocator_adaptor(); |
| 62 | |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 63 | inner_allocator_type& inner_allocator() noexcept; |
| 64 | const inner_allocator_type& inner_allocator() const noexcept; |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 65 | |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 66 | outer_allocator_type& outer_allocator() noexcept; |
| 67 | const outer_allocator_type& outer_allocator() const noexcept; |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 68 | |
| 69 | pointer allocate(size_type n); |
| 70 | pointer allocate(size_type n, const_void_pointer hint); |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 71 | void deallocate(pointer p, size_type n) noexcept; |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 72 | |
| 73 | size_type max_size() const; |
| 74 | template <class T, class... Args> void construct(T* p, Args&& args); |
| 75 | template <class T1, class T2, class... Args1, class... Args2> |
| 76 | void construct(pair<T1, T2>* p, piecewise_construct t, tuple<Args1...> x, |
| 77 | tuple<Args2...> y); |
| 78 | template <class T1, class T2> |
| 79 | void construct(pair<T1, T2>* p); |
| 80 | template <class T1, class T2, class U, class V> |
| 81 | void construct(pair<T1, T2>* p, U&& x, V&& y); |
| 82 | template <class T1, class T2, class U, class V> |
| 83 | void construct(pair<T1, T2>* p, const pair<U, V>& x); |
| 84 | template <class T1, class T2, class U, class V> |
| 85 | void construct(pair<T1, T2>* p, pair<U, V>&& x); |
| 86 | template <class T> void destroy(T* p); |
| 87 | |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 88 | template <class T> void destroy(T* p) noexcept; |
| 89 | |
| 90 | scoped_allocator_adaptor select_on_container_copy_construction() const noexcept; |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 91 | }; |
| 92 | |
| 93 | template <class OuterA1, class OuterA2, class... InnerAllocs> |
| 94 | bool |
| 95 | operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a, |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 96 | const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept; |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 97 | |
| 98 | template <class OuterA1, class OuterA2, class... InnerAllocs> |
| 99 | bool |
| 100 | operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a, |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 101 | const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept; |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 102 | |
| 103 | } // std |
| 104 | |
| 105 | */ |
| 106 | |
| 107 | #include <__config> |
| 108 | #include <memory> |
| 109 | |
Howard Hinnant | 08e1747 | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 110 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 111 | #pragma GCC system_header |
Howard Hinnant | 08e1747 | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 112 | #endif |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 113 | |
| 114 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 115 | |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 116 | #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE) |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 117 | |
| 118 | // scoped_allocator_adaptor |
| 119 | |
| 120 | template <class ..._Allocs> |
| 121 | class scoped_allocator_adaptor; |
| 122 | |
| 123 | template <class ..._Allocs> struct __get_poc_copy_assignment; |
| 124 | |
| 125 | template <class _A0> |
| 126 | struct __get_poc_copy_assignment<_A0> |
| 127 | { |
| 128 | static const bool value = allocator_traits<_A0>:: |
| 129 | propagate_on_container_copy_assignment::value; |
| 130 | }; |
| 131 | |
| 132 | template <class _A0, class ..._Allocs> |
| 133 | struct __get_poc_copy_assignment<_A0, _Allocs...> |
| 134 | { |
| 135 | static const bool value = |
| 136 | allocator_traits<_A0>::propagate_on_container_copy_assignment::value || |
| 137 | __get_poc_copy_assignment<_Allocs...>::value; |
| 138 | }; |
| 139 | |
| 140 | template <class ..._Allocs> struct __get_poc_move_assignment; |
| 141 | |
| 142 | template <class _A0> |
| 143 | struct __get_poc_move_assignment<_A0> |
| 144 | { |
| 145 | static const bool value = allocator_traits<_A0>:: |
| 146 | propagate_on_container_move_assignment::value; |
| 147 | }; |
| 148 | |
| 149 | template <class _A0, class ..._Allocs> |
| 150 | struct __get_poc_move_assignment<_A0, _Allocs...> |
| 151 | { |
| 152 | static const bool value = |
| 153 | allocator_traits<_A0>::propagate_on_container_move_assignment::value || |
| 154 | __get_poc_move_assignment<_Allocs...>::value; |
| 155 | }; |
| 156 | |
| 157 | template <class ..._Allocs> struct __get_poc_swap; |
| 158 | |
| 159 | template <class _A0> |
| 160 | struct __get_poc_swap<_A0> |
| 161 | { |
| 162 | static const bool value = allocator_traits<_A0>:: |
| 163 | propagate_on_container_swap::value; |
| 164 | }; |
| 165 | |
| 166 | template <class _A0, class ..._Allocs> |
| 167 | struct __get_poc_swap<_A0, _Allocs...> |
| 168 | { |
| 169 | static const bool value = |
| 170 | allocator_traits<_A0>::propagate_on_container_swap::value || |
| 171 | __get_poc_swap<_Allocs...>::value; |
| 172 | }; |
| 173 | |
Marshall Clow | f0324bc | 2015-06-02 16:34:03 +0000 | [diff] [blame^] | 174 | template <class _A0, class ..._Allocs> |
| 175 | struct __get_poc_always_equal<_A0, _Allocs...> |
| 176 | { |
| 177 | static const bool value = |
| 178 | allocator_traits<_A0>::is_always_equal::value || |
| 179 | __get_poc_always_equal<_Allocs...>::value; |
| 180 | }; |
| 181 | |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 182 | template <class ..._Allocs> |
| 183 | class __scoped_allocator_storage; |
| 184 | |
| 185 | template <class _OuterAlloc, class... _InnerAllocs> |
| 186 | class __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> |
| 187 | : public _OuterAlloc |
| 188 | { |
| 189 | typedef _OuterAlloc outer_allocator_type; |
| 190 | protected: |
| 191 | typedef scoped_allocator_adaptor<_InnerAllocs...> inner_allocator_type; |
| 192 | |
| 193 | private: |
| 194 | inner_allocator_type __inner_; |
| 195 | |
| 196 | protected: |
Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 197 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 198 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 199 | __scoped_allocator_storage() _NOEXCEPT {} |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 200 | |
| 201 | template <class _OuterA2, |
| 202 | class = typename enable_if< |
| 203 | is_constructible<outer_allocator_type, _OuterA2>::value |
| 204 | >::type> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 205 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 206 | __scoped_allocator_storage(_OuterA2&& __outerAlloc, |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 207 | const _InnerAllocs& ...__innerAllocs) _NOEXCEPT |
Howard Hinnant | 0949eed | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 208 | : outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)), |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 209 | __inner_(__innerAllocs...) {} |
| 210 | |
| 211 | template <class _OuterA2, |
| 212 | class = typename enable_if< |
| 213 | is_constructible<outer_allocator_type, const _OuterA2&>::value |
| 214 | >::type> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 215 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 216 | __scoped_allocator_storage( |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 217 | const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 218 | : outer_allocator_type(__other.outer_allocator()), |
| 219 | __inner_(__other.inner_allocator()) {} |
| 220 | |
| 221 | template <class _OuterA2, |
| 222 | class = typename enable_if< |
| 223 | is_constructible<outer_allocator_type, _OuterA2>::value |
| 224 | >::type> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 225 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 226 | __scoped_allocator_storage( |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 227 | __scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT |
Howard Hinnant | 0949eed | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 228 | : outer_allocator_type(_VSTD::move(__other.outer_allocator())), |
| 229 | __inner_(_VSTD::move(__other.inner_allocator())) {} |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 230 | |
| 231 | template <class _OuterA2, |
| 232 | class = typename enable_if< |
| 233 | is_constructible<outer_allocator_type, _OuterA2>::value |
| 234 | >::type> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 235 | _LIBCPP_INLINE_VISIBILITY |
| 236 | __scoped_allocator_storage(_OuterA2&& __o, |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 237 | const inner_allocator_type& __i) _NOEXCEPT |
Howard Hinnant | 0949eed | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 238 | : outer_allocator_type(_VSTD::forward<_OuterA2>(__o)), |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 239 | __inner_(__i) |
| 240 | { |
| 241 | } |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 242 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 243 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 244 | inner_allocator_type& inner_allocator() _NOEXCEPT {return __inner_;} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 245 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 246 | const inner_allocator_type& inner_allocator() const _NOEXCEPT {return __inner_;} |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 247 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 248 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 249 | outer_allocator_type& outer_allocator() _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 250 | {return static_cast<outer_allocator_type&>(*this);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 251 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 252 | const outer_allocator_type& outer_allocator() const _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 253 | {return static_cast<const outer_allocator_type&>(*this);} |
| 254 | |
| 255 | scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 256 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 257 | select_on_container_copy_construction() const _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 258 | { |
| 259 | return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...> |
| 260 | ( |
| 261 | allocator_traits<outer_allocator_type>:: |
| 262 | select_on_container_copy_construction(outer_allocator()), |
| 263 | allocator_traits<inner_allocator_type>:: |
| 264 | select_on_container_copy_construction(inner_allocator()) |
| 265 | ); |
| 266 | } |
| 267 | |
| 268 | template <class...> friend class __scoped_allocator_storage; |
| 269 | }; |
| 270 | |
| 271 | template <class _OuterAlloc> |
| 272 | class __scoped_allocator_storage<_OuterAlloc> |
| 273 | : public _OuterAlloc |
| 274 | { |
| 275 | typedef _OuterAlloc outer_allocator_type; |
| 276 | protected: |
| 277 | typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type; |
| 278 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 279 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 280 | __scoped_allocator_storage() _NOEXCEPT {} |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 281 | |
| 282 | template <class _OuterA2, |
| 283 | class = typename enable_if< |
| 284 | is_constructible<outer_allocator_type, _OuterA2>::value |
| 285 | >::type> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 286 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 287 | __scoped_allocator_storage(_OuterA2&& __outerAlloc) _NOEXCEPT |
Howard Hinnant | 0949eed | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 288 | : outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)) {} |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 289 | |
| 290 | template <class _OuterA2, |
| 291 | class = typename enable_if< |
| 292 | is_constructible<outer_allocator_type, const _OuterA2&>::value |
| 293 | >::type> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 294 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 295 | __scoped_allocator_storage( |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 296 | const __scoped_allocator_storage<_OuterA2>& __other) _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 297 | : outer_allocator_type(__other.outer_allocator()) {} |
| 298 | |
| 299 | template <class _OuterA2, |
| 300 | class = typename enable_if< |
| 301 | is_constructible<outer_allocator_type, _OuterA2>::value |
| 302 | >::type> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 303 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 304 | __scoped_allocator_storage( |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 305 | __scoped_allocator_storage<_OuterA2>&& __other) _NOEXCEPT |
Howard Hinnant | 0949eed | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 306 | : outer_allocator_type(_VSTD::move(__other.outer_allocator())) {} |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 307 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 308 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 309 | inner_allocator_type& inner_allocator() _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 310 | {return static_cast<inner_allocator_type&>(*this);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 311 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 312 | const inner_allocator_type& inner_allocator() const _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 313 | {return static_cast<const inner_allocator_type&>(*this);} |
| 314 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 315 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 316 | outer_allocator_type& outer_allocator() _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 317 | {return static_cast<outer_allocator_type&>(*this);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 318 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 319 | const outer_allocator_type& outer_allocator() const _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 320 | {return static_cast<const outer_allocator_type&>(*this);} |
| 321 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 322 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 323 | scoped_allocator_adaptor<outer_allocator_type> |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 324 | select_on_container_copy_construction() const _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 325 | {return scoped_allocator_adaptor<outer_allocator_type>( |
| 326 | allocator_traits<outer_allocator_type>:: |
| 327 | select_on_container_copy_construction(outer_allocator()) |
| 328 | );} |
| 329 | |
| 330 | __scoped_allocator_storage(const outer_allocator_type& __o, |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 331 | const inner_allocator_type& __i) _NOEXCEPT; |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 332 | |
| 333 | template <class...> friend class __scoped_allocator_storage; |
| 334 | }; |
| 335 | |
| 336 | // __outermost |
| 337 | |
| 338 | template <class _Alloc> |
| 339 | decltype(declval<_Alloc>().outer_allocator(), true_type()) |
| 340 | __has_outer_allocator_test(_Alloc&& __a); |
| 341 | |
| 342 | template <class _Alloc> |
| 343 | false_type |
| 344 | __has_outer_allocator_test(const volatile _Alloc& __a); |
| 345 | |
| 346 | template <class _Alloc> |
| 347 | struct __has_outer_allocator |
| 348 | : public common_type |
| 349 | < |
| 350 | decltype(__has_outer_allocator_test(declval<_Alloc&>())) |
| 351 | >::type |
| 352 | { |
| 353 | }; |
| 354 | |
| 355 | template <class _Alloc, bool = __has_outer_allocator<_Alloc>::value> |
| 356 | struct __outermost |
| 357 | { |
| 358 | typedef _Alloc type; |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 359 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 360 | type& operator()(type& __a) const _NOEXCEPT {return __a;} |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 361 | }; |
| 362 | |
| 363 | template <class _Alloc> |
| 364 | struct __outermost<_Alloc, true> |
| 365 | { |
| 366 | typedef typename remove_reference |
| 367 | < |
Howard Hinnant | 0949eed | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 368 | decltype(_VSTD::declval<_Alloc>().outer_allocator()) |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 369 | >::type _OuterAlloc; |
| 370 | typedef typename __outermost<_OuterAlloc>::type type; |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 371 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 372 | type& operator()(_Alloc& __a) const _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 373 | {return __outermost<_OuterAlloc>()(__a.outer_allocator());} |
| 374 | }; |
| 375 | |
| 376 | template <class _OuterAlloc, class... _InnerAllocs> |
Howard Hinnant | 0f678bd | 2013-08-12 18:38:34 +0000 | [diff] [blame] | 377 | class _LIBCPP_TYPE_VIS_ONLY scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...> |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 378 | : public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> |
| 379 | { |
| 380 | typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base; |
| 381 | typedef allocator_traits<_OuterAlloc> _OuterTraits; |
| 382 | public: |
| 383 | typedef _OuterAlloc outer_allocator_type; |
| 384 | typedef typename base::inner_allocator_type inner_allocator_type; |
| 385 | typedef typename _OuterTraits::size_type size_type; |
| 386 | typedef typename _OuterTraits::difference_type difference_type; |
| 387 | typedef typename _OuterTraits::pointer pointer; |
| 388 | typedef typename _OuterTraits::const_pointer const_pointer; |
| 389 | typedef typename _OuterTraits::void_pointer void_pointer; |
| 390 | typedef typename _OuterTraits::const_void_pointer const_void_pointer; |
| 391 | |
| 392 | typedef integral_constant |
| 393 | < |
| 394 | bool, |
| 395 | __get_poc_copy_assignment<outer_allocator_type, |
| 396 | _InnerAllocs...>::value |
| 397 | > propagate_on_container_copy_assignment; |
| 398 | typedef integral_constant |
| 399 | < |
| 400 | bool, |
| 401 | __get_poc_move_assignment<outer_allocator_type, |
| 402 | _InnerAllocs...>::value |
| 403 | > propagate_on_container_move_assignment; |
| 404 | typedef integral_constant |
| 405 | < |
| 406 | bool, |
| 407 | __get_poc_swap<outer_allocator_type, _InnerAllocs...>::value |
| 408 | > propagate_on_container_swap; |
Marshall Clow | f0324bc | 2015-06-02 16:34:03 +0000 | [diff] [blame^] | 409 | typedef integral_constant |
| 410 | < |
| 411 | bool, |
| 412 | __get_poc_always_equal<outer_allocator_type, _InnerAllocs...>::value |
| 413 | > is_always_equal; |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 414 | |
| 415 | template <class _Tp> |
| 416 | struct rebind |
| 417 | { |
| 418 | typedef scoped_allocator_adaptor |
| 419 | < |
| 420 | typename _OuterTraits::template rebind_alloc<_Tp>, _InnerAllocs... |
| 421 | > other; |
| 422 | }; |
| 423 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 424 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 425 | scoped_allocator_adaptor() _NOEXCEPT {} |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 426 | template <class _OuterA2, |
| 427 | class = typename enable_if< |
| 428 | is_constructible<outer_allocator_type, _OuterA2>::value |
| 429 | >::type> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 430 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 431 | scoped_allocator_adaptor(_OuterA2&& __outerAlloc, |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 432 | const _InnerAllocs& ...__innerAllocs) _NOEXCEPT |
Howard Hinnant | 0949eed | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 433 | : base(_VSTD::forward<_OuterA2>(__outerAlloc), __innerAllocs...) {} |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 434 | // scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default; |
| 435 | template <class _OuterA2, |
| 436 | class = typename enable_if< |
| 437 | is_constructible<outer_allocator_type, const _OuterA2&>::value |
| 438 | >::type> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 439 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 440 | scoped_allocator_adaptor( |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 441 | const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 442 | : base(__other) {} |
| 443 | template <class _OuterA2, |
| 444 | class = typename enable_if< |
| 445 | is_constructible<outer_allocator_type, _OuterA2>::value |
| 446 | >::type> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 447 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 448 | scoped_allocator_adaptor( |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 449 | scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT |
Howard Hinnant | 0949eed | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 450 | : base(_VSTD::move(__other)) {} |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 451 | |
| 452 | // ~scoped_allocator_adaptor() = default; |
| 453 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 454 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 455 | inner_allocator_type& inner_allocator() _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 456 | {return base::inner_allocator();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 457 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 458 | const inner_allocator_type& inner_allocator() const _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 459 | {return base::inner_allocator();} |
| 460 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 461 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 462 | outer_allocator_type& outer_allocator() _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 463 | {return base::outer_allocator();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 464 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 465 | const outer_allocator_type& outer_allocator() const _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 466 | {return base::outer_allocator();} |
| 467 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 468 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 469 | pointer allocate(size_type __n) |
| 470 | {return allocator_traits<outer_allocator_type>:: |
| 471 | allocate(outer_allocator(), __n);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 472 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 473 | pointer allocate(size_type __n, const_void_pointer __hint) |
| 474 | {return allocator_traits<outer_allocator_type>:: |
| 475 | allocate(outer_allocator(), __n, __hint);} |
| 476 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 477 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 478 | void deallocate(pointer __p, size_type __n) _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 479 | {allocator_traits<outer_allocator_type>:: |
| 480 | deallocate(outer_allocator(), __p, __n);} |
| 481 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 482 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 483 | size_type max_size() const |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 484 | {return allocator_traits<outer_allocator_type>::max_size(outer_allocator());} |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 485 | |
| 486 | template <class _Tp, class... _Args> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 487 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 488 | void construct(_Tp* __p, _Args&& ...__args) |
| 489 | {__construct(__uses_alloc_ctor<_Tp, inner_allocator_type, _Args...>(), |
Howard Hinnant | 0949eed | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 490 | __p, _VSTD::forward<_Args>(__args)...);} |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 491 | template <class _Tp> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 492 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 493 | void destroy(_Tp* __p) |
| 494 | { |
| 495 | typedef __outermost<outer_allocator_type> _OM; |
| 496 | allocator_traits<typename _OM::type>:: |
| 497 | destroy(_OM()(outer_allocator()), __p); |
| 498 | } |
| 499 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 500 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 501 | scoped_allocator_adaptor select_on_container_copy_construction() const _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 502 | {return base::select_on_container_copy_construction();} |
| 503 | |
| 504 | private: |
| 505 | |
| 506 | template <class _OuterA2, |
| 507 | class = typename enable_if< |
| 508 | is_constructible<outer_allocator_type, _OuterA2>::value |
| 509 | >::type> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 510 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 511 | scoped_allocator_adaptor(_OuterA2&& __o, |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 512 | const inner_allocator_type& __i) _NOEXCEPT |
Howard Hinnant | 0949eed | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 513 | : base(_VSTD::forward<_OuterA2>(__o), __i) {} |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 514 | |
| 515 | template <class _Tp, class... _Args> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 516 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 517 | void __construct(integral_constant<int, 0>, _Tp* __p, _Args&& ...__args) |
| 518 | { |
| 519 | typedef __outermost<outer_allocator_type> _OM; |
| 520 | allocator_traits<typename _OM::type>::construct |
| 521 | ( |
| 522 | _OM()(outer_allocator()), |
| 523 | __p, |
Howard Hinnant | 0949eed | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 524 | _VSTD::forward<_Args>(__args)... |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 525 | ); |
| 526 | } |
| 527 | |
| 528 | template <class _Tp, class... _Args> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 529 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 530 | void __construct(integral_constant<int, 1>, _Tp* __p, _Args&& ...__args) |
| 531 | { |
| 532 | typedef __outermost<outer_allocator_type> _OM; |
| 533 | allocator_traits<typename _OM::type>::construct |
| 534 | ( |
| 535 | _OM()(outer_allocator()), |
| 536 | __p, |
| 537 | allocator_arg, |
| 538 | inner_allocator(), |
Howard Hinnant | 0949eed | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 539 | _VSTD::forward<_Args>(__args)... |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 540 | ); |
| 541 | } |
| 542 | |
| 543 | template <class _Tp, class... _Args> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 544 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 545 | void __construct(integral_constant<int, 2>, _Tp* __p, _Args&& ...__args) |
| 546 | { |
| 547 | typedef __outermost<outer_allocator_type> _OM; |
| 548 | allocator_traits<typename _OM::type>::construct |
| 549 | ( |
| 550 | _OM()(outer_allocator()), |
| 551 | __p, |
Howard Hinnant | 0949eed | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 552 | _VSTD::forward<_Args>(__args)..., |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 553 | inner_allocator() |
| 554 | ); |
| 555 | } |
| 556 | |
| 557 | template <class...> friend class __scoped_allocator_storage; |
| 558 | }; |
| 559 | |
| 560 | template <class _OuterA1, class _OuterA2> |
| 561 | inline _LIBCPP_INLINE_VISIBILITY |
| 562 | bool |
| 563 | operator==(const scoped_allocator_adaptor<_OuterA1>& __a, |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 564 | const scoped_allocator_adaptor<_OuterA2>& __b) _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 565 | { |
| 566 | return __a.outer_allocator() == __b.outer_allocator(); |
| 567 | } |
| 568 | |
Howard Hinnant | fead2e2 | 2011-05-17 20:41:18 +0000 | [diff] [blame] | 569 | template <class _OuterA1, class _OuterA2, class _InnerA0, class... _InnerAllocs> |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 570 | inline _LIBCPP_INLINE_VISIBILITY |
| 571 | bool |
Howard Hinnant | fead2e2 | 2011-05-17 20:41:18 +0000 | [diff] [blame] | 572 | operator==(const scoped_allocator_adaptor<_OuterA1, _InnerA0, _InnerAllocs...>& __a, |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 573 | const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b) _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 574 | { |
| 575 | return __a.outer_allocator() == __b.outer_allocator() && |
| 576 | __a.inner_allocator() == __b.inner_allocator(); |
| 577 | } |
| 578 | |
| 579 | template <class _OuterA1, class _OuterA2, class... _InnerAllocs> |
| 580 | inline _LIBCPP_INLINE_VISIBILITY |
| 581 | bool |
| 582 | operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a, |
Howard Hinnant | 0667433 | 2011-05-28 18:51:12 +0000 | [diff] [blame] | 583 | const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b) _NOEXCEPT |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 584 | { |
| 585 | return !(__a == __b); |
| 586 | } |
| 587 | |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 588 | #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE) |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 589 | |
| 590 | _LIBCPP_END_NAMESPACE_STD |
| 591 | |
| 592 | #endif // _LIBCPP_SCOPED_ALLOCATOR |