Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:00

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 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_TRANSFORM_VIEW_07162005_1037)
0008 #define FUSION_TRANSFORM_VIEW_07162005_1037
0009 
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/static_assert.hpp>
0012 #include <boost/fusion/support/detail/access.hpp>
0013 #include <boost/fusion/support/is_view.hpp>
0014 #include <boost/fusion/support/category_of.hpp>
0015 #include <boost/fusion/view/transform_view/transform_view_iterator.hpp>
0016 #include <boost/fusion/view/transform_view/transform_view_fwd.hpp>
0017 #include <boost/fusion/view/transform_view/detail/begin_impl.hpp>
0018 #include <boost/fusion/view/transform_view/detail/end_impl.hpp>
0019 #include <boost/fusion/view/transform_view/detail/at_impl.hpp>
0020 #include <boost/fusion/view/transform_view/detail/value_at_impl.hpp>
0021 #include <boost/fusion/view/detail/strictest_traversal.hpp>
0022 #include <boost/fusion/container/vector/vector10.hpp>
0023 #include <boost/fusion/sequence/intrinsic/size.hpp>
0024 #include <boost/fusion/support/sequence_base.hpp>
0025 #include <boost/fusion/sequence/intrinsic/begin.hpp>
0026 #include <boost/fusion/sequence/intrinsic/end.hpp>
0027 #include <boost/fusion/sequence/intrinsic/size.hpp>
0028 #include <boost/mpl/bool.hpp>
0029 
0030 #ifdef _MSC_VER
0031 #  pragma warning(push)
0032 #  pragma warning(disable: 4512) // assignment operator could not be generated.
0033 #endif
0034 
0035 namespace boost { namespace fusion
0036 {
0037     struct void_;
0038     struct transform_view_tag;
0039     struct transform_view2_tag;
0040     struct fusion_sequence_tag;
0041 
0042     // Binary Version
0043     template <typename Sequence1, typename Sequence2, typename F>
0044     struct transform_view : sequence_base<transform_view<Sequence1, Sequence2, F> >
0045     {
0046         BOOST_STATIC_ASSERT(result_of::size<Sequence1>::value == result_of::size<Sequence2>::value);
0047         typedef transform_view2_tag fusion_tag;
0048         typedef fusion_sequence_tag tag; // this gets picked up by MPL
0049         typedef mpl::true_ is_view;
0050 
0051         typedef typename traits::category_of<Sequence1>::type category1;
0052         typedef typename traits::category_of<Sequence2>::type category2;
0053         typedef typename detail::strictest_traversal<
0054             fusion::vector2<Sequence1, Sequence2> >::type category;
0055         typedef typename result_of::begin<Sequence1>::type first1_type;
0056         typedef typename result_of::begin<Sequence2>::type first2_type;
0057         typedef typename result_of::end<Sequence1>::type last1_type;
0058         typedef typename result_of::end<Sequence2>::type last2_type;
0059         typedef typename result_of::size<Sequence1>::type size;
0060         typedef Sequence1 sequence1_type;
0061         typedef Sequence2 sequence2_type;
0062         typedef F transform_type;
0063 
0064         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0065         transform_view(Sequence1& in_seq1, Sequence2& in_seq2, F const& binop)
0066             : f(binop)
0067             , seq1(in_seq1)
0068             , seq2(in_seq2)
0069         {}
0070 
0071         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0072         first1_type first1() const { return fusion::begin(seq1); }
0073         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0074         first2_type first2() const { return fusion::begin(seq2); }
0075         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0076         last1_type last1() const { return fusion::end(seq1); }
0077         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0078         last2_type last2() const { return fusion::end(seq2); }
0079 
0080         transform_type f;
0081         typename mpl::if_<traits::is_view<Sequence1>, Sequence1, Sequence1&>::type seq1;
0082         typename mpl::if_<traits::is_view<Sequence2>, Sequence2, Sequence2&>::type seq2;
0083     };
0084 
0085     // Unary Version
0086     template <typename Sequence, typename F>
0087 #if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS)
0088     struct transform_view<Sequence, F, void_> : sequence_base<transform_view<Sequence, F, void_> >
0089 #else
0090     struct transform_view<Sequence, F> : sequence_base<transform_view<Sequence, F> >
0091 #endif
0092     {
0093         typedef transform_view_tag fusion_tag;
0094         typedef fusion_sequence_tag tag; // this gets picked up by MPL
0095         typedef mpl::true_ is_view;
0096 
0097         typedef typename traits::category_of<Sequence>::type category;
0098         typedef typename result_of::begin<Sequence>::type first_type;
0099         typedef typename result_of::end<Sequence>::type last_type;
0100         typedef typename result_of::size<Sequence>::type size;
0101         typedef Sequence sequence_type;
0102         typedef F transform_type;
0103 
0104         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0105         transform_view(Sequence& in_seq, F const& in_f)
0106             : seq(in_seq)
0107             , f(in_f)
0108         {}
0109 
0110         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0111         first_type first() const { return fusion::begin(seq); }
0112         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0113         last_type last() const { return fusion::end(seq); }
0114         typename mpl::if_<traits::is_view<Sequence>, Sequence, Sequence&>::type seq;
0115         transform_type f;
0116     };
0117 }}
0118 
0119 #ifdef _MSC_VER
0120 #  pragma warning(pop)
0121 #endif
0122 
0123 #endif
0124 
0125