3 #ifndef DUNE_ITERATORFACADES_HH 4 #define DUNE_ITERATORFACADES_HH 137 template<
class T,
class V,
class R = V&,
class D = std::ptrdiff_t>
139 public std::iterator< std::forward_iterator_tag,
140 typename std::remove_const<V>::type,
196 return static_cast<DerivedType const*
>(
this)->dereference();
201 return &(
static_cast<const DerivedType *
>(
this)->dereference());
207 static_cast<DerivedType *
>(
this)->increment();
208 return *
static_cast<DerivedType *
>(
this);
214 DerivedType tmp(static_cast<DerivedType const&>(*
this));
230 template<
class T1,
class V1,
class R1,
class D,
231 class T2,
class V2,
class R2>
236 if(std::is_convertible<T2,T1>::value)
237 return static_cast<const T1&
>(lhs).
equals(static_cast<const T2&>(rhs));
239 return static_cast<const T2&
>(rhs).
equals(static_cast<const T1&>(lhs));
252 template<
class T1,
class V1,
class R1,
class D,
253 class T2,
class V2,
class R2>
258 if(std::is_convertible<T2,T1>::value)
259 return !
static_cast<const T1&
>(lhs).
equals(static_cast<const T2&>(rhs));
261 return !
static_cast<const T2&
>(rhs).
equals(static_cast<const T1&>(lhs));
268 template<
class T,
class V,
class R = V&,
class D = std::ptrdiff_t>
270 public std::iterator< std::bidirectional_iterator_tag,
271 typename std::remove_const<V>::type,
328 return static_cast<DerivedType const*
>(
this)->dereference();
333 return &(
static_cast<const DerivedType *
>(
this)->dereference());
339 static_cast<DerivedType *
>(
this)->increment();
340 return *
static_cast<DerivedType *
>(
this);
346 DerivedType tmp(static_cast<DerivedType const&>(*
this));
355 static_cast<DerivedType *
>(
this)->decrement();
356 return *
static_cast<DerivedType *
>(
this);
362 DerivedType tmp(static_cast<DerivedType const&>(*
this));
375 template<
class T1,
class V1,
class R1,
class D,
376 class T2,
class V2,
class R2>
377 inline typename std::enable_if<std::is_convertible<T2,T1>::value,
bool>::type
381 return static_cast<const T1&
>(lhs).
equals(static_cast<const T2&>(rhs));
392 template<
class T1,
class V1,
class R1,
class D,
393 class T2,
class V2,
class R2>
395 typename std::enable_if<std::is_convertible<T1,T2>::value && !std::is_convertible<T2,T1>::value,
400 return static_cast<const T2&
>(rhs).
equals(static_cast<const T1&>(lhs));
413 template<
class T1,
class V1,
class R1,
class D,
414 class T2,
class V2,
class R2>
419 return !(lhs == rhs);
426 template<
class T,
class V,
class R = V&,
class D = std::ptrdiff_t>
428 public std::iterator< std::random_access_iterator_tag,
429 typename std::remove_const<V>::type,
494 return static_cast<DerivedType const*
>(
this)->dereference();
499 return &(
static_cast<const DerivedType *
>(
this)->dereference());
509 return static_cast<const DerivedType *
>(
this)->
elementAt(n);
515 static_cast<DerivedType *
>(
this)->increment();
516 return *
static_cast<DerivedType *
>(
this);
522 DerivedType tmp(static_cast<DerivedType const&>(*
this));
529 static_cast<DerivedType *
>(
this)->advance(n);
530 return *
static_cast<DerivedType *
>(
this);
535 DerivedType tmp(static_cast<DerivedType const&>(*
this));
544 static_cast<DerivedType *
>(
this)->decrement();
545 return *
static_cast<DerivedType *
>(
this);
551 DerivedType tmp(static_cast<DerivedType const&>(*
this));
558 static_cast<DerivedType *
>(
this)->advance(-n);
559 return *
static_cast<DerivedType *
>(
this);
564 DerivedType tmp(static_cast<DerivedType const&>(*
this));
582 template<
class T1,
class V1,
class R1,
class D,
583 class T2,
class V2,
class R2>
588 if(std::is_convertible<T2,T1>::value)
589 return static_cast<const T1&
>(lhs).
equals(static_cast<const T2&>(rhs));
591 return static_cast<const T2&
>(rhs).
equals(static_cast<const T1&>(lhs));
604 template<
class T1,
class V1,
class R1,
class D,
605 class T2,
class V2,
class R2>
610 if(std::is_convertible<T2,T1>::value)
611 return !
static_cast<const T1&
>(lhs).
equals(static_cast<const T2&>(rhs));
613 return !
static_cast<const T2&
>(rhs).
equals(static_cast<const T1&>(lhs));
626 template<
class T1,
class V1,
class R1,
class D,
627 class T2,
class V2,
class R2>
629 operator<(const RandomAccessIteratorFacade<T1,V1,R1,D>& lhs,
632 if(std::is_convertible<T2,T1>::value)
633 return static_cast<const T1&
>(lhs).distanceTo(static_cast<const T2&>(rhs))>0;
635 return static_cast<const T2&
>(rhs).distanceTo(static_cast<const T1&>(lhs))<0;
649 template<
class T1,
class V1,
class R1,
class D,
650 class T2,
class V2,
class R2>
652 operator<=(const RandomAccessIteratorFacade<T1,V1,R1,D>& lhs,
655 if(std::is_convertible<T2,T1>::value)
656 return static_cast<const T1&
>(lhs).distanceTo(static_cast<const T2&>(rhs))>=0;
658 return static_cast<const T2&
>(rhs).distanceTo(static_cast<const T1&>(lhs))<=0;
672 template<
class T1,
class V1,
class R1,
class D,
673 class T2,
class V2,
class R2>
678 if(std::is_convertible<T2,T1>::value)
679 return static_cast<const T1&
>(lhs).distanceTo(static_cast<const T2&>(rhs))<0;
681 return static_cast<const T2&
>(rhs).distanceTo(static_cast<const T1&>(lhs))>0;
694 template<
class T1,
class V1,
class R1,
class D,
695 class T2,
class V2,
class R2>
700 if(std::is_convertible<T2,T1>::value)
701 return static_cast<const T1&
>(lhs).distanceTo(static_cast<const T2&>(rhs))<=0;
703 return static_cast<const T2&
>(rhs).distanceTo(static_cast<const T1&>(lhs))>=0;
716 template<
class T1,
class V1,
class R1,
class D,
717 class T2,
class V2,
class R2>
722 if(std::is_convertible<T2,T1>::value)
723 return -
static_cast<const T1&
>(lhs).distanceTo(static_cast<const T2&>(rhs));
725 return static_cast<const T2&
>(rhs).distanceTo(static_cast<const T1&>(lhs));
Reference operator*() const
Dereferencing operator.
Definition: iteratorfacades.hh:326
EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for equality.
Definition: iteratorfacades.hh:233
V * Pointer
The pointer to the Value.
Definition: iteratorfacades.hh:313
DerivedType & operator++()
Preincrement operator.
Definition: iteratorfacades.hh:205
DerivedType & operator--()
Preincrement operator.
Definition: iteratorfacades.hh:353
EnableIfInterOperable< T1, T2, bool >::type operator>=(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition: iteratorfacades.hh:697
DerivedType & operator++()
Preincrement operator.
Definition: iteratorfacades.hh:513
bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y)
Definition: bigunsignedint.hh:520
Facade class for stl conformant bidirectional iterators.
Definition: iteratorfacades.hh:269
DerivedType & operator++()
Preincrement operator.
Definition: iteratorfacades.hh:337
Reference operator*() const
Dereferencing operator.
Definition: iteratorfacades.hh:194
DerivedType & operator--()
Predecrement operator.
Definition: iteratorfacades.hh:542
T DerivedType
The type of derived iterator.
Definition: iteratorfacades.hh:171
D DifferenceType
The type of the difference between two positions.
Definition: iteratorfacades.hh:484
DerivedType operator++(int)
Postincrement operator.
Definition: iteratorfacades.hh:344
void advance(difference_type n)
Definition: arraylist.hh:579
DerivedType operator++(int)
Postincrement operator.
Definition: iteratorfacades.hh:212
V Value
The type of value accessed through the iterator.
Definition: iteratorfacades.hh:308
V * Pointer
The pointer to the Value.
Definition: iteratorfacades.hh:181
R Reference
The type of the reference to the values accessed.
Definition: iteratorfacades.hh:191
Dune namespace.
Definition: alignment.hh:10
Pointer operator->() const
Definition: iteratorfacades.hh:199
DerivedType operator++(int)
Postincrement operator.
Definition: iteratorfacades.hh:520
Traits for type conversions and type information.
V Value
The type of value accessed through the iterator.
Definition: iteratorfacades.hh:474
R Reference
The type of the reference to the values accessed.
Definition: iteratorfacades.hh:323
T DerivedType
The type of derived iterator.
Definition: iteratorfacades.hh:469
V * Pointer
The pointer to the Value.
Definition: iteratorfacades.hh:479
Base class for stl conformant forward iterators.
Definition: iteratorfacades.hh:138
Enable typedef if two types are interoperable.
Definition: typetraits.hh:174
decltype(auto) constexpr elementAt(Container &&c, Index &&, PriorityTag< 2 >)
Definition: hybridutilities.hh:96
Base class for stl conformant forward iterators.
Definition: iteratorfacades.hh:427
R Reference
The type of the reference to the values accessed.
Definition: iteratorfacades.hh:489
Pointer operator->() const
Definition: iteratorfacades.hh:497
EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for inequality.
Definition: iteratorfacades.hh:255
Reference operator[](DifferenceType n) const
Get the element n positions from the current one.
Definition: iteratorfacades.hh:507
DerivedType operator+(DifferenceType n) const
Definition: iteratorfacades.hh:533
DerivedType operator--(int)
Postdecrement operator.
Definition: iteratorfacades.hh:549
DerivedType operator-(DifferenceType n) const
Definition: iteratorfacades.hh:562
T DerivedType
The type of derived iterator.
Definition: iteratorfacades.hh:303
Reference operator*() const
Dereferencing operator.
Definition: iteratorfacades.hh:492
DerivedType & operator-=(DifferenceType n)
Definition: iteratorfacades.hh:556
V Value
The type of value accessed through the iterator.
Definition: iteratorfacades.hh:176
DerivedType operator--(int)
Postincrement operator.
Definition: iteratorfacades.hh:360
D DifferenceType
The type of the difference between two positions.
Definition: iteratorfacades.hh:318
DerivedType & operator+=(DifferenceType n)
Definition: iteratorfacades.hh:527
EnableIfInterOperable< T1, T2, bool >::type operator>(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition: iteratorfacades.hh:675
constexpr auto equals(const T1 &t1, const T2 &t2, PriorityTag< 1 >) -> decltype(T1::value, T2::value, std::integral_constant< bool, T1::value==T2::value >())
Definition: hybridutilities.hh:418
Pointer operator->() const
Definition: iteratorfacades.hh:331
D DifferenceType
The type of the difference between two positions.
Definition: iteratorfacades.hh:186