aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::ListIteratorSafe< Val > Class Template Reference

Safe iterators for Lists. More...

#include <agrum/base/core/list.h>

Inheritance diagram for gum::ListIteratorSafe< Val >:
Collaboration diagram for gum::ListIteratorSafe< Val >:

Public Types

using iterator_category = std::bidirectional_iterator_tag
 Types for STL compliance.
using value_type = Val
 Types for STL compliance.
using reference = Val&
 Types for STL compliance.
using const_reference = const Val&
 Types for STL compliance.
using pointer = Val*
 Types for STL compliance.
using const_pointer = const Val*
 Types for STL compliance.
using difference_type = std::ptrdiff_t
 Types for STL compliance.

Public Member Functions

Constructors / Destructors
 ListIteratorSafe () noexcept
 Default constructor.
 ListIteratorSafe (const List< Val > &theList)
 Constructor for a begin.
 ListIteratorSafe (const ListIteratorSafe< Val > &src)
 Copy constructor.
 ListIteratorSafe (const List< Val > &theList, Size ind_elt)
 Constructor for an iterator pointing to the ind_eltth element of a List.
 ListIteratorSafe (ListIteratorSafe< Val > &&src)
 Move constructor.
 ~ListIteratorSafe ()
 Class Desctructor.
Operators
ListIteratorSafe< Val > & operator= (const ListIteratorSafe< Val > &src)
 Copy operator.
ListIteratorSafe< Val > & operator= (ListIteratorSafe< Val > &&src)
 Move operator.
ListIteratorSafe< Val > & operator++ () noexcept
 Makes the iterator point to the next element in the List.
ListIteratorSafe< Val > & operator+= (difference_type i) noexcept
 Makes the iterator point to i elements further in the List.
ListIteratorSafe< Val > & operator-- () noexcept
 Makes the iterator point to the preceding element in the List.
ListIteratorSafe< Val > & operator-= (difference_type i) noexcept
 Makes the iterator point to i elements befor in the List.
ListIteratorSafe< Val > operator+ (difference_type i) noexcept
 Returns a new iterator pointing to i further elements in the gum::List.
ListIteratorSafe< Val > operator- (difference_type i) noexcept
 Returns a new iterator pointing to i preceding elements in the gum::List.
Val & operator* ()
 Gives access to the content of the iterator.
Val * operator-> ()
 Dereferences the value pointed to by the iterator.
bool operator!= (const ListIteratorSafe< Val > &src) const
 Checks whether two iterators point toward different elements.
bool operator== (const ListIteratorSafe< Val > &src) const
 Checks whether two iterators point toward the same elements.
const Val & operator* () const
 Gives access to the content of the iterator.
const Val * operator-> () const
 Dereferences the value pointed to by the iterator.
Accessors / Modifiers
void clear ()
 Makes the iterator point toward nothing.
void setToEnd ()
 Positions the iterator to the end of the list.
bool isEnd () const
 Returns a bool indicating whether the iterator points to the end of the list.
Operators
bool operator!= (const ListConstIteratorSafe< Val > &src) const
 Checks whether two iterators point toward different elements.
bool operator== (const ListConstIteratorSafe< Val > &src) const
 Checks whether two iterators point toward the same elements.

Private Member Functions

ListBucket< Val > * _getBucket_ () const noexcept
 Returns the bucket the iterator is pointing to.
void _removeFromSafeList_ () const
 Remove the iterator for its list' safe iterators list.
ListConstIteratorSafe< Val > & _opPlus_ (Size i) noexcept
 Makes the iterator point to the next element in the List.
ListConstIteratorSafe< Val > & _opMinus_ (Size i) noexcept
 Makes the iterator point to i elements before in the List.

Private Attributes

const List< Val > * _list_ {nullptr}
 The list the iterator is pointing to.
ListBucket< Val > * _bucket_ {nullptr}
 The bucket in the chained list pointed to by the iterator.
ListBucket< Val > * _next_current_bucket_ {nullptr}
 The bucket we should start from when we are pointing on a deleted bucket and we decide to do a ++.
ListBucket< Val > * _prev_current_bucket_ {nullptr}
 The bucket we should start from when we are pointing on a deleted bucket and we decide to do a –.
bool _null_pointing_ {false}
 Indicates whether the bucket the iterator points to has been deleted.

Detailed Description

template<typename Val>
class gum::ListIteratorSafe< Val >

