123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- #if !defined(BOOST_FUSION_SEGMENTED_ITERATOR_SEGMENTED_ITERATOR_HPP_INCLUDED)
- #define BOOST_FUSION_SEGMENTED_ITERATOR_SEGMENTED_ITERATOR_HPP_INCLUDED
- #include <boost/fusion/support/config.hpp>
- #include <boost/mpl/bool.hpp>
- #include <boost/fusion/sequence/intrinsic_fwd.hpp>
- #include <boost/fusion/iterator/iterator_facade.hpp>
- #include <boost/fusion/iterator/deref.hpp>
- #include <boost/fusion/iterator/deref_data.hpp>
- #include <boost/fusion/iterator/key_of.hpp>
- #include <boost/fusion/iterator/value_of.hpp>
- #include <boost/fusion/iterator/value_of_data.hpp>
- #include <boost/fusion/iterator/detail/segmented_equal_to.hpp>
- namespace boost { namespace fusion
- {
- struct nil_;
- namespace detail
- {
- template <typename Stack>
- struct segmented_next_impl;
- }
-
-
-
- template <typename Context>
- struct segmented_iterator
- : iterator_facade<segmented_iterator<Context>, forward_traversal_tag>
- {
- BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED explicit segmented_iterator(Context const& ctx)
- : context(ctx)
- {}
-
-
-
-
- template <typename It>
- struct deref
- {
- typedef
- typename result_of::deref<
- typename It::context_type::car_type::begin_type
- >::type
- type;
- BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
- static type call(It const& it)
- {
- return *it.context.car.first;
- }
- };
-
-
-
-
- template <typename It>
- struct deref_data
- {
- typedef
- typename result_of::deref_data<
- typename It::context_type::car_type::begin_type
- >::type
- type;
- BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
- static type call(It const& it)
- {
- return fusion::deref_data(it.context.car.first);
- }
- };
-
-
-
-
- template <typename It>
- struct key_of
- : result_of::key_of<typename It::context_type::car_type::begin_type>
- {};
-
-
-
-
- template <typename It>
- struct value_of
- : result_of::value_of<typename It::context_type::car_type::begin_type>
- {};
-
-
-
-
- template <typename It>
- struct value_of_data
- : result_of::value_of_data<typename It::context_type::car_type::begin_type>
- {};
-
-
- template <
- typename It1
- , typename It2
- , int Size1 = It1::context_type::size::value
- , int Size2 = It2::context_type::size::value
- >
- struct equal_to
- : mpl::false_
- {};
- template <typename It1, typename It2, int Size>
- struct equal_to<It1, It2, Size, Size>
- : detail::segmented_equal_to<
- typename It1::context_type
- , typename It2::context_type
- >
- {};
- template <typename It>
- struct next
- {
- typedef detail::segmented_next_impl<typename It::context_type> impl;
- typedef segmented_iterator<typename impl::type> type;
- BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
- static type call(It const& it)
- {
- return type(impl::call(it.context));
- }
- };
- typedef Context context_type;
- context_type context;
- };
- }}
- #endif
|