File indexing completed on 2025-01-18 09:31:08
0001
0002
0003
0004
0005
0006
0007 #if !defined(FUSION_COPY_02162011_2308)
0008 #define FUSION_COPY_02162011_2308
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 #if defined (BOOST_MSVC)
0022 # pragma warning(push)
0023 # pragma warning (disable: 4100)
0024 #endif
0025
0026 namespace boost { namespace fusion
0027 {
0028 namespace detail
0029 {
0030 template <typename Seq1, typename Seq2>
0031 struct sequence_copy
0032 {
0033 typedef typename result_of::end<Seq1>::type end1_type;
0034 typedef typename result_of::end<Seq2>::type end2_type;
0035
0036 template <typename I1, typename I2>
0037 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0038 static void
0039 call(I1 const&, I2 const&, mpl::true_)
0040 {
0041 }
0042
0043 template <typename I1, typename I2>
0044 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0045 static void
0046 call(I1 const& src, I2 const& dest, mpl::false_)
0047 {
0048 *dest = *src;
0049 call(fusion::next(src), fusion::next(dest));
0050 }
0051
0052 template <typename I1, typename I2>
0053 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0054 static void
0055 call(I1 const& src, I2 const& dest)
0056 {
0057 typename result_of::equal_to<I1, end1_type>::type eq;
0058 return call(src, dest, eq);
0059 }
0060 };
0061 }
0062
0063 namespace result_of
0064 {
0065 template <typename Seq1, typename Seq2>
0066 struct copy
0067 : enable_if<mpl::and_<
0068 traits::is_sequence<Seq1>,
0069 traits::is_sequence<Seq2>
0070 > > {};
0071 }
0072
0073 template <typename Seq1, typename Seq2>
0074 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0075 inline typename result_of::copy<Seq1 const, Seq2>::type
0076 copy(Seq1 const& src, Seq2& dest)
0077 {
0078 BOOST_STATIC_ASSERT(
0079 result_of::size<Seq1>::value <= result_of::size<Seq2>::value);
0080
0081 detail::sequence_copy<
0082 Seq1 const, Seq2>::
0083 call(fusion::begin(src), fusion::begin(dest));
0084 }
0085 }}
0086
0087 #if defined (BOOST_MSVC)
0088 # pragma warning(pop)
0089 #endif
0090
0091 #endif