Safe iterators for Lists.

Class ListIteratorSafe implements iterators for List. However, developers may consider using List<x>::iterator_safe instead of ListIteratorSafe<x>.

These iterators ensure that whenever they point to an element that is being deleted from memory, their accessing this element will never produce a segmentation fault but rather throw an exception. Similarly, incrementing or decrementing an iterator pointing to a deleted element is guaranteed to make the iterator point on the next (or preceding) element that has not been deleted. This enables safely writing code like:

for ( iter = mylist.beginSafe (); iter != mylist.endSafe (); ++iter )
list.erase ( iter );
Usage example:
// create a list of strings
list.pushBack ("toto"); list.pushBack ("titi");
// parse all the elements of a list
iter != list.endSafe(); ++iter)
cerr << *iter << endl;
iter != list.endSafe (); iter += 2 ) // step = 2
cerr << *iter << endl;
iter != list.endSafe (); iter = iter + 2 ) // step = 2
cerr << *iter << endl;
iter != list.rendSafe(); --iter)
cerr << *iter << endl;
// use member size() of the strings
iter != list.endSafe(); ++iter)
cerr << iter->size() << endl;
Generic doubly linked lists.
Definition list.h:379
const iterator_safe & endSafe() noexcept
Returns a safe iterator pointing to the end of the List.
Definition list_tpl.h:1288
iterator_safe rbeginSafe()
Returns a safe iterator pointing to the last element of the List.
Definition list_tpl.h:1379
const iterator_safe & rendSafe() noexcept
Returns a safe iterator pointing just before the beginning of the List.
Definition list_tpl.h:1318
ListIteratorSafe< Val > iterator_safe
Types for STL compliance.
Definition list.h:392
iterator_safe beginSafe()
Returns a safe iterator pointing to the beginning of the List.
Definition list_tpl.h:1348
Val & pushBack(const Val &val)
Inserts a new element (a copy) at the end of the chained list.
Definition list_tpl.h:1488
Template Parameters
ValThe gum::List values type.

Definition at line 2319 of file list.h.

Member Typedef Documentation

◆ const_pointer

template<typename Val>
using gum::ListIteratorSafe< Val >::const_pointer = const Val*

Types for STL compliance.

Definition at line 2328 of file list.h.

◆ const_reference

template<typename Val>
using gum::ListIteratorSafe< Val >::const_reference = const Val&

Types for STL compliance.

Definition at line 2326 of file list.h.

◆ difference_type

template<typename Val>
using gum::ListIteratorSafe< Val >::difference_type = std::ptrdiff_t

Types for STL compliance.

Definition at line 2329 of file list.h.

◆ iterator_category

template<typename Val>
using gum::ListIteratorSafe< Val >::iterator_category = std::bidirectional_iterator_tag

Types for STL compliance.

Definition at line 2323 of file list.h.

◆ pointer

template<typename Val>
using gum::ListIteratorSafe< Val >::pointer = Val*

Types for STL compliance.

Definition at line 2327 of file list.h.

◆ reference

template<typename Val>
using gum::ListIteratorSafe< Val >::reference = Val&

Types for STL compliance.

Definition at line 2325 of file list.h.

◆ value_type

template<typename Val>
using gum::ListIteratorSafe< Val >::value_type = Val

Types for STL compliance.

Definition at line 2324 of file list.h.

Constructor & Destructor Documentation

◆ ListIteratorSafe() [1/5]

template<typename Val>
INLINE gum::ListIteratorSafe< Val >::ListIteratorSafe ( )
explicitnoexcept

Default constructor.

Returns an iterator pointing toward nothing.

Definition at line 967 of file list_tpl.h.

969 }
Safe iterators for Lists.
Definition list.h:2319
ListIteratorSafe() noexcept
Default constructor.
Definition list_tpl.h:967

References gum::ListConstIteratorSafe< Val >::ListConstIteratorSafe(), and ListIteratorSafe().

Referenced by ListIteratorSafe(), ListIteratorSafe(), ListIteratorSafe(), ListIteratorSafe(), ~ListIteratorSafe(), operator!=(), operator+(), operator++(), operator-(), operator--(), operator-=(), operator=(), operator=(), and operator==().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListIteratorSafe() [2/5]

template<typename Val>
INLINE gum::ListIteratorSafe< Val >::ListIteratorSafe ( const List< Val > & theList)

