File indexing completed on 2025-01-18 09:34:41
0001
0002
0003
0004
0005
0006
0007 #if !defined(FUSION_FUSION_ITERATOR_10012005_1551)
0008 #define FUSION_FUSION_ITERATOR_10012005_1551
0009
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/fusion/iterator/value_of.hpp>
0012 #include <boost/fusion/iterator/next.hpp>
0013 #include <boost/fusion/iterator/prior.hpp>
0014 #include <boost/fusion/iterator/advance.hpp>
0015 #include <boost/fusion/iterator/distance.hpp>
0016 #include <boost/fusion/support/category_of.hpp>
0017 #include <boost/mpl/next_prior.hpp>
0018 #include <boost/mpl/advance_fwd.hpp>
0019 #include <boost/mpl/distance_fwd.hpp>
0020 #include <boost/mpl/iterator_tags.hpp>
0021 #include <boost/mpl/eval_if.hpp>
0022 #include <boost/type_traits/is_base_of.hpp>
0023
0024 namespace boost { namespace fusion { namespace detail
0025 {
0026
0027 template<class Category>
0028 struct to_mpl_category {
0029 typedef typename mpl::eval_if<
0030 is_base_of<random_access_traversal_tag, Category>,
0031 mpl::random_access_iterator_tag,
0032 mpl::eval_if<
0033 is_base_of<bidirectional_traversal_tag, Category>,
0034 mpl::bidirectional_iterator_tag,
0035 mpl::forward_iterator_tag
0036 >
0037 >::type type;
0038 };
0039
0040 }}}
0041
0042 namespace boost { namespace mpl
0043 {
0044 template <typename Iterator>
0045 struct fusion_iterator
0046 {
0047 typedef typename fusion::result_of::value_of<Iterator>::type type;
0048 typedef typename fusion::traits::category_of<Iterator>::type fusion_category;
0049 typedef typename fusion::detail::to_mpl_category<fusion_category>::type category;
0050 typedef Iterator iterator;
0051 };
0052
0053 template <typename Iterator>
0054 struct next<fusion_iterator<Iterator> >
0055 {
0056 typedef fusion_iterator<typename fusion::result_of::next<Iterator>::type> type;
0057 };
0058
0059 template <typename Iterator>
0060 struct prior<fusion_iterator<Iterator> >
0061 {
0062 typedef fusion_iterator<typename fusion::result_of::prior<Iterator>::type> type;
0063 };
0064
0065 template <typename Iterator, typename N>
0066 struct advance<fusion_iterator<Iterator>, N>
0067 {
0068 typedef fusion_iterator<typename fusion::result_of::advance<Iterator, N>::type> type;
0069 };
0070
0071 template <typename First, typename Last>
0072 struct distance<fusion_iterator<First>, fusion_iterator<Last> >
0073 : fusion::result_of::distance<First, Last>
0074 {};
0075
0076 }}
0077
0078 #endif
0079
0080