comparison DEPENDENCIES/generic/include/boost/container/detail/pair.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
1 ////////////////////////////////////////////////////////////////////////////// 1 //////////////////////////////////////////////////////////////////////////////
2 // 2 //
3 // (C) Copyright Ion Gaztanaga 2005-2012. 3 // (C) Copyright Ion Gaztanaga 2005-2013.
4 // 4 //
5 // Distributed under the Boost Software License, Version 1.0. 5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at 6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt) 7 // http://www.boost.org/LICENSE_1_0.txt)
8 // 8 //
11 ////////////////////////////////////////////////////////////////////////////// 11 //////////////////////////////////////////////////////////////////////////////
12 12
13 #ifndef BOOST_CONTAINER_CONTAINER_DETAIL_PAIR_HPP 13 #ifndef BOOST_CONTAINER_CONTAINER_DETAIL_PAIR_HPP
14 #define BOOST_CONTAINER_CONTAINER_DETAIL_PAIR_HPP 14 #define BOOST_CONTAINER_CONTAINER_DETAIL_PAIR_HPP
15 15
16 #if defined(_MSC_VER) 16 #ifndef BOOST_CONFIG_HPP
17 # include <boost/config.hpp>
18 #endif
19
20 #if defined(BOOST_HAS_PRAGMA_ONCE)
17 # pragma once 21 # pragma once
18 #endif 22 #endif
19 23
20 #include "config_begin.hpp" 24 #include <boost/container/detail/config_begin.hpp>
21 #include <boost/container/detail/workaround.hpp> 25 #include <boost/container/detail/workaround.hpp>
22 26
23 #include <boost/container/detail/mpl.hpp> 27 #include <boost/container/detail/mpl.hpp>
24 #include <boost/container/detail/type_traits.hpp> 28 #include <boost/container/detail/type_traits.hpp>
25 #include <boost/container/detail/mpl.hpp> 29 #include <boost/container/detail/mpl.hpp>
26 #include <boost/container/detail/type_traits.hpp> 30 #include <boost/container/detail/type_traits.hpp>
27 31 #include <boost/move/adl_move_swap.hpp> //swap
28 #include <utility> //std::pair 32
29 #include <algorithm> //std::swap 33 #include <boost/intrusive/detail/minimal_pair_header.hpp> //pair
30 34 #include <boost/move/utility_core.hpp>
31 #include <boost/move/utility.hpp>
32 #include <boost/type_traits/is_class.hpp>
33
34 #ifndef BOOST_CONTAINER_PERFECT_FORWARDING
35 #include <boost/container/detail/preprocessor.hpp>
36 #endif
37 35
38 namespace boost { 36 namespace boost {
39 namespace container { 37 namespace container {
40 namespace container_detail { 38 namespace container_detail {
41 39
164 //piecewise_construct missing 162 //piecewise_construct missing
165 //template <class U, class V> pair(pair<U, V>&& p); 163 //template <class U, class V> pair(pair<U, V>&& p);
166 //template <class... Args1, class... Args2> 164 //template <class... Args1, class... Args2>
167 // pair(piecewise_construct_t, tuple<Args1...> first_args, 165 // pair(piecewise_construct_t, tuple<Args1...> first_args,
168 // tuple<Args2...> second_args); 166 // tuple<Args2...> second_args);
169 /* 167
170 //Variadic versions
171 template<class U>
172 pair(BOOST_CONTAINER_PP_PARAM(U, u), typename container_detail::disable_if
173 < container_detail::is_pair< typename container_detail::remove_ref_const<U>::type >, pair_nat>::type* = 0)
174 : first(::boost::forward<U>(u))
175 , second()
176 {}
177
178 #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
179
180 template<class U, class V, class ...Args>
181 pair(U &&u, V &&v)
182 : first(::boost::forward<U>(u))
183 , second(::boost::forward<V>(v), ::boost::forward<Args>(args)...)
184 {}
185
186 #else
187
188 #define BOOST_PP_LOCAL_MACRO(n) \
189 template<class U, BOOST_PP_ENUM_PARAMS(n, class P)> \
190 pair(BOOST_CONTAINER_PP_PARAM(U, u) \
191 ,BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
192 : first(::boost::forward<U>(u)) \
193 , second(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)) \
194 {} \
195 //!
196 #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
197 #include BOOST_PP_LOCAL_ITERATE()
198 #endif
199 */
200 //pair copy assignment 168 //pair copy assignment
201 pair& operator=(BOOST_COPY_ASSIGN_REF(pair) p) 169 pair& operator=(BOOST_COPY_ASSIGN_REF(pair) p)
202 { 170 {
203 first = p.first; 171 first = p.first;
204 second = p.second; 172 second = p.second;
270 } 238 }
271 239
272 //swap 240 //swap
273 void swap(pair& p) 241 void swap(pair& p)
274 { 242 {
275 using std::swap; 243 ::boost::adl_move_swap(this->first, p.first);
276 swap(this->first, p.first); 244 ::boost::adl_move_swap(this->second, p.second);
277 swap(this->second, p.second);
278 } 245 }
279 }; 246 };
280 247
281 template <class T1, class T2> 248 template <class T1, class T2>
282 inline bool operator==(const pair<T1,T2>& x, const pair<T1,T2>& y) 249 inline bool operator==(const pair<T1,T2>& x, const pair<T1,T2>& y)
307 inline pair<T1, T2> make_pair(T1 x, T2 y) 274 inline pair<T1, T2> make_pair(T1 x, T2 y)
308 { return pair<T1, T2>(x, y); } 275 { return pair<T1, T2>(x, y); }
309 276
310 template <class T1, class T2> 277 template <class T1, class T2>
311 inline void swap(pair<T1, T2>& x, pair<T1, T2>& y) 278 inline void swap(pair<T1, T2>& x, pair<T1, T2>& y)
312 { 279 { x.swap(y); }
313 swap(x.first, y.first);
314 swap(x.second, y.second);
315 }
316 280
317 } //namespace container_detail { 281 } //namespace container_detail {
318 } //namespace container { 282 } //namespace container {
319 283
320 284
328 struct is_enum< ::boost::container::container_detail::pair<T, U> > 292 struct is_enum< ::boost::container::container_detail::pair<T, U> >
329 { 293 {
330 static const bool value = false; 294 static const bool value = false;
331 }; 295 };
332 296
297 template <class T>
298 struct is_class;
299
333 //This specialization is needed to avoid instantiation of pair in 300 //This specialization is needed to avoid instantiation of pair in
334 //is_class, and allow recursive maps. 301 //is_class, and allow recursive maps.
335 template <class T1, class T2> 302 template <class T1, class T2>
336 struct is_class< ::boost::container::container_detail::pair<T1, T2> > 303 struct is_class< ::boost::container::container_detail::pair<T1, T2> >
337 : public ::boost::true_type 304 {
338 {}; 305 static const bool value = true;
306 };
339 307
340 #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES 308 #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
341 309
342 template<class T1, class T2> 310 template<class T1, class T2>
343 struct has_move_emulation_enabled< ::boost::container::container_detail::pair<T1, T2> > 311 struct has_move_emulation_enabled< ::boost::container::container_detail::pair<T1, T2> >
344 : ::boost::true_type 312 {
345 {}; 313 static const bool value = true;
314 };
346 315
347 #endif 316 #endif
348 317
318 namespace move_detail{
319
320 template<class T>
321 struct is_class_or_union;
322
323 template <class T1, class T2>
324 struct is_class_or_union< ::boost::container::container_detail::pair<T1, T2> >
325 //This specialization is needed to avoid instantiation of pair in
326 //is_class, and allow recursive maps.
327 {
328 static const bool value = true;
329 };
330
331
332 } //namespace move_detail{
349 333
350 } //namespace boost { 334 } //namespace boost {
351 335
352 #include <boost/container/detail/config_end.hpp> 336 #include <boost/container/detail/config_end.hpp>
353 337