Constructor for a begin.

Definition at line 974 of file list_tpl.h.

References gum::ListConstIteratorSafe< Val >::ListConstIteratorSafe(), ListIteratorSafe(), and gum::ListConstIteratorSafe< Val >::List< Val >.

Here is the call graph for this function:

◆ ListIteratorSafe() [3/5]

template<typename Val>
INLINE gum::ListIteratorSafe< Val >::ListIteratorSafe ( const ListIteratorSafe< Val > & src)

Copy constructor.

Parameters
srcThe gum::ListConstIteratorSafe to copy.

Definition at line 981 of file list_tpl.h.

References gum::ListConstIteratorSafe< Val >::ListConstIteratorSafe(), and ListIteratorSafe().

Here is the call graph for this function:

◆ ListIteratorSafe() [4/5]

template<typename Val>
INLINE gum::ListIteratorSafe< Val >::ListIteratorSafe ( const List< Val > & theList,
Size ind_elt )

Constructor for an iterator pointing to the ind_eltth element of a List.

Parameters
theListThe list to iterate over.
ind_eltThe iterator starting position.
Exceptions
UndefinedIteratorValueRaised if the element does not exist in the list.

Definition at line 989 of file list_tpl.h.

References gum::ListConstIteratorSafe< Val >::List< Val >.

Here is the call graph for this function:

◆ ListIteratorSafe() [5/5]

template<typename Val>
INLINE gum::ListIteratorSafe< Val >::ListIteratorSafe ( ListIteratorSafe< Val > && src)

Move constructor.

Parameters
srcThe gum::ListConstIterator to move.

Definition at line 996 of file list_tpl.h.

References gum::ListConstIteratorSafe< Val >::ListConstIteratorSafe(), and ListIteratorSafe().

Here is the call graph for this function:

◆ ~ListIteratorSafe()

template<typename Val>
INLINE gum::ListIteratorSafe< Val >::~ListIteratorSafe ( )

Class Desctructor.

Definition at line 1023 of file list_tpl.h.

1023 {
1025 }

References ListIteratorSafe().

Here is the call graph for this function:

Member Function Documentation

◆ _getBucket_()

template<typename Val>
INLINE ListBucket< Val > * gum::ListConstIteratorSafe< Val >::_getBucket_ ( ) const
privatenoexceptinherited

Returns the bucket the iterator is pointing to.

Definition at line 703 of file list_tpl.h.

703 {
704 return _bucket_;
705 }
ListBucket< Val > * _bucket_
The bucket in the chained list pointed to by the iterator.
Definition list.h:2233

References _bucket_.

Referenced by gum::List< Val >::_insert_(), gum::List< Val >::erase(), and gum::List< Val >::erase().

Here is the caller graph for this function:

◆ _opMinus_()

template<typename Val>
INLINE ListConstIteratorSafe< Val > & gum::ListConstIteratorSafe< Val >::_opMinus_ ( Size i)
privatenoexceptinherited

Makes the iterator point to i elements before in the List.

Definition at line 772 of file list_tpl.h.

772 {
773 // check if we are pointing to something that has been deleted
774 if (_null_pointing_) {
775 _null_pointing_ = false;
776
777 // if we are pointing to an element of the chained list that has been
778 // deleted
779 // but that has a preceding element, just point on the latter
780 if (_prev_current_bucket_ != nullptr) {
782 } else {
783 // here we were pointing on an extremity of the list (either end or
784 // rend)
785 // if next_current_bucket is not null, then we are at end and doing
786 // a -- shall now point to the beginning of the list
787 if (_next_current_bucket_ != nullptr) {
789 } else {
790 // here, we are at the rend of the chained list, hence we shall remain
791 // at rend
792 _bucket_ = nullptr;
793 return *this;
794 }
795 }
796 } else {
797 // if we are pointing to an element of the chained list, just
798 // point on the preceding bucket in this list
799 if (_bucket_ != nullptr) { _bucket_ = _bucket_->_prev_; }
800 }
801
802 for (--i; i && (_bucket_ != nullptr); --i, _bucket_ = _bucket_->_prev_) {}
803
804 return *this;
805 }
Safe const iterators for Lists.
Definition list.h:2006
ListBucket< Val > * _next_current_bucket_
The bucket we should start from when we are pointing on a deleted bucket and we decide to do a ++.
Definition list.h:2237
ListBucket< Val > * _prev_current_bucket_
The bucket we should start from when we are pointing on a deleted bucket and we decide to do a –.
Definition list.h:2241
bool _null_pointing_
Indicates whether the bucket the iterator points to has been deleted.
Definition list.h:2244

