File indexing completed on 2025-01-31 09:41:56
0001
0002
0003
0004
0005
0006
0007
0008 #if !defined(FUSION_BEGIN_IMPL_20060123_2147)
0009 #define FUSION_BEGIN_IMPL_20060123_2147
0010
0011 #include <boost/fusion/support/config.hpp>
0012 #include <boost/fusion/sequence/intrinsic/begin.hpp>
0013 #include <boost/fusion/view/zip_view/zip_view_iterator_fwd.hpp>
0014 #include <boost/fusion/algorithm/transformation/transform.hpp>
0015 #include <boost/type_traits/remove_reference.hpp>
0016 #include <boost/type_traits/is_reference.hpp>
0017 #include <boost/type_traits/is_same.hpp>
0018 #include <boost/mpl/assert.hpp>
0019 #include <boost/mpl/eval_if.hpp>
0020 #include <boost/mpl/identity.hpp>
0021 #include <boost/fusion/support/unused.hpp>
0022
0023 namespace boost { namespace fusion {
0024
0025 struct zip_view_tag;
0026
0027 namespace detail
0028 {
0029 struct poly_begin
0030 {
0031 template<typename T>
0032 struct result;
0033
0034 template<typename SeqRef>
0035 struct result<poly_begin(SeqRef)>
0036 : mpl::eval_if<is_same<SeqRef, unused_type const&>,
0037 mpl::identity<unused_type>,
0038 result_of::begin<typename remove_reference<SeqRef>::type> >
0039 {
0040 BOOST_MPL_ASSERT((is_reference<SeqRef>));
0041 };
0042
0043 template<typename Seq>
0044 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0045 typename result<poly_begin(Seq&)>::type
0046 operator()(Seq& seq) const
0047 {
0048 return fusion::begin(seq);
0049 }
0050
0051 template<typename Seq>
0052 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0053 typename result<poly_begin(Seq const&)>::type
0054 operator()(Seq const& seq) const
0055 {
0056 return fusion::begin(seq);
0057 }
0058
0059 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0060 unused_type operator()(unused_type const&) const
0061 {
0062 return unused_type();
0063 }
0064 };
0065 }
0066
0067 namespace extension
0068 {
0069 template<typename Tag>
0070 struct begin_impl;
0071
0072 template<>
0073 struct begin_impl<zip_view_tag>
0074 {
0075 template<typename Sequence>
0076 struct apply
0077 {
0078 typedef zip_view_iterator<
0079 typename result_of::transform<typename Sequence::sequences, detail::poly_begin>::type,
0080 typename Sequence::category> type;
0081
0082 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0083 static type
0084 call(Sequence& sequence)
0085 {
0086 return type(
0087 fusion::transform(sequence.sequences_, detail::poly_begin()));
0088 }
0089 };
0090
0091
0092
0093 };
0094 }
0095 }}
0096
0097 #endif