File indexing completed on 2025-01-18 09:34:41
0001
0002
0003
0004
0005
0006
0007 #if !defined(FUSION_ITERATOR_ADAPTER_08112011_0942)
0008 #define FUSION_ITERATOR_ADAPTER_08112011_0942
0009
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/fusion/support/category_of.hpp>
0012 #include <boost/fusion/iterator/advance.hpp>
0013 #include <boost/fusion/iterator/deref.hpp>
0014 #include <boost/fusion/iterator/distance.hpp>
0015 #include <boost/fusion/iterator/equal_to.hpp>
0016 #include <boost/fusion/iterator/iterator_facade.hpp>
0017 #include <boost/fusion/iterator/next.hpp>
0018 #include <boost/fusion/iterator/prior.hpp>
0019 #include <boost/fusion/iterator/value_of.hpp>
0020 #include <boost/type_traits/remove_const.hpp>
0021
0022 #ifdef _MSC_VER
0023 # pragma warning(push)
0024 # pragma warning(disable: 4512)
0025 #endif
0026
0027 namespace boost { namespace fusion
0028 {
0029 template <typename Derived_, typename Iterator_,
0030 typename Category = typename traits::category_of<Iterator_>::type>
0031 struct iterator_adapter
0032 : iterator_facade<Derived_, Category>
0033 {
0034 typedef typename
0035 remove_const<Iterator_>::type
0036 iterator_base_type;
0037 iterator_base_type iterator_base;
0038
0039 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0040 iterator_adapter(iterator_base_type const& iterator_base_)
0041 : iterator_base(iterator_base_) {}
0042
0043
0044 template <typename I1, typename I2>
0045 struct equal_to
0046 : result_of::equal_to<
0047 typename I1::iterator_base_type
0048 , typename I2::iterator_base_type
0049 >
0050 {};
0051
0052
0053 template <typename Iterator, typename N>
0054 struct advance
0055 {
0056 typedef typename Derived_::template make<
0057 typename result_of::advance<
0058 typename Iterator::iterator_base_type, N
0059 >::type>::type
0060 type;
0061
0062 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0063 static type
0064 call(Iterator const& it)
0065 {
0066 return type(fusion::advance<N>(it.iterator_base));
0067 }
0068 };
0069
0070
0071 template <typename First, typename Last>
0072 struct distance
0073 : result_of::distance<
0074 typename First::iterator_base_type
0075 , typename Last::iterator_base_type
0076 >
0077 {};
0078
0079
0080 template <typename Iterator>
0081 struct value_of
0082 : result_of::value_of<
0083 typename Iterator::iterator_base_type
0084 >
0085 {};
0086
0087
0088 template <typename Iterator>
0089 struct deref
0090 {
0091 typedef typename
0092 result_of::deref<
0093 typename Iterator::iterator_base_type
0094 >::type
0095 type;
0096
0097 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0098 static type
0099 call(Iterator const& it)
0100 {
0101 return fusion::deref(it.iterator_base);
0102 }
0103 };
0104
0105
0106 template <typename Iterator>
0107 struct next
0108 {
0109 typedef typename Derived_::template make<
0110 typename result_of::next<
0111 typename Iterator::iterator_base_type
0112 >::type>::type
0113 type;
0114
0115 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0116 static type
0117 call(Iterator const& i)
0118 {
0119 return type(fusion::next(i.iterator_base));
0120 }
0121 };
0122
0123
0124 template <typename Iterator>
0125 struct prior
0126 {
0127 typedef typename Derived_::template make<
0128 typename result_of::prior<
0129 typename Iterator::iterator_base_type
0130 >::type>::type
0131 type;
0132
0133 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0134 static type
0135 call(Iterator const& i)
0136 {
0137 return type(fusion::prior(i.iterator_base));
0138 }
0139 };
0140 };
0141 }}
0142
0143 #ifdef _MSC_VER
0144 # pragma warning(pop)
0145 #endif
0146
0147 #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
0148 namespace std
0149 {
0150 template <typename Derived, typename Iterator, typename Category>
0151 struct iterator_traits< ::boost::fusion::iterator_adapter<Derived, Iterator, Category> >
0152 { };
0153 }
0154 #endif
0155
0156 #endif