References ListConstIteratorSafe(), _bucket_, _next_current_bucket_, _null_pointing_, and _prev_current_bucket_.

Referenced by operator+=(), and operator-=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _opPlus_()

template<typename Val>
INLINE ListConstIteratorSafe< Val > & gum::ListConstIteratorSafe< Val >::_opPlus_ ( Size i)
privatenoexceptinherited

Makes the iterator point to the next element in the List.

Definition at line 809 of file list_tpl.h.

809 {
810 // check if we are pointing to something that has been deleted
811 if (_null_pointing_) {
812 _null_pointing_ = false;
813
814 // if we are pointing to an element of the chained list that has been
815 // deleted
816 // but that has a next element, just point on the latter
817 if (_next_current_bucket_ != nullptr) {
819 } else {
820 // here we were pointing on an extremity of the list (either end or
821 // rend)
822 // if prev_current_bucket is not null, then we are at rend and doing
823 // a ++ shall now point to the beginning of the list
824 if (_prev_current_bucket_ != nullptr) {
826 } else {
827 // here, we are at the end of the chained list, hence we shall
828 // remain at end
829 _bucket_ = nullptr;
830 return *this;
831 }
832 }
833 } else {
834 // if we are pointing to an element of the chained list, just
835 // point on the next bucket in this list
836 if (_bucket_ != nullptr) { _bucket_ = _bucket_->_next_; }
837 }
838
839 for (--i; i && (_bucket_ != nullptr); --i, _bucket_ = _bucket_->_next_) {}
840
841 return *this;
842 }

References ListConstIteratorSafe(), _bucket_, _next_current_bucket_, _null_pointing_, and _prev_current_bucket_.

Referenced by operator+=(), and operator-=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _removeFromSafeList_()

template<typename Val>
INLINE void gum::ListConstIteratorSafe< Val >::_removeFromSafeList_ ( ) const
privateinherited

Remove the iterator for its list' safe iterators list.

Definition at line 594 of file list_tpl.h.

594 {
595 // find where the iterator is
597
598 for (auto i = vect.size() - 1; i >= 0; --i) {
599 if (vect[i] == this) {
600 vect.erase(vect.begin() + i);
601 break;
602 }
603 }
604 }
const List< Val > * _list_
The list the iterator is pointing to.
Definition list.h:2230

References _list_.

Referenced by ~ListConstIteratorSafe(), clear(), and operator=().

Here is the caller graph for this function:

◆ clear()

template<typename Val>
INLINE void gum::ListConstIteratorSafe< Val >::clear ( )
inherited

Makes the iterator point toward nothing.

A method for detaching the iterator from the List it is attached to. It is mainly used by the List when the latter is deleted while the iterator is still alive. After being detached, the iterator does not point to any element, i.e., trying to access its content will raise an exception.

Definition at line 709 of file list_tpl.h.

709 {
710 // remove the iterator src the list's iterator list
712
713 // set its list as well as the element it points to to nullptr
714 _list_ = nullptr;
715 _bucket_ = nullptr;
716 _null_pointing_ = false;
717 }
void _removeFromSafeList_() const
Remove the iterator for its list' safe iterators list.
Definition list_tpl.h:594

References _bucket_, _list_, _null_pointing_, and _removeFromSafeList_().

Referenced by setToEnd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEnd()

template<typename Val>
INLINE bool gum::ListConstIteratorSafe< Val >::isEnd ( ) const
inherited

Returns a bool indicating whether the iterator points to the end of the list.

Returns
Returns a bool indicating whether the iterator points to the end of the list.

Definition at line 728 of file list_tpl.h.

728 {
729 return _null_pointing_
730 ? (_next_current_bucket_ == nullptr) && (_prev_current_bucket_ == nullptr)
731 : (_bucket_ == nullptr);
732 }

References _bucket_, _next_current_bucket_, _null_pointing_, and _prev_current_bucket_.

◆ operator!=() [1/2]

template<typename Val>
INLINE bool gum::ListConstIteratorSafe< Val >::operator!= ( const ListConstIteratorSafe< Val > & src) const
inherited

