Warning, file /include/boost/fusion/view/zip_view/zip_view.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008 #if !defined(FUSION_ZIP_VIEW_23012006_0813)
0009 #define FUSION_ZIP_VIEW_23012006_0813
0010
0011 #include <boost/fusion/support/config.hpp>
0012 #include <boost/fusion/support/sequence_base.hpp>
0013 #include <boost/fusion/support/unused.hpp>
0014 #include <boost/fusion/iterator/equal_to.hpp>
0015 #include <boost/fusion/view/detail/strictest_traversal.hpp>
0016 #include <boost/fusion/view/zip_view/detail/begin_impl.hpp>
0017 #include <boost/fusion/view/zip_view/detail/end_impl.hpp>
0018 #include <boost/fusion/view/zip_view/detail/size_impl.hpp>
0019 #include <boost/fusion/view/zip_view/detail/at_impl.hpp>
0020 #include <boost/fusion/view/zip_view/detail/value_at_impl.hpp>
0021 #include <boost/fusion/container/vector/convert.hpp>
0022 #include <boost/fusion/algorithm/query/find_if.hpp>
0023 #include <boost/fusion/sequence/intrinsic/end.hpp>
0024 #include <boost/fusion/sequence/intrinsic/size.hpp>
0025 #include <boost/fusion/mpl.hpp>
0026 #include <boost/fusion/algorithm/transformation/remove.hpp>
0027
0028 #include <boost/mpl/assert.hpp>
0029 #include <boost/mpl/not.hpp>
0030 #include <boost/mpl/placeholders.hpp>
0031 #include <boost/mpl/transform_view.hpp>
0032 #include <boost/mpl/at.hpp>
0033 #include <boost/mpl/find_if.hpp>
0034 #include <boost/mpl/equal_to.hpp>
0035 #include <boost/mpl/bool.hpp>
0036 #include <boost/mpl/eval_if.hpp>
0037
0038 #include <boost/type_traits/remove_reference.hpp>
0039 #include <boost/type_traits/is_reference.hpp>
0040
0041 #include <boost/config.hpp>
0042
0043 namespace boost { namespace fusion {
0044
0045 namespace detail
0046 {
0047 template<typename Sequences>
0048 struct all_references
0049 : fusion::result_of::equal_to<typename fusion::result_of::find_if<Sequences, mpl::not_<is_reference<mpl::_> > >::type, typename fusion::result_of::end<Sequences>::type>
0050 {};
0051
0052 struct seq_ref_size
0053 {
0054 template<typename Params>
0055 struct result;
0056
0057 template<typename Seq>
0058 struct result<seq_ref_size(Seq)>
0059 {
0060 static int const high_int = static_cast<int>(
0061 (static_cast<unsigned>(~0) >> 1) - 1);
0062
0063 typedef typename remove_reference<Seq>::type SeqClass;
0064
0065 typedef typename mpl::eval_if<
0066 traits::is_forward<SeqClass>,
0067 result_of::size<SeqClass>,
0068 mpl::int_<high_int> >::type type;
0069 };
0070
0071
0072 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
0073 template<typename Seq>
0074 BOOST_FUSION_GPU_ENABLED
0075 typename result<seq_ref_size(Seq)>::type
0076 operator()(Seq&&) const;
0077 #endif
0078 };
0079
0080 struct poly_min
0081 {
0082 template<typename T>
0083 struct result;
0084
0085 template<typename Lhs, typename Rhs>
0086 struct result<poly_min(Lhs, Rhs)>
0087 {
0088 typedef typename remove_reference<Lhs>::type lhs;
0089 typedef typename remove_reference<Rhs>::type rhs;
0090 typedef typename mpl::min<lhs, rhs>::type type;
0091 };
0092
0093
0094 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
0095 template<typename Lhs, typename Rhs>
0096 BOOST_FUSION_GPU_ENABLED
0097 typename result<poly_min(Lhs, Rhs)>::type
0098 operator()(Lhs&&, Rhs&&) const;
0099 #endif
0100 };
0101
0102 template<typename Sequences>
0103 struct min_size
0104 {
0105 typedef typename result_of::transform<Sequences, detail::seq_ref_size>::type sizes;
0106 typedef typename result_of::fold<sizes, typename result_of::front<sizes>::type, detail::poly_min>::type type;
0107 };
0108 }
0109
0110 struct zip_view_tag;
0111 struct fusion_sequence_tag;
0112
0113 template<typename Sequences>
0114 struct zip_view : sequence_base< zip_view<Sequences> >
0115 {
0116 typedef typename result_of::remove<Sequences, unused_type const&>::type real_sequences;
0117 BOOST_MPL_ASSERT((detail::all_references<Sequences>));
0118 typedef typename detail::strictest_traversal<real_sequences>::type category;
0119 typedef zip_view_tag fusion_tag;
0120 typedef fusion_sequence_tag tag;
0121 typedef mpl::true_ is_view;
0122 typedef typename fusion::result_of::as_vector<Sequences>::type sequences;
0123 typedef typename detail::min_size<real_sequences>::type size;
0124
0125 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0126 zip_view(
0127 const Sequences& seqs)
0128 : sequences_(seqs)
0129 {}
0130
0131 sequences sequences_;
0132 };
0133 }}
0134
0135 #endif