File indexing completed on 2025-01-18 09:34:41
0001
0002
0003
0004
0005
0006
0007 #if !defined(BOOST_FUSION_SEGMENTED_ITERATOR_SEGMENTED_ITERATOR_HPP_INCLUDED)
0008 #define BOOST_FUSION_SEGMENTED_ITERATOR_SEGMENTED_ITERATOR_HPP_INCLUDED
0009
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/mpl/bool.hpp>
0012 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
0013 #include <boost/fusion/iterator/iterator_facade.hpp>
0014 #include <boost/fusion/iterator/deref.hpp>
0015 #include <boost/fusion/iterator/deref_data.hpp>
0016 #include <boost/fusion/iterator/key_of.hpp>
0017 #include <boost/fusion/iterator/value_of.hpp>
0018 #include <boost/fusion/iterator/value_of_data.hpp>
0019 #include <boost/fusion/iterator/detail/segmented_equal_to.hpp>
0020
0021 namespace boost { namespace fusion
0022 {
0023 struct nil_;
0024
0025 namespace detail
0026 {
0027 template <typename Stack>
0028 struct segmented_next_impl;
0029 }
0030
0031
0032
0033
0034 template <typename Context>
0035 struct segmented_iterator
0036 : iterator_facade<segmented_iterator<Context>, forward_traversal_tag>
0037 {
0038 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED explicit segmented_iterator(Context const& ctx)
0039 : context(ctx)
0040 {}
0041
0042
0043
0044
0045
0046 template <typename It>
0047 struct deref
0048 {
0049 typedef
0050 typename result_of::deref<
0051 typename It::context_type::car_type::begin_type
0052 >::type
0053 type;
0054
0055 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0056 static type call(It const& it)
0057 {
0058 return *it.context.car.first;
0059 }
0060 };
0061
0062
0063
0064
0065
0066 template <typename It>
0067 struct deref_data
0068 {
0069 typedef
0070 typename result_of::deref_data<
0071 typename It::context_type::car_type::begin_type
0072 >::type
0073 type;
0074
0075 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0076 static type call(It const& it)
0077 {
0078 return fusion::deref_data(it.context.car.first);
0079 }
0080 };
0081
0082
0083
0084
0085
0086 template <typename It>
0087 struct key_of
0088 : result_of::key_of<typename It::context_type::car_type::begin_type>
0089 {};
0090
0091
0092
0093
0094
0095 template <typename It>
0096 struct value_of
0097 : result_of::value_of<typename It::context_type::car_type::begin_type>
0098 {};
0099
0100
0101
0102
0103
0104 template <typename It>
0105 struct value_of_data
0106 : result_of::value_of_data<typename It::context_type::car_type::begin_type>
0107 {};
0108
0109
0110
0111 template <
0112 typename It1
0113 , typename It2
0114 , int Size1 = It1::context_type::size::value
0115 , int Size2 = It2::context_type::size::value
0116 >
0117 struct equal_to
0118 : mpl::false_
0119 {};
0120
0121 template <typename It1, typename It2, int Size>
0122 struct equal_to<It1, It2, Size, Size>
0123 : detail::segmented_equal_to<
0124 typename It1::context_type
0125 , typename It2::context_type
0126 >
0127 {};
0128
0129 template <typename It>
0130 struct next
0131 {
0132 typedef detail::segmented_next_impl<typename It::context_type> impl;
0133 typedef segmented_iterator<typename impl::type> type;
0134
0135 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0136 static type call(It const& it)
0137 {
0138 return type(impl::call(it.context));
0139 }
0140 };
0141
0142 typedef Context context_type;
0143 context_type context;
0144 };
0145
0146 }}
0147
0148 #endif