Checks whether two iterators point toward different elements.

Warning
the end and rend iterators are always equal, whatever the list they belong to, i.e., list1.end() == list2.rend().
Parameters
srcThe gum::ListConstIteratorSafe to test for inequality.
Returns
Returns true if src and this are equal.

Definition at line 917 of file list_tpl.h.

References ListConstIteratorSafe(), _bucket_, _next_current_bucket_, _null_pointing_, and _prev_current_bucket_.

Here is the call graph for this function:

◆ operator!=() [2/2]

template<typename Val>
INLINE bool gum::ListIteratorSafe< Val >::operator!= ( const ListIteratorSafe< Val > & src) const

Checks whether two iterators point toward different elements.

Warning
the end and rend iterators are always equal, whatever the list they belong to, i.e., list1.end() == list2.rend().
Parameters
srcThe gum::ListIteratorSafe to test for inequality.
Returns
Returns true if src and this are equal.

Definition at line 1035 of file list_tpl.h.

1035 {
1036 return !operator==(src);
1037 }
bool operator==(const TiXmlString &a, const TiXmlString &b)
Definition tinystr.h:243

References ListIteratorSafe(), and gum::operator==().

Here is the call graph for this function:

◆ operator*() [1/2]

template<typename Val>
INLINE Val & gum::ListIteratorSafe< Val >::operator* ( )

Gives access to the content of the iterator.

Exceptions
UndefinedIteratorValueRaised if the iterator points to nothing.
Returns
Returns the content of the iterator.

Definition at line 1097 of file list_tpl.h.

1097 {
1098 return const_cast< Val& >(ListConstIteratorSafe< Val >::operator*());
1099 }
const Val & operator*() const
Gives access to the content of the iterator.
Definition list_tpl.h:941

References gum::ListConstIteratorSafe< Val >::operator*().

Here is the call graph for this function:

◆ operator*() [2/2]

template<typename Val>
INLINE const Val & gum::ListIteratorSafe< Val >::operator* ( ) const

Gives access to the content of the iterator.

Exceptions
UndefinedIteratorValueRaised if the iterator points to nothing.
Returns
Returns the content of the iterator.

Definition at line 1103 of file list_tpl.h.

1103 {
1105 }

References gum::ListConstIteratorSafe< Val >::operator*().

Here is the call graph for this function:

◆ operator+()

template<typename Val>
INLINE ListIteratorSafe< Val > gum::ListIteratorSafe< Val >::operator+ ( difference_type i)
noexcept

Returns a new iterator pointing to i further elements in the gum::List.

Parameters
iThe number of steps to move the iterator.
Returns
Returns a new gum::ListConstIteratoSafe.

Definition at line 1071 of file list_tpl.h.

1072 {
1073 return ListIteratorSafe< Val >(*this) += i;
1074 }

References ListIteratorSafe().

Here is the call graph for this function:

◆ operator++()

template<typename Val>
INLINE ListIteratorSafe< Val > & gum::ListIteratorSafe< Val >::operator++ ( )
noexcept

Makes the iterator point to the next element in the List.

for (iter = list.begin(); iter != list.end(); ++iter) { }

The above loop is guaranteed to parse the whole List as long as no element is added to or deleted from the List while being in the loop. Runs in constant time.

Returns
Returns this gum::ListIteratorSafe.

Definition at line 1041 of file list_tpl.h.

1041 {
1043 return *this;
1044 }
ListConstIteratorSafe< Val > & operator++() noexcept
Makes the iterator point to the next element in the List.
Definition list_tpl.h:736

References ListIteratorSafe(), and gum::ListConstIteratorSafe< Val >::operator++().

Here is the call graph for this function:

◆ operator+=()

template<typename Val>
INLINE ListIteratorSafe< Val > & gum::ListIteratorSafe< Val >::operator+= ( difference_type i)
noexcept

Makes the iterator point to i elements further in the List.

Parameters
iThe number of steps to move the iterator.
Returns
Returns this gum::ListIterator.

Definition at line 1048 of file list_tpl.h.

1049 {
1051 return *this;
1052 }
ListConstIteratorSafe< Val > & operator+=(difference_type i) noexcept
Makes the iterator point to i elements further in the List.
Definition list_tpl.h:846

◆ operator-()

template<typename Val>
INLINE ListIteratorSafe< Val > gum::ListIteratorSafe< Val >::operator- ( difference_type i)
noexcept

