Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:31:08

0001 /*=============================================================================
0002     Copyright (c) 2001-2013 Joel de Guzman
0003 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 ==============================================================================*/
0007 #if !defined(FUSION_MOVE_01192013_2225)
0008 #define FUSION_MOVE_01192013_2225
0009 
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/fusion/sequence/intrinsic/begin.hpp>
0012 #include <boost/fusion/sequence/intrinsic/end.hpp>
0013 #include <boost/fusion/sequence/intrinsic/size.hpp>
0014 #include <boost/fusion/sequence/comparison/detail/equal_to.hpp>
0015 #include <boost/fusion/support/is_sequence.hpp>
0016 #include <boost/config.hpp>
0017 #include <boost/static_assert.hpp>
0018 #include <boost/utility/enable_if.hpp>
0019 #include <boost/mpl/and.hpp>
0020 
0021 #include <utility> // for std::move
0022 
0023 #if defined (BOOST_MSVC)
0024 #  pragma warning(push)
0025 #  pragma warning (disable: 4100) // unreferenced formal parameter
0026 #endif
0027 
0028 namespace boost { namespace fusion
0029 {
0030     namespace detail
0031     {
0032         template <typename Seq1, typename Seq2>
0033         struct sequence_move
0034         {
0035             typedef typename result_of::end<Seq1>::type end1_type;
0036             typedef typename result_of::end<Seq2>::type end2_type;
0037 
0038             template <typename I1, typename I2>
0039             BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0040             static void
0041             call(I1 const&, I2 const&, mpl::true_)
0042             {
0043             }
0044 
0045             template <typename I1, typename I2>
0046             BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0047             static void
0048             call(I1 const& src, I2 const& dest, mpl::false_)
0049             {
0050                 *dest = std::move(*src);
0051                 call(fusion::next(src), fusion::next(dest));
0052             }
0053 
0054             template <typename I1, typename I2>
0055             BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0056             static void
0057             call(I1 const& src, I2 const& dest)
0058             {
0059                 typename result_of::equal_to<I1, end1_type>::type eq;
0060                 return call(src, dest, eq);
0061             }
0062         };
0063     }
0064 
0065     namespace result_of
0066     {
0067         template <typename Seq1, typename Seq2>
0068         struct move
0069             : enable_if<mpl::and_<
0070                   traits::is_sequence<Seq1>,
0071                   traits::is_sequence<Seq2>
0072               > > {};
0073     }
0074 
0075     template <typename Seq1, typename Seq2>
0076     BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0077     inline typename result_of::move<Seq1, Seq2>::type
0078     move(Seq1&& src, Seq2& dest)
0079     {
0080         BOOST_STATIC_ASSERT(
0081             result_of::size<Seq1>::value <= result_of::size<Seq2>::value);
0082 
0083         detail::sequence_move<
0084             Seq1, Seq2>::
0085             call(fusion::begin(src), fusion::begin(dest));
0086     }
0087 }}
0088 
0089 #if defined (BOOST_MSVC)
0090 #  pragma warning(pop)
0091 #endif
0092 
0093 #endif