]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/fusion/include/boost/fusion/algorithm/auxiliary/move.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / fusion / include / boost / fusion / algorithm / auxiliary / move.hpp
1 /*=============================================================================
2 Copyright (c) 2001-2013 Joel de Guzman
3
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 #if !defined(FUSION_MOVE_01192013_2225)
8 #define FUSION_MOVE_01192013_2225
9
10 #include <boost/fusion/support/config.hpp>
11 #include <boost/fusion/sequence/intrinsic/begin.hpp>
12 #include <boost/fusion/sequence/intrinsic/end.hpp>
13 #include <boost/fusion/sequence/intrinsic/size.hpp>
14 #include <boost/fusion/sequence/comparison/detail/equal_to.hpp>
15 #include <boost/fusion/support/is_sequence.hpp>
16 #include <boost/config.hpp>
17 #include <boost/static_assert.hpp>
18 #include <boost/utility/enable_if.hpp>
19 #include <boost/mpl/and.hpp>
20
21 #include <utility> // for std::move
22
23 #if defined (BOOST_MSVC)
24 # pragma warning(push)
25 # pragma warning (disable: 4100) // unreferenced formal parameter
26 #endif
27
28 namespace boost { namespace fusion
29 {
30 namespace detail
31 {
32 template <typename Seq1, typename Seq2>
33 struct sequence_move
34 {
35 typedef typename result_of::end<Seq1>::type end1_type;
36 typedef typename result_of::end<Seq2>::type end2_type;
37
38 template <typename I1, typename I2>
39 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
40 static void
41 call(I1 const&, I2 const&, mpl::true_)
42 {
43 }
44
45 template <typename I1, typename I2>
46 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
47 static void
48 call(I1 const& src, I2 const& dest, mpl::false_)
49 {
50 *dest = std::move(*src);
51 call(fusion::next(src), fusion::next(dest));
52 }
53
54 template <typename I1, typename I2>
55 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
56 static void
57 call(I1 const& src, I2 const& dest)
58 {
59 typename result_of::equal_to<I1, end1_type>::type eq;
60 return call(src, dest, eq);
61 }
62 };
63 }
64
65 namespace result_of
66 {
67 template <typename Seq1, typename Seq2>
68 struct move
69 : enable_if<mpl::and_<
70 traits::is_sequence<Seq1>,
71 traits::is_sequence<Seq2>
72 > > {};
73 }
74
75 template <typename Seq1, typename Seq2>
76 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
77 inline typename result_of::move<Seq1, Seq2>::type
78 move(Seq1&& src, Seq2& dest)
79 {
80 BOOST_STATIC_ASSERT(
81 result_of::size<Seq1>::value <= result_of::size<Seq2>::value);
82
83 detail::sequence_move<
84 Seq1, Seq2>::
85 call(fusion::begin(src), fusion::begin(dest));
86 }
87 }}
88
89 #if defined (BOOST_MSVC)
90 # pragma warning(pop)
91 #endif
92
93 #endif