5 #ifndef BALL_CONCEPT_RANDOMACCESSITERATOR_H
6 #define BALL_CONCEPT_RANDOMACCESSITERATOR_H
12 #ifndef BALL_CONCEPT_BIDIRECTIONALITERATOR_H
23 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
190 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
191 ConstRandomAccessIterator<Container, DataType, Position, Traits>
operator +
195 return (tmp_iterator += distance);
203 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
204 Distance ConstRandomAccessIterator<Container, DataType, Position, Traits>::operator -
205 (
const ConstRandomAccessIterator<Container, DataType, Position, Traits>& b)
const
207 if (!Base::getTraits().isValid())
209 throw Exception::InvalidIterator(__FILE__, __LINE__);
211 if (!b.getTraits().isValid())
213 throw Exception::InvalidIterator(__FILE__, __LINE__);
215 if (Base::getTraits().getContainer() != b.getTraits().getContainer())
217 throw Exception::IncompatibleIterators(__FILE__, __LINE__);
219 return Base::getTraits().getDistance(b.getTraits());
222 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
223 ConstRandomAccessIterator<Container, DataType, Position, Traits>&
226 if (!Base::getTraits().isValid())
232 return (*
this -= -distance);
234 Base::getTraits().forward(distance);
238 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
242 if (Base::getTraits().isSingular())
248 return (*
this += -distance);
250 if (Base::getTraits().isEnd() ==
true)
252 Base::getTraits().toRBegin();
253 Base::getTraits().backward(distance - 1);
257 Base::getTraits().backward(distance);
262 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
267 return (iterator += distance);
270 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
275 return (iterator -= distance);
278 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
282 if (!Base::getTraits().isValid())
286 if (!iterator.isValid())
290 if (Base::getTraits().getContainer() != iterator.getContainer())
295 return (Base::getTraits().
operator < (iterator.getTraits()));
298 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
302 if (!Base::getTraits().isValid())
306 if (!iterator.isValid())
310 if (Base::getTraits().getContainer() != iterator.getContainer())
314 return !(Base::getTraits().operator > (iterator.getTraits()));
317 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
321 if (!Base::getTraits().isValid())
325 if (!iterator.isValid())
329 if (Base::getTraits().getContainer() != iterator.getContainer())
334 return !(Base::getTraits().operator < (iterator.getTraits()));
337 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
341 if (!Base::getTraits().isValid())
345 if (!iterator.isValid())
349 if (Base::getTraits().getContainer() != iterator.getContainer())
354 return (Base::getTraits().
operator > (iterator.getTraits()));
358 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
361 if (!Base::getTraits().isValid())
366 return Base::getTraits().getData(index);
369 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
378 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
387 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
396 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
412 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
497 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
498 RandomAccessIterator<Container, DataType, Position, Traits>
506 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
515 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
524 template <
typename Container,
typename DataType,
typename Position,
typename Traits>
535 #endif // BALL_CONCEPT_RANDOMACCESSITERATOR_H