Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/variant/detail/move.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 |
---|---|
3 // See http://www.boost.org for updates, documentation, and revision history. | 3 // See http://www.boost.org for updates, documentation, and revision history. |
4 //----------------------------------------------------------------------------- | 4 //----------------------------------------------------------------------------- |
5 // | 5 // |
6 // Copyright (c) 2002-2003 Eric Friedman | 6 // Copyright (c) 2002-2003 Eric Friedman |
7 // Copyright (c) 2002 by Andrei Alexandrescu | 7 // Copyright (c) 2002 by Andrei Alexandrescu |
8 // Copyright (c) 2013-2014 Antony Polukhin | |
8 // | 9 // |
9 // Use, modification and distribution are subject to the | 10 // Use, modification and distribution are subject to the |
10 // Boost Software License, Version 1.0. (See accompanying file | 11 // Boost Software License, Version 1.0. (See accompanying file |
11 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | 12 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
12 // | 13 // |
23 #include <new> // for placement new | 24 #include <new> // for placement new |
24 | 25 |
25 #include "boost/config.hpp" | 26 #include "boost/config.hpp" |
26 #include "boost/detail/workaround.hpp" | 27 #include "boost/detail/workaround.hpp" |
27 #include "boost/move/move.hpp" | 28 #include "boost/move/move.hpp" |
29 #include "boost/move/adl_move_swap.hpp" | |
28 | 30 |
29 namespace boost { | 31 namespace boost { namespace detail { namespace variant { |
30 namespace detail { namespace variant { | |
31 | 32 |
32 using boost::move; | 33 using boost::move; |
33 | 34 |
34 ////////////////////////////////////////////////////////////////////////// | 35 ////////////////////////////////////////////////////////////////////////// |
35 // function template move_swap | 36 // function template move_swap |
36 // | 37 // |
37 // Swaps using Koenig lookup but falls back to move-swap for primitive | 38 // Swaps using Koenig lookup but falls back to move-swap for primitive |
38 // types and on non-conforming compilers. | 39 // types and on non-conforming compilers. |
39 // | 40 // |
40 | 41 |
41 #if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) \ | |
42 || BOOST_WORKAROUND(__GNUC__, BOOST_TESTED_AT(2)) | |
43 | |
44 // [Indicate that move_swap by overload is disabled...] | |
45 #define BOOST_NO_MOVE_SWAP_BY_OVERLOAD | |
46 | |
47 // [...and provide straight swap-by-move implementation:] | |
48 template <typename T> | 42 template <typename T> |
49 inline void move_swap(T& lhs, T& rhs) | 43 inline void move_swap(T& lhs, T& rhs) |
50 { | 44 { |
51 T tmp( boost::detail::variant::move(lhs) ); | 45 ::boost::adl_move_swap(lhs, rhs); |
52 lhs = boost::detail::variant::move(rhs); | |
53 rhs = boost::detail::variant::move(tmp); | |
54 } | 46 } |
55 | 47 |
56 #else// !workaround | 48 }}} // namespace boost::detail::variant |
57 | |
58 namespace detail { namespace move_swap { | |
59 | |
60 template <typename T> | |
61 inline void swap(T& lhs, T& rhs) | |
62 { | |
63 T tmp( boost::detail::variant::move(lhs) ); | |
64 lhs = boost::detail::variant::move(rhs); | |
65 rhs = boost::detail::variant::move(tmp); | |
66 } | |
67 | |
68 }} // namespace detail::move_swap | |
69 | |
70 template <typename T> | |
71 inline void move_swap(T& lhs, T& rhs) | |
72 { | |
73 using detail::move_swap::swap; | |
74 | |
75 swap(lhs, rhs); | |
76 } | |
77 | |
78 #endif // workaround | |
79 | |
80 }} // namespace detail::variant | |
81 } // namespace boost | |
82 | 49 |
83 #endif // BOOST_VARIANT_DETAIL_MOVE_HPP | 50 #endif // BOOST_VARIANT_DETAIL_MOVE_HPP |
84 | 51 |
85 | 52 |
86 | 53 |