Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _GLIBCXX_PARALLEL_ITERATOR_H
00033 #define _GLIBCXX_PARALLEL_ITERATOR_H 1
00034
00035 #include <parallel/basic_iterator.h>
00036 #include <bits/stl_pair.h>
00037
00038 namespace __gnu_parallel
00039 {
00040
00041
00042
00043 template<typename _Iterator1, typename _Iterator2,
00044 typename _IteratorCategory>
00045 class _IteratorPair : public std::pair<_Iterator1, _Iterator2>
00046 {
00047 private:
00048 typedef std::pair<_Iterator1, _Iterator2> _Base;
00049
00050 public:
00051 typedef _IteratorCategory iterator_category;
00052 typedef void value_type;
00053
00054 typedef std::iterator_traits<_Iterator1> _TraitsType;
00055 typedef typename _TraitsType::difference_type difference_type;
00056 typedef _IteratorPair* pointer;
00057 typedef _IteratorPair& reference;
00058
00059 _IteratorPair() { }
00060
00061 _IteratorPair(const _Iterator1& __first, const _Iterator2& __second)
00062 : _Base(__first, __second) { }
00063
00064
00065 _IteratorPair&
00066 operator++()
00067 {
00068 ++_Base::first;
00069 ++_Base::second;
00070 return *this;
00071 }
00072
00073
00074 const _IteratorPair
00075 operator++(int)
00076 { return _IteratorPair(_Base::first++, _Base::second++); }
00077
00078
00079 _IteratorPair&
00080 operator--()
00081 {
00082 --_Base::first;
00083 --_Base::second;
00084 return *this;
00085 }
00086
00087
00088 const _IteratorPair
00089 operator--(int)
00090 { return _IteratorPair(_Base::first--, _Base::second--); }
00091
00092
00093 operator _Iterator2() const
00094 { return _Base::second; }
00095
00096 _IteratorPair&
00097 operator=(const _IteratorPair& __other)
00098 {
00099 _Base::first = __other.first;
00100 _Base::second = __other.second;
00101 return *this;
00102 }
00103
00104 _IteratorPair
00105 operator+(difference_type __delta) const
00106 { return _IteratorPair(_Base::first + __delta, _Base::second + __delta);
00107 }
00108
00109 difference_type
00110 operator-(const _IteratorPair& __other) const
00111 { return _Base::first - __other.first; }
00112 };
00113
00114
00115
00116
00117
00118 template<typename _Iterator1, typename _Iterator2, typename _Iterator3,
00119 typename _IteratorCategory>
00120 class _IteratorTriple
00121 {
00122 public:
00123 typedef _IteratorCategory iterator_category;
00124 typedef void value_type;
00125 typedef typename std::iterator_traits<_Iterator1>::difference_type
00126 difference_type;
00127 typedef _IteratorTriple* pointer;
00128 typedef _IteratorTriple& reference;
00129
00130 _Iterator1 _M_first;
00131 _Iterator2 _M_second;
00132 _Iterator3 _M_third;
00133
00134 _IteratorTriple() { }
00135
00136 _IteratorTriple(const _Iterator1& __first, const _Iterator2& __second,
00137 const _Iterator3& __third)
00138 {
00139 _M_first = __first;
00140 _M_second = __second;
00141 _M_third = __third;
00142 }
00143
00144
00145 _IteratorTriple&
00146 operator++()
00147 {
00148 ++_M_first;
00149 ++_M_second;
00150 ++_M_third;
00151 return *this;
00152 }
00153
00154
00155 const _IteratorTriple
00156 operator++(int)
00157 { return _IteratorTriple(_M_first++, _M_second++, _M_third++); }
00158
00159
00160 _IteratorTriple&
00161 operator--()
00162 {
00163 --_M_first;
00164 --_M_second;
00165 --_M_third;
00166 return *this;
00167 }
00168
00169
00170 const _IteratorTriple
00171 operator--(int)
00172 { return _IteratorTriple(_M_first--, _M_second--, _M_third--); }
00173
00174
00175 operator _Iterator3() const
00176 { return _M_third; }
00177
00178 _IteratorTriple&
00179 operator=(const _IteratorTriple& __other)
00180 {
00181 _M_first = __other._M_first;
00182 _M_second = __other._M_second;
00183 _M_third = __other._M_third;
00184 return *this;
00185 }
00186
00187 _IteratorTriple
00188 operator+(difference_type __delta) const
00189 { return _IteratorTriple(_M_first + __delta, _M_second + __delta,
00190 _M_third + __delta); }
00191
00192 difference_type
00193 operator-(const _IteratorTriple& __other) const
00194 { return _M_first - __other._M_first; }
00195 };
00196 }
00197
00198 #endif