Returns a new iterator pointing to i preceding elements in the gum::List.

Parameters
iThe number of steps to move the iterator.
Returns
Returns a new gum::ListIteratorSafe.

Definition at line 1078 of file list_tpl.h.

1079 {
1080 return ListIteratorSafe< Val >(*this) -= i;
1081 }

References ListIteratorSafe().

Here is the call graph for this function:

◆ operator--()

template<typename Val>
INLINE ListIteratorSafe< Val > & gum::ListIteratorSafe< Val >::operator-- ( )
noexcept

Makes the iterator point to the preceding element in the List.

for (iter = list.rbegin(); iter != list.rend(); --iter) { }

The above loop is guaranteed to parse the whole List as long as no element is added to or deleted from the List while being in the loop. Runs in constant time.

Returns
Returns this gum::ListIteratorSafe.

Definition at line 1056 of file list_tpl.h.

1056 {
1058 return *this;
1059 }
ListConstIteratorSafe< Val > & operator--() noexcept
Makes the iterator point to the preceding element in the List.
Definition list_tpl.h:856

References ListIteratorSafe(), and gum::ListConstIteratorSafe< Val >::operator--().

Here is the call graph for this function:

◆ operator-=()

template<typename Val>
INLINE ListIteratorSafe< Val > & gum::ListIteratorSafe< Val >::operator-= ( difference_type i)
noexcept

Makes the iterator point to i elements befor in the List.

Parameters
iThe number of steps to move the iterator.
Returns
Returns this gum::ListIteratorSafe.

Definition at line 1063 of file list_tpl.h.

1064 {
1066 return *this;
1067 }
ListConstIteratorSafe< Val > & operator-=(difference_type i) noexcept
Makes the iterator point to i elements befor in the List.
Definition list_tpl.h:892

References ListIteratorSafe(), and gum::ListConstIteratorSafe< Val >::operator-=().

Here is the call graph for this function:

◆ operator->() [1/2]

template<typename Val>
INLINE Val * gum::ListIteratorSafe< Val >::operator-> ( )

Dereferences the value pointed to by the iterator.

Exceptions
UndefinedIteratorValueRaised if the iterator points to nothing.
Returns
Returns the value pointed to by the iterator.

Definition at line 1085 of file list_tpl.h.

1085 {
1086 return const_cast< Val* >(ListConstIteratorSafe< Val >::operator->());
1087 }
const Val * operator->() const
Dereferences the value pointed to by the iterator.
Definition list_tpl.h:934

References gum::ListConstIteratorSafe< Val >::operator->().

Here is the call graph for this function:

◆ operator->() [2/2]

template<typename Val>
INLINE const Val * gum::ListIteratorSafe< Val >::operator-> ( ) const

Dereferences the value pointed to by the iterator.

Exceptions
UndefinedIteratorValueRaised if the iterator points to nothing.
Returns
Returns the value pointed to by the iterator.

Definition at line 1091 of file list_tpl.h.

1091 {
1093 }

References gum::ListConstIteratorSafe< Val >::operator->().

Here is the call graph for this function:

◆ operator=() [1/2]

template<typename Val>
INLINE ListIteratorSafe< Val > & gum::ListIteratorSafe< Val >::operator= ( const ListIteratorSafe< Val > & src)

Copy operator.

The current iterator now points to the same element as iterator from.

Parameters
srcThe gum::ListIteratorSafe to copy.
Returns
Returns this gum::ListIteratorSafe.

Definition at line 1004 of file list_tpl.h.

1004 {
1005 // for debugging purposes
1008 return *this;
1009 }
ListConstIteratorSafe< Val > & operator=(const ListConstIteratorSafe< Val > &src)
Copy operator.
Definition list_tpl.h:609

References ListIteratorSafe(), and gum::ListConstIteratorSafe< Val >::operator=().

Here is the call graph for this function:

◆ operator=() [2/2]

template<typename Val>
INLINE ListIteratorSafe< Val > & gum::ListIteratorSafe< Val >::operator= ( ListIteratorSafe< Val > && src)

Move operator.

Parameters
srcThe gum::ListIteratorSafe to move.
Returns
Returns this gum::ListIteratorSafe.

Definition at line 1014 of file list_tpl.h.

1014 {
1015 // for debugging purposes
1018 return *this;
1019 }

References ListIteratorSafe(), and gum::ListConstIteratorSafe< Val >::operator=().

Here is the call graph for this function:

◆ operator==() [1/2]

template<typename Val>
INLINE bool gum::ListConstIteratorSafe< Val >::operator== ( const ListConstIteratorSafe< Val > & src) const
inherited

Checks whether two iterators point toward the same elements.

Warning
the end and rend iterators are always equal, whatever the list they belong to, i.e., list1.end() == list2.rend().
Parameters
srcThe gum::ListConstIteratorSafe to test for equality.
Returns
Returns true if src and this are equal.

Definition at line 926 of file list_tpl.h.

References ListConstIteratorSafe(), _bucket_, _next_current_bucket_, _null_pointing_, and _prev_current_bucket_.

Referenced by gum::ListIteratorSafe< Val >::operator==().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator==() [2/2]

template<typename Val>
INLINE bool gum::ListIteratorSafe< Val >::operator== ( const ListIteratorSafe< Val > & src) const

Checks whether two iterators point toward the same elements.

Warning
the end and rend iterators are always equal, whatever the list they belong to, i.e., list1.end() == list2.rend().
Parameters
srcThe gum::ListIteratorSafe to test for equality.
Returns
Returns true if src and this are equal.

Definition at line 1029 of file list_tpl.h.

1029 {
1031 }
bool operator==(const ListConstIteratorSafe< Val > &src) const
Checks whether two iterators point toward the same elements.
Definition list_tpl.h:926

References ListIteratorSafe(), and gum::ListConstIteratorSafe< Val >::operator==().

Here is the call graph for this function:

◆ setToEnd()

template<typename Val>
INLINE void gum::ListConstIteratorSafe< Val >::setToEnd ( )
inherited

Positions the iterator to the end of the list.

Definition at line 721 of file list_tpl.h.

721 {
722 clear();
723 }
void clear()
Makes the iterator point toward nothing.
Definition list_tpl.h:709

References clear().

Here is the call graph for this function:

Member Data Documentation

◆ _bucket_

template<typename Val>
ListBucket< Val >* gum::ListConstIteratorSafe< Val >::_bucket_ {nullptr}
privateinherited

The bucket in the chained list pointed to by the iterator.

Definition at line 2233 of file list.h.

2233{nullptr};

Referenced by ListConstIteratorSafe(), ListConstIteratorSafe(), ListConstIteratorSafe(), _getBucket_(), _opMinus_(), _opPlus_(), clear(), isEnd(), operator!=(), operator*(), operator++(), operator--(), operator->(), and operator==().

◆ _list_

template<typename Val>
const List< Val >* gum::ListConstIteratorSafe< Val >::_list_ {nullptr}
privateinherited

◆ _next_current_bucket_

template<typename Val>
ListBucket< Val >* gum::ListConstIteratorSafe< Val >::_next_current_bucket_ {nullptr}
privateinherited

The bucket we should start from when we are pointing on a deleted bucket and we decide to do a ++.

Definition at line 2237 of file list.h.

2237{nullptr};

Referenced by ListConstIteratorSafe(), ListConstIteratorSafe(), gum::List< Val >::_insert_(), _opMinus_(), _opPlus_(), isEnd(), operator!=(), operator++(), operator--(), and operator==().

◆ _null_pointing_

template<typename Val>
bool gum::ListConstIteratorSafe< Val >::_null_pointing_ {false}
privateinherited

Indicates whether the bucket the iterator points to has been deleted.

Definition at line 2244 of file list.h.

2244{false};

Referenced by ListConstIteratorSafe(), ListConstIteratorSafe(), gum::List< Val >::_insert_(), _opMinus_(), _opPlus_(), clear(), isEnd(), operator!=(), operator++(), operator--(), and operator==().

◆ _prev_current_bucket_

template<typename Val>
ListBucket< Val >* gum::ListConstIteratorSafe< Val >::_prev_current_bucket_ {nullptr}
privateinherited

The bucket we should start from when we are pointing on a deleted bucket and we decide to do a –.

Definition at line 2241 of file list.h.

2241{nullptr};

Referenced by ListConstIteratorSafe(), ListConstIteratorSafe(), gum::List< Val >::_insert_(), _opMinus_(), _opPlus_(), isEnd(), operator!=(), operator++(), operator--(), and operator==().


The documentation for this class was generated from the following files: