File indexing completed on 2025-01-18 09:31:07
0001
0002
0003
0004
0005
0006
0007 #if !defined(FUSION_MPL_ITERATOR_05052005_0731)
0008 #define FUSION_MPL_ITERATOR_05052005_0731
0009
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/fusion/support/detail/mpl_iterator_category.hpp>
0012 #include <boost/fusion/iterator/iterator_facade.hpp>
0013 #include <boost/type_traits/remove_const.hpp>
0014 #include <boost/mpl/deref.hpp>
0015 #include <boost/mpl/next.hpp>
0016 #include <boost/mpl/prior.hpp>
0017 #include <boost/mpl/advance.hpp>
0018 #include <boost/mpl/distance.hpp>
0019
0020 namespace boost { namespace fusion
0021 {
0022 template <typename Iterator_>
0023 struct mpl_iterator
0024 : iterator_facade<
0025 mpl_iterator<Iterator_>
0026 , typename detail::mpl_iterator_category<typename Iterator_::category>::type
0027 >
0028 {
0029 typedef typename remove_const<Iterator_>::type iterator_type;
0030
0031 template <typename Iterator>
0032 struct value_of : mpl::deref<typename Iterator::iterator_type> {};
0033
0034 template <typename Iterator>
0035 struct deref
0036 {
0037 typedef typename mpl::deref<
0038 typename Iterator::iterator_type>::type
0039 type;
0040
0041 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0042 static type
0043 call(Iterator)
0044 {
0045 return type();
0046 }
0047 };
0048
0049 template <typename Iterator>
0050 struct next
0051 {
0052 typedef mpl_iterator<
0053 typename mpl::next<typename Iterator::iterator_type>::type>
0054 type;
0055
0056 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0057 static type
0058 call(Iterator)
0059 {
0060 return type();
0061 }
0062 };
0063
0064 template <typename Iterator>
0065 struct prior
0066 {
0067 typedef mpl_iterator<
0068 typename mpl::prior<typename Iterator::iterator_type>::type>
0069 type;
0070
0071 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0072 static type
0073 call(Iterator)
0074 {
0075 return type();
0076 }
0077 };
0078
0079 template <typename Iterator, typename N>
0080 struct advance
0081 {
0082 typedef mpl_iterator<
0083 typename mpl::advance<typename Iterator::iterator_type, N>::type>
0084 type;
0085
0086 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0087 static type
0088 call(Iterator const& )
0089 {
0090 return type();
0091 }
0092 };
0093
0094 template <typename I1, typename I2>
0095 struct distance :
0096 mpl::distance<
0097 typename I1::iterator_type
0098 , typename I2::iterator_type>
0099 {
0100 typedef typename
0101 mpl::distance<
0102 typename I1::iterator_type
0103 , typename I2::iterator_type
0104 >::type
0105 type;
0106
0107 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0108 static type
0109 call(I1 const&, I2 const&)
0110 {
0111 return type();
0112 }
0113 };
0114 };
0115 }}
0116
0117 #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
0118 namespace std
0119 {
0120 template <typename Iterator>
0121 struct iterator_traits< ::boost::fusion::mpl_iterator<Iterator> >
0122 { };
0123 }
0124 #endif
0125
0126 #endif
0127
0128