MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / const_iterator

Class const_iterator

inst/include/Rcpp/vector/MatrixRow.h:222–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220 typedef typename MATRIX::value_type value_type ;
221
222 class const_iterator {
223 public:
224 typedef typename traits::r_vector_iterator<RTYPE>::type vector_iterator ;
225
226 typedef int difference_type ;
227 typedef typename traits::r_vector_const_proxy<RTYPE>::type value_type ;
228 typedef typename traits::r_vector_const_proxy<RTYPE>::type reference ;
229 typedef typename std::iterator_traits<vector_iterator>::pointer pointer ;
230
231 typedef std::random_access_iterator_tag iterator_category ;
232
233 const_iterator( const const_iterator& other) : row(other.row), index(other.index){}
234 const_iterator( const ConstMatrixRow& row_, int index_ ) : row(row_), index(index_){}
235
236 const_iterator& operator++(){
237 index++;
238 return *this ;
239 }
240 const_iterator operator++(int) {
241 const_iterator orig(*this);
242 index++ ;
243 return orig ;
244 }
245
246 const_iterator& operator--(){
247 index-- ;
248 return *this ;
249 }
250 const_iterator operator--(int){
251 const_iterator orig(*this);
252 index-- ;
253 return orig ;
254 }
255
256 const_iterator operator+(difference_type n) const { return iterator( row, index + n ) ; }
257 const_iterator operator-(difference_type n) const { return iterator( row, index - n ) ; }
258 difference_type operator-(const const_iterator& other) const { return index - other.index ; }
259
260 const_iterator& operator+=(difference_type n) { index += n ; return *this ;}
261 const_iterator& operator-=(difference_type n) { index -= n ; return *this ;}
262
263 const reference operator*() {
264 return row[index] ;
265 }
266 const pointer operator->(){
267 return &row[index] ;
268 }
269
270 bool operator==( const const_iterator& other) { return index == other.index ; }
271 bool operator!=( const const_iterator& other) { return index != other.index ; }
272 bool operator<( const const_iterator& other ) { return index < other.index ;}
273 bool operator>( const const_iterator& other ) { return index > other.index ;}
274 bool operator<=( const const_iterator& other ) { return index <= other.index ; }
275 bool operator>=( const const_iterator& other ) { return index >= other.index ; }
276
277 inline const reference operator[]( int i) const {
278 return row[ index + i ] ;
279 }

Callers 12

beginMethod · 0.85
endMethod · 0.85
cbeginMethod · 0.85
cendMethod · 0.85
beginMethod · 0.85
endMethod · 0.85
beginMethod · 0.85
endMethod · 0.85
cbeginMethod · 0.85
cendMethod · 0.85
get_constMethod · 0.85
get_const_begin__implFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected