1.1 --- a/epoc32/include/stdapis/boost/variant/detail/move.hpp Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,166 +0,0 @@
1.4 -//-----------------------------------------------------------------------------
1.5 -// boost variant/detail/move.hpp header file
1.6 -// See http://www.boost.org for updates, documentation, and revision history.
1.7 -//-----------------------------------------------------------------------------
1.8 -//
1.9 -// Copyright (c) 2002-2003 Eric Friedman
1.10 -// Copyright (c) 2002 by Andrei Alexandrescu
1.11 -//
1.12 -// Use, modification and distribution are subject to the
1.13 -// Boost Software License, Version 1.0. (See accompanying file
1.14 -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
1.15 -//
1.16 -// This file derivative of MoJO. Much thanks to Andrei for his initial work.
1.17 -// See <http://www.cuj.com/experts/2102/alexandr.htm> for information on MOJO.
1.18 -// Re-issued here under the Boost Software License, with permission of the original
1.19 -// author (Andrei Alexandrescu).
1.20 -
1.21 -
1.22 -#ifndef BOOST_VARIANT_DETAIL_MOVE_HPP
1.23 -#define BOOST_VARIANT_DETAIL_MOVE_HPP
1.24 -
1.25 -#include <iterator> // for iterator_traits
1.26 -#include <new> // for placement new
1.27 -
1.28 -#include "boost/config.hpp"
1.29 -#include "boost/detail/workaround.hpp"
1.30 -#include "boost/mpl/if.hpp"
1.31 -#include "boost/type_traits/is_base_and_derived.hpp"
1.32 -
1.33 -namespace boost {
1.34 -namespace detail { namespace variant {
1.35 -
1.36 -//////////////////////////////////////////////////////////////////////////
1.37 -// forward declares
1.38 -//
1.39 -// NOTE: Incomplete until (if?) Boost.Move becomes part of Boost.
1.40 -//
1.41 -template <typename Deriving> class moveable;
1.42 -template <typename T> class move_source;
1.43 -template <typename T> class move_return;
1.44 -
1.45 -namespace detail {
1.46 -
1.47 -// (detail) moveable_tag
1.48 -//
1.49 -// Concrete type from which moveable<T> derives.
1.50 -//
1.51 -// TODO: Move into moveable_fwd.hpp and define has_move_constructor.
1.52 -//
1.53 -template <typename Deriving>
1.54 -struct moveable_tag
1.55 -{
1.56 -};
1.57 -
1.58 -} // namespace detail
1.59 -
1.60 -//////////////////////////////////////////////////////////////////////////
1.61 -// function template move
1.62 -//
1.63 -// Takes a T& and returns, if T derives moveable<T>, a move_source<T> for
1.64 -// the object; else, returns the T&.
1.65 -//
1.66 -
1.67 -namespace detail {
1.68 -
1.69 -// (detail) class template move_type
1.70 -//
1.71 -// Metafunction that, given moveable T, provides move_source<T>, else T&.
1.72 -//
1.73 -template <typename T>
1.74 -struct move_type
1.75 -{
1.76 -public: // metafunction result
1.77 -
1.78 - typedef typename mpl::if_<
1.79 - is_base_and_derived<detail::moveable_tag<T>, T>
1.80 - , move_source<T>
1.81 - , T&
1.82 - >::type type;
1.83 -
1.84 -};
1.85 -
1.86 -} // namespace detail
1.87 -
1.88 -template <typename T>
1.89 -inline
1.90 - typename detail::move_type<T>::type
1.91 -move(T& source)
1.92 -{
1.93 - typedef typename detail::move_type<T>::type
1.94 - move_t;
1.95 -
1.96 - return move_t(source);
1.97 -}
1.98 -
1.99 -//////////////////////////////////////////////////////////////////////////
1.100 -// class template return_t
1.101 -//
1.102 -// Metafunction that, given moveable T, provides move_return<T>, else T.
1.103 -//
1.104 -template <typename T>
1.105 -struct return_t
1.106 -{
1.107 -public: // metafunction result
1.108 -
1.109 - typedef typename mpl::if_<
1.110 - is_base_and_derived<moveable<T>, T>
1.111 - , move_return<T>
1.112 - , T
1.113 - >::type type;
1.114 -
1.115 -};
1.116 -
1.117 -//////////////////////////////////////////////////////////////////////////
1.118 -// function template move_swap
1.119 -//
1.120 -// Swaps using Koenig lookup but falls back to move-swap for primitive
1.121 -// types and on non-conforming compilers.
1.122 -//
1.123 -
1.124 -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) \
1.125 - || BOOST_WORKAROUND(__GNUC__, BOOST_TESTED_AT(2))
1.126 -
1.127 -// [Indicate that move_swap by overload is disabled...]
1.128 -#define BOOST_NO_MOVE_SWAP_BY_OVERLOAD
1.129 -
1.130 -// [...and provide straight swap-by-move implementation:]
1.131 -template <typename T>
1.132 -inline void move_swap(T& lhs, T& rhs)
1.133 -{
1.134 - T tmp( boost::detail::variant::move(lhs) );
1.135 - lhs = boost::detail::variant::move(rhs);
1.136 - rhs = boost::detail::variant::move(tmp);
1.137 -}
1.138 -
1.139 -#else// !workaround
1.140 -
1.141 -namespace detail { namespace move_swap {
1.142 -
1.143 -template <typename T>
1.144 -inline void swap(T& lhs, T& rhs)
1.145 -{
1.146 - T tmp( boost::detail::variant::move(lhs) );
1.147 - lhs = boost::detail::variant::move(rhs);
1.148 - rhs = boost::detail::variant::move(tmp);
1.149 -}
1.150 -
1.151 -}} // namespace detail::move_swap
1.152 -
1.153 -template <typename T>
1.154 -inline void move_swap(T& lhs, T& rhs)
1.155 -{
1.156 - using detail::move_swap::swap;
1.157 -
1.158 - swap(lhs, rhs);
1.159 -}
1.160 -
1.161 -#endif // workaround
1.162 -
1.163 -}} // namespace detail::variant
1.164 -} // namespace boost
1.165 -
1.166 -#endif // BOOST_VARIANT_DETAIL_MOVE_HPP
1.167 -
1.168 -
1.169 -