annotate DEPENDENCIES/generic/include/boost/variant/detail/move.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children c530137014c0
rev   line source
Chris@16 1 //-----------------------------------------------------------------------------
Chris@16 2 // boost variant/detail/move.hpp header file
Chris@16 3 // See http://www.boost.org for updates, documentation, and revision history.
Chris@16 4 //-----------------------------------------------------------------------------
Chris@16 5 //
Chris@16 6 // Copyright (c) 2002-2003 Eric Friedman
Chris@16 7 // Copyright (c) 2002 by Andrei Alexandrescu
Chris@16 8 //
Chris@16 9 // Use, modification and distribution are subject to the
Chris@16 10 // Boost Software License, Version 1.0. (See accompanying file
Chris@16 11 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 12 //
Chris@16 13 // This file derivative of MoJO. Much thanks to Andrei for his initial work.
Chris@16 14 // See <http://www.cuj.com/experts/2102/alexandr.htm> for information on MOJO.
Chris@16 15 // Re-issued here under the Boost Software License, with permission of the original
Chris@16 16 // author (Andrei Alexandrescu).
Chris@16 17
Chris@16 18
Chris@16 19 #ifndef BOOST_VARIANT_DETAIL_MOVE_HPP
Chris@16 20 #define BOOST_VARIANT_DETAIL_MOVE_HPP
Chris@16 21
Chris@16 22 #include <iterator> // for iterator_traits
Chris@16 23 #include <new> // for placement new
Chris@16 24
Chris@16 25 #include "boost/config.hpp"
Chris@16 26 #include "boost/detail/workaround.hpp"
Chris@16 27 #include "boost/move/move.hpp"
Chris@16 28
Chris@16 29 namespace boost {
Chris@16 30 namespace detail { namespace variant {
Chris@16 31
Chris@16 32 using boost::move;
Chris@16 33
Chris@16 34 //////////////////////////////////////////////////////////////////////////
Chris@16 35 // function template move_swap
Chris@16 36 //
Chris@16 37 // Swaps using Koenig lookup but falls back to move-swap for primitive
Chris@16 38 // types and on non-conforming compilers.
Chris@16 39 //
Chris@16 40
Chris@16 41 #if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) \
Chris@16 42 || BOOST_WORKAROUND(__GNUC__, BOOST_TESTED_AT(2))
Chris@16 43
Chris@16 44 // [Indicate that move_swap by overload is disabled...]
Chris@16 45 #define BOOST_NO_MOVE_SWAP_BY_OVERLOAD
Chris@16 46
Chris@16 47 // [...and provide straight swap-by-move implementation:]
Chris@16 48 template <typename T>
Chris@16 49 inline void move_swap(T& lhs, T& rhs)
Chris@16 50 {
Chris@16 51 T tmp( boost::detail::variant::move(lhs) );
Chris@16 52 lhs = boost::detail::variant::move(rhs);
Chris@16 53 rhs = boost::detail::variant::move(tmp);
Chris@16 54 }
Chris@16 55
Chris@16 56 #else// !workaround
Chris@16 57
Chris@16 58 namespace detail { namespace move_swap {
Chris@16 59
Chris@16 60 template <typename T>
Chris@16 61 inline void swap(T& lhs, T& rhs)
Chris@16 62 {
Chris@16 63 T tmp( boost::detail::variant::move(lhs) );
Chris@16 64 lhs = boost::detail::variant::move(rhs);
Chris@16 65 rhs = boost::detail::variant::move(tmp);
Chris@16 66 }
Chris@16 67
Chris@16 68 }} // namespace detail::move_swap
Chris@16 69
Chris@16 70 template <typename T>
Chris@16 71 inline void move_swap(T& lhs, T& rhs)
Chris@16 72 {
Chris@16 73 using detail::move_swap::swap;
Chris@16 74
Chris@16 75 swap(lhs, rhs);
Chris@16 76 }
Chris@16 77
Chris@16 78 #endif // workaround
Chris@16 79
Chris@16 80 }} // namespace detail::variant
Chris@16 81 } // namespace boost
Chris@16 82
Chris@16 83 #endif // BOOST_VARIANT_DETAIL_MOVE_HPP
Chris@16 84
Chris@16 85
Chris@16 86