![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
Generic doubly linked lists. More...
#include <agrum/base/core/list.h>
Public Types | |
| enum class | location { BEFORE , AFTER } |
| Locations around iterators where insertions of new elements can take / place. More... | |
| 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 | size_type = Size |
| Types for STL compliance. | |
| using | difference_type = std::ptrdiff_t |
| Types for STL compliance. | |
| using | iterator = ListIterator< Val > |
| Types for STL compliance. | |
| using | const_iterator = ListConstIterator< Val > |
| Types for STL compliance. | |
| using | iterator_safe = ListIteratorSafe< Val > |
| Types for STL compliance. | |
| using | const_iterator_safe = ListConstIteratorSafe< Val > |
| Types for STL compliance. | |
Public Member Functions | |
| template<typename... Args> | |
| INLINE ListBucket< Val > * | _createEmplaceBucket_ (Args &&... args) const |
| template<typename... Args> | |
| INLINE Val & | push_front (Args &&... args) |
| template<typename... Args> | |
| INLINE Val & | emplaceFront (Args &&... args) |
| template<typename... Args> | |
| INLINE Val & | push_back (Args &&... args) |
| template<typename... Args> | |
| INLINE Val & | emplaceBack (Args &&... args) |
| template<typename... Args> | |
| INLINE Val & | emplace (const const_iterator &iter, Args &&... args) |
| template<typename... Args> | |
| INLINE Val & | emplace (const const_iterator_safe &iter, Args &&... args) |
Constructors / Destructors | |
| List () | |
| A basic constructor that creates an empty list. | |
| List (const List< Val > &src) | |
| Copy constructor. | |
| List (List< Val > &&src) noexcept | |
| Move constructor. | |
| List (std::initializer_list< Val > list) | |
| Initializer_list constructor. | |
| ~List () | |
| Class destructor. | |
Iterators | |
| const const_iterator_safe & | cendSafe () const noexcept |
| Returns a safe const iterator pointing to the end of the List. | |
| const iterator_safe & | endSafe () noexcept |
| Returns a safe iterator pointing to the end of the List. | |
| const const_iterator_safe & | crendSafe () const noexcept |
| Return a safe const iterator pointing just before the beginning of the List. | |
| const iterator_safe & | rendSafe () noexcept |
| Returns a safe iterator pointing just before the beginning of the List. | |
| const_iterator_safe | cbeginSafe () const |
| Returns a safe const iterator pointing to the beginning of the List. | |
| iterator_safe | beginSafe () |
| Returns a safe iterator pointing to the beginning of the List. | |
| const_iterator_safe | crbeginSafe () const |
| Returns a safe const iterator pointing to the last element of the List. | |
| iterator_safe | rbeginSafe () |
| Returns a safe iterator pointing to the last element of the List. | |
| const const_iterator & | cend () const noexcept |
| Returns an unsafe const iterator pointing to the end of the List. | |
| const iterator & | end () noexcept |
| Returns an unsafe iterator pointing to the end of the List. | |
| const const_iterator & | end () const noexcept |
| Returns an unsafe const iterator pointing to the end of the List. | |
| const const_iterator & | crend () const noexcept |
| Returns an unsafe const iterator pointing just before the beginning of the List. | |
| const iterator & | rend () noexcept |
| Returns an unsafe iterator pointing just before the beginning of the List. | |
| const const_iterator & | rend () const noexcept |
| Returns an unsafe const iterator pointing just before the beginning of the List. | |
| const_iterator | cbegin () const |
| Returns an unsafe const iterator pointing to the beginning of the List. | |
| iterator | begin () |
| Returns an unsafe iterator pointing to the beginning of the List. | |
| const_iterator | begin () const |
| Returns an unsafe const iterator pointing to the beginning of the List. | |
| const_iterator | crbegin () const |
| Returns an unsafe const iterator pointing to the last element of the List. | |
| iterator | rbegin () |
| Returns an unsafe iterator pointing to the last element of the List. | |
| const_iterator | rbegin () const |
| Returns an unsafe const iterator pointing to the last element of the List. | |
Accessors / Modifiers | |
| Val & | pushFront (const Val &val) |
| Inserts a new element (a copy) at the beginning of the chained list. | |
| Val & | pushFront (Val &&val) |
| Inserts a new element (a move) at the beginning of the chained list. | |
| template<typename... Args> | |
| Val & | push_front (Args &&... args) |
| An alias for pushFront used for STL compliance. | |
| template<typename... Args> | |
| Val & | emplaceFront (Args &&... args) |
| Emplace elements at the beginning of the chained list. | |
| Val & | pushBack (const Val &val) |
| Inserts a new element (a copy) at the end of the chained list. | |
| Val & | pushBack (Val &&val) |
| Inserts a new element (a move) at the end of the chained list. | |
| template<typename... Args> | |
| Val & | push_back (Args &&... args) |
| An alias for pushBack used for STL compliance. | |
| template<typename... Args> | |
| Val & | emplaceBack (Args &&... args) |
| Emplace elements at the end of the chained list. | |
| Val & | insert (const Val &val) |
| Inserts a new element at the end of the chained list (alias of pushBack). | |
| Val & | insert (Val &&val) |
| Inserts a new element at the end of the chained list (alias of pushBack). | |
| Val & | insert (Size pos, const Val &val) |
| Inserts a new element at the ith pos of the chained list. | |
| Val & | insert (Size pos, Val &&val) |
| Insert an rvalue at the ith pos of the chained list. | |
| Val & | insert (const const_iterator_safe &iter, const Val &val, location place=location::BEFORE) |
| Inserts a new element before or after a given iterator. | |
| Val & | insert (const const_iterator_safe &iter, Val &&val, location place=location::BEFORE) |
| Inserts an rvalue before or after a given iterator. | |
| Val & | insert (const const_iterator &iter, const Val &val, location place=location::BEFORE) |
| Inserts a new element before or after a given iterator. | |
| Val & | insert (const const_iterator &iter, Val &&val, location place=location::BEFORE) |
| Inserts an rvalue before or after a given iterator. | |
| template<typename... Args> | |
| Val & | emplace (const const_iterator &iter, Args &&... args) |
| Emplace a new element before a given iterator. | |
| template<typename... Args> | |
| Val & | emplace (const const_iterator_safe &iter, Args &&... args) |
| Emplace a new element before a given safe iterator. | |
| Val & | front () const |
| Returns a reference to first element of a list, if any. | |
| Val & | back () const |
| Returns a reference to last element of a list, if any. | |
| Size | size () const noexcept |
| Returns the number of elements in the list. | |
| bool | exists (const Val &val) const |
| Checks whether there exists a given element in the list. | |
| void | erase (Size i) |
| Erases the ith element of the List (the first one is in position 0). | |
| void | erase (const iterator_safe &iter) |
| Erases the element of the List pointed to by the safe iterator. | |
| void | erase (const const_iterator_safe &iter) |
| Erases the element of the List pointed to by the safe const iterator. | |
| void | eraseByVal (const Val &val) |
| erases the first element encountered with a given value. | |
| void | eraseAllVal (const Val &val) |
| erases all the elements encountered with a given value | |
| void | popBack () |
| Removes the last element of a List, if any. | |
| void | popFront () |
| Removes the first element of a List, if any. | |
| void | clear () |
| Deletes all the elements of a chained list. | |
| bool | empty () const noexcept |
| Returns a boolean indicating whether the chained list is empty. | |
| void | swap (List &other_list) |
| Swap the current list with another one. | |
| std::string | toString () const |
| Converts a list into a string. | |
| template<typename Mount> | |
| List< Mount > | map (Mount(*f)(Val)) const |
| Creates a list of mountains from a list of val. | |
| template<typename Mount> | |
| List< Mount > | map (Mount(*f)(Val &)) const |
| Creates a list of mountains from a list of val. | |
| template<typename Mount> | |
| List< Mount > | map (Mount(*f)(const Val &)) const |
| Creates a list of mountains from a list of val. | |
| template<typename Mount> | |
| List< Mount > | map (const Mount &mount) const |
| Creates a list of mountains with a given value from a list of val. | |
Operators | |
| List< Val > & | operator= (const List< Val > &src) |
| Copy operator. | |
| List< Val > & | operator= (List< Val > &&src) |
| Move operator. | |
| Val & | operator+= (const Val &val) |
| Inserts a new element at the end of the list (alias of pushBack). | |
| Val & | operator+= (Val &&val) |
| Inserts a new element at the end of the list (alias of pushBack). | |
| bool | operator== (const List< Val > &src) const |
| Checks whether two lists are identical (same elements in the same order). | |
| bool | operator!= (const List< Val > &src) const |
| Checks whether two lists are different (different elements or orders). | |
| Val & | operator[] (const Size i) |
| Returns the ith element in the current chained list. | |
| const Val & | operator[] (const Size i) const |
| Returns the const ith element in the current chained list. | |
Private Member Functions | |
| void | _copy_elements_ (const List< Val > &src) |
| A function used to perform copies of elements of Lists. | |
| ListBucket< Val > * | _getIthBucket_ (Size i) const noexcept |
| Returns the bucket corresponding to the ith position in the list. | |
| ListBucket< Val > * | _getBucket_ (const Val &val) const noexcept |
| Returns the bucket corresponding to a given value. | |
| void | _erase_ (ListBucket< Val > *bucket) |
| Removes an element from a chained list. | |
| ListBucket< Val > * | _createBucket_ (const Val &val) const |
| Create a new bucket with a given value. | |
| ListBucket< Val > * | _createBucket_ (Val &&val) const |
| Create a new bucket with a given value. | |
| template<typename... Args> | |
| ListBucket< Val > * | _createEmplaceBucket_ (Args &&... args) const |
| Create an emplace bucket. | |
| Val & | _pushFront_ (ListBucket< Val > *new_elt) |
| Insert a bucket at the front of the list. | |
| Val & | _pushBack_ (ListBucket< Val > *new_elt) |
| Insert a bucket at the end of the list. | |
| Val & | _insertBefore_ (ListBucket< Val > *new_elt, ListBucket< Val > *current_elt) |
| Insert a new bucket before another one. | |
| Val & | _insertAfter_ (ListBucket< Val > *new_elt, ListBucket< Val > *current_elt) |
| Insert a new bucket after another one. | |
| Val & | _insert_ (const const_iterator_safe &iter, ListBucket< Val > *new_elt, location place) |
| Inserts a new bucket before or after the location pointed to by an iterator. | |
| Val & | _insert_ (const const_iterator &iter, ListBucket< Val > *new_elt, location place) |
| Inserts a new bucket before or after the location pointed to by an iterator. | |
Private Attributes | |
| ListBucket< Val > * | _deb_list_ {nullptr} |
| A pointer on the first element of the chained list. | |
| ListBucket< Val > * | _end_list_ {nullptr} |
| A pointer on the last element of the chained list. | |
| Size | _nb_elements_ {Size(0)} |
| The number of elements in the list. | |
| std::vector< const_iterator_safe * > | _safe_iterators_ |
| The list of "safe" iterators attached to the list. | |
Friends | |
| class | ListIterator< Val > |
| ListIterator should be a friend to optimize access to elements. | |
| class | ListConstIterator< Val > |
| ListIterator should be a friend to optimize access to elements. | |
| class | ListIteratorSafe< Val > |
| ListIterator should be a friend to optimize access to elements. | |
| class | ListConstIteratorSafe< Val > |
| ListIterator should be a friend to optimize access to elements. | |
Generic doubly linked lists.
List enables fast and safe manipulation of chained lists. Unless the elements are rvalues, the insertions of new elements into the lists are ALWAYS performed by copy, i.e., each time we add a new element X to the List, a copy of X is actually created and this very copy is stored into the list. For rvalues, move operations are performed.
The List iterators are implemented so as to avoid segmentation faults when elements of the list are deleted while some safe iterators are pointing on them. Moreover they ensure that, when elements are removed from a List, iterators on that list will never access these elements (which is not the case for the iterators in the C++ standard library). Note that this guarantee is ensured at low cost as experimental results show that List and ListIterator are as efficient as their STL counterparts. However, this guarantee can hold only if List is aware of all of the iterators pointing to it: thus, when List erases one element, it can parse the list of its iterators and update those that point toward the now deleted element. When parsing elements without removing any element, you can use unsafe iterators instead of safe ones because they are slightly faster. But those will most certainly segfault if they perform some operations on deleted elements.
| Val | The values type stored in the gum::List. |
| using gum::List< Val >::const_iterator = ListConstIterator< Val > |
| using gum::List< Val >::const_iterator_safe = ListConstIteratorSafe< Val > |
| using gum::List< Val >::const_pointer = const Val* |
| using gum::List< Val >::const_reference = const Val& |
| using gum::List< Val >::difference_type = std::ptrdiff_t |
| using gum::List< Val >::iterator = ListIterator< Val > |
| using gum::List< Val >::iterator_safe = ListIteratorSafe< Val > |
| using gum::List< Val >::pointer = Val* |
| using gum::List< Val >::reference = Val& |
| using gum::List< Val >::value_type = Val |
|
strong |
|
explicit |
A basic constructor that creates an empty list.
Definition at line 1174 of file list_tpl.h.
References List(), _safe_iterators_, and GUM_DEFAULT_ITERATOR_NUMBER.
Referenced by List(), List(), List(), List(), ~List(), _copy_elements_(), emplace(), map(), map(), map(), map(), operator!=(), operator=(), operator=(), operator==(), and swap().
| INLINE gum::List< Val >::List | ( | const List< Val > & | src | ) |
Copy constructor.
The new list and that which is copied do not share their elements: the new list contains new instances of the values stored in the list to be copied. Of course if these values are pointers, the new values point toward the same elements. This constructor runs in linear time.
| src | the list the contents of which is copied into the current one. |
Definition at line 1184 of file list_tpl.h.
References List().
|
noexcept |
Move constructor.
| src | The gum::List to move. |
Definition at line 1197 of file list_tpl.h.
References List(), and _deb_list_.
| INLINE gum::List< Val >::List | ( | std::initializer_list< Val > | list | ) |
Initializer_list constructor.
| list | The initializer list. |
Definition at line 1212 of file list_tpl.h.
References List(), and pushBack().
Class destructor.
Definition at line 1227 of file list_tpl.h.
References List(), and clear().
A function used to perform copies of elements of Lists.
Before performing the copy, we assume in this function that the current list (this) is empty (else there would be memory leak).
| src | The gum::List to copy. |
Definition at line 1115 of file list_tpl.h.
References List(), _deb_list_, _end_list_, _nb_elements_, gum::ListBucket< Val >::_next_, and gum::ListBucket< Val >::_prev_.
Referenced by operator=().
|
private |
Create a new bucket with a given value.
| val | The value of the new bucket. |
Definition at line 1407 of file list_tpl.h.
Referenced by insert(), insert(), insert(), insert(), insert(), insert(), pushBack(), pushBack(), pushFront(), and pushFront().
|
private |
Create a new bucket with a given value.
| val | The value of the new bucket. |
Definition at line 1413 of file list_tpl.h.
|
private |
Create an emplace bucket.
| Args | The emplace arguments types. |
| args | The emplace arguments. |
| INLINE ListBucket< Val > * gum::List< Val >::_createEmplaceBucket_ | ( | Args &&... | args | ) | const |
Definition at line 1420 of file list_tpl.h.
|
private |
Removes an element from a chained list.
If parameter bucket is equal to 0, then the method does not perform anything, else the bucket is deleted. In the latter case, no test is ever performed to check that the bucket does actually belong to the List. The method runs in constant time.
| bucket | A pointer on the bucket in the chained list we wish to remove. |
Definition at line 1734 of file list_tpl.h.
References _deb_list_, _end_list_, _nb_elements_, gum::ListBucket< Val >::_next_, gum::ListBucket< Val >::_prev_, and _safe_iterators_.
Referenced by erase(), erase(), erase(), eraseAllVal(), eraseByVal(), popBack(), and popFront().
|
privatenoexcept |
Returns the bucket corresponding to a given value.
Actually, this is the first bucket of value val encountered in the list, if any, that is returned. If the element cannot be found, 0 is returned. This method enables fast removals of buckets. It runs in linear time.
Comparisons between Val instances are performed through == operators.
| val | The value of the element the bucket of which we wish to return. |
Definition at line 1793 of file list_tpl.h.
References _deb_list_.
Referenced by eraseByVal().
|
privatenoexcept |
Returns the bucket corresponding to the ith position in the list.
This method assumes that the list contains at least i+1 elements. The index of the first element of the list is 0.
| i | The position of the returned element. |
Definition at line 1527 of file list_tpl.h.
References _deb_list_, _end_list_, _nb_elements_, gum::ListBucket< Val >::_next_, and gum::ListBucket< Val >::_prev_.
Referenced by erase(), insert(), insert(), operator[](), and operator[]().
|
private |
Inserts a new bucket before or after the location pointed to by an iterator.
| iter | An iterator pointing where to insert a new element. |
| new_elt | The new element ot insert in the gum::List. |
| place | Where to insert the new element relatively to the iterator. |
Definition at line 1629 of file list_tpl.h.
References gum::ListConstIterator< Val >::_getBucket_(), _insertAfter_(), _insertBefore_(), _pushBack_(), AFTER, BEFORE, and GUM_ERROR.
|
private |
Inserts a new bucket before or after the location pointed to by an iterator.
| iter | An iterator pointing where to insert a new element. |
| new_elt | The new element ot insert in the gum::List. |
| place | Where to insert the new element relatively to the iterator. |
Definition at line 1596 of file list_tpl.h.
References gum::ListConstIteratorSafe< Val >::_getBucket_(), _insertAfter_(), _insertBefore_(), gum::ListConstIteratorSafe< Val >::_next_current_bucket_, gum::ListConstIteratorSafe< Val >::_null_pointing_, gum::ListConstIteratorSafe< Val >::_prev_current_bucket_, _pushBack_(), AFTER, BEFORE, and GUM_ERROR.
Referenced by insert(), insert(), insert(), and insert().
|
private |
Insert a new bucket after another one.
| new_elt | The new element to insert in the gum::List. |
| current_elt | The element before which new_elt will be inserted. |
Definition at line 1559 of file list_tpl.h.
References _end_list_, _nb_elements_, gum::ListBucket< Val >::_next_, gum::ListBucket< Val >::_prev_, and gum::ListBucket< Val >::_val_.
Referenced by _insert_(), and _insert_().
|
private |
Insert a new bucket before another one.
| new_elt | The new element to insert in the gum::List. |
| current_elt | The element before which new_elt will be inserted. |
Definition at line 1541 of file list_tpl.h.
References _deb_list_, _nb_elements_, gum::ListBucket< Val >::_next_, gum::ListBucket< Val >::_prev_, and gum::ListBucket< Val >::_val_.
Referenced by _insert_(), _insert_(), insert(), and insert().
|
private |
Insert a bucket at the end of the list.
| new_elt | The new element pushed at the end of the gum::List. |
Definition at line 1444 of file list_tpl.h.
References _deb_list_, _end_list_, _nb_elements_, gum::ListBucket< Val >::_prev_, and gum::ListBucket< Val >::_val_.
Referenced by _insert_(), _insert_(), pushBack(), and pushBack().
|
private |
Insert a bucket at the front of the list.
| new_elt | The new element pushed at the front of the gum::List. |
Definition at line 1427 of file list_tpl.h.
References _deb_list_, _end_list_, _nb_elements_, gum::ListBucket< Val >::_next_, and gum::ListBucket< Val >::_val_.
Referenced by pushFront(), and pushFront().
| INLINE Val & gum::List< Val >::back | ( | ) | const |
Returns a reference to last element of a list, if any.
| NotFound | exception is thrown if the list is empty. |
Definition at line 1711 of file list_tpl.h.
References _end_list_, _nb_elements_, and GUM_ERROR.
Referenced by emplace().
| INLINE ListIterator< Val > gum::List< Val >::begin | ( | ) |
Returns an unsafe iterator pointing to the beginning of the List.
Unsafe iterators are a little bit faster than safe iterators and they consume less memory. However, if the element they point to is erased, their dereference or their increment/decrement will produce a mess, probably a segfault. You should use them only when performance is an issue and if you are sure that they will never point to an element erased.
Definition at line 1360 of file list_tpl.h.
References ListIterator< Val >.
Referenced by map(), map(), and map().
| INLINE ListConstIterator< Val > gum::List< Val >::begin | ( | ) | const |
Returns an unsafe const iterator pointing to the beginning of the List.
Unsafe const iterators are a little bit faster than safe const iterators and they consume less memory. However, if the element they point to is erased, their dereference or their increment/decrement will produce a mess, probably a segfault. You should use them only when performance is an issue and if you are sure that they will never point to an element erased.
Returns an unsafe const iterator pointing to the beginning of the List.
Definition at line 1366 of file list_tpl.h.
References ListConstIterator< Val >.
| INLINE ListIteratorSafe< Val > gum::List< Val >::beginSafe | ( | ) |
Returns a safe iterator pointing to the beginning of the List.
Safe iterators are iterators whose state is updated by the list when the element they point to is erased. As such, in this case, they can throw an exception when we try to derefence them and they are able to perform a valid ++ or – step.
Definition at line 1348 of file list_tpl.h.
References ListIteratorSafe< Val >.
| INLINE ListConstIterator< Val > gum::List< Val >::cbegin | ( | ) | const |
Returns an unsafe const iterator pointing to the beginning of the List.
Unsafe const iterators are a little bit faster than safe const iterators and they consume less memory. However, if the element they point to is erased, their dereference or their increment/decrement will produce a mess, probably a segfault. You should use them only when performance is an issue and if you are sure that they will never point to an element erased.
Definition at line 1354 of file list_tpl.h.
References ListConstIterator< Val >.
| INLINE ListConstIteratorSafe< Val > gum::List< Val >::cbeginSafe | ( | ) | const |
Returns a safe const iterator pointing to the beginning of the List.
Safe const iterators are const iterators whose state is updated by the list when the element they point to is erased. As such, in this case, they can throw an exception when we try to derefence them and they are able to perform a valid ++ or – step.
Definition at line 1342 of file list_tpl.h.
|
noexcept |
Returns an unsafe const iterator pointing to the end of the List.
Unsafe const iterators are a little bit faster than safe const iterators and they consume less memory. However, if the element they point to is erased, their dereference or their increment/decrement will produce a mess, probably a segfault. You should use them only when performance is an issue and if you are sure that they will never point to an element erased.
Returns an unsafe const iterator pointing to the end of the List.
Definition at line 1294 of file list_tpl.h.
References ListConstIterator< Val >.
|
noexcept |
Returns a safe const iterator pointing to the end of the List.
Safe const iterators are const iterators whose state is updated by the list when the element they point to is erased. As such, in this case, they can throw an exception when we try to derefence them and they are able to perform a valid ++ or – step
Returns a safe const iterator pointing to the end of the List.
Definition at line 1282 of file list_tpl.h.
References ListConstIteratorSafe< Val >.
| void gum::List< Val >::clear | ( | ) |
Deletes all the elements of a chained list.
All the iterators of the list will be resetted to rend. The method runs in linear time of both the size of the list and the number of iterators attached to the List.
Definition at line 1154 of file list_tpl.h.
References _deb_list_, and _safe_iterators_.
Referenced by ~List(), emplace(), operator=(), and operator=().
| INLINE ListConstIterator< Val > gum::List< Val >::crbegin | ( | ) | const |
Returns an unsafe const iterator pointing to the last element of the List.
Unsafe iterators are a little bit faster than safe iterators and they consume less memory. However, if the element they point to is erased, their dereference or their increment/decrement will produce a mess, probably a segfault. You should use them only when performance is an issue and if you are sure that they will never point to an element erased.
Definition at line 1386 of file list_tpl.h.
References _nb_elements_, and ListConstIterator< Val >.
| INLINE ListConstIteratorSafe< Val > gum::List< Val >::crbeginSafe | ( | ) | const |
Returns a safe const iterator pointing to the last element of the List.
Safe const iterators are const iterators whose state is updated by the list when the element they point to is erased. As such, in this case, they can throw an exception when we try to derefence them and they are able to perform a valid ++ or – step.
Definition at line 1372 of file list_tpl.h.
References _nb_elements_, and ListConstIteratorSafe< Val >.
|
noexcept |
Returns an unsafe const iterator pointing just before the beginning of the List.
Unsafe const iterators are a little bit faster than safe const iterators and they consume less memory. However, if the element they point to is erased, their dereference or their increment/decrement will produce a mess, probably a segfault. You should use them only when performance is an issue and if you are sure that they will never point to an element erased.
Definition at line 1324 of file list_tpl.h.
References ListConstIterator< Val >.
|
noexcept |
Return a safe const iterator pointing just before the beginning of the List.
Safe const iterators are const iterators whose state is updated by the list when the element they point to is erased. As such, in this case, they can throw an exception when we try to derefence them and they are able to perform a valid ++ or – step.
Return a safe const iterator pointing just before the beginning of the List.
Definition at line 1312 of file list_tpl.h.
| Val & gum::List< Val >::emplace | ( | const const_iterator & | iter, |
| Args &&... | args ) |
Emplace a new element before a given iterator.
Emplace is a method that allows to construct directly an element of type Val by passing to its constructor all the arguments it needs. The first element of the list is at pos 0. After the insert, the element is placed precisely at pos if pos is less than the size of the list before insertion, else it is inserted at the end of the list.
| iter | The position in the list |
| args | The arguments passed to the constructor |
References emplace().
Referenced by emplace(), and emplace().
| INLINE Val & gum::List< Val >::emplace | ( | const const_iterator & | iter, |
| Args &&... | args ) |
Definition at line 1690 of file list_tpl.h.
| Val & gum::List< Val >::emplace | ( | const const_iterator_safe & | iter, |
| Args &&... | args ) |
Emplace a new element before a given safe iterator.
Emplace is a method that allows to construct directly an element of type Val by passing to its constructor all the arguments it needs. The first element of the list is at pos 0. After the insert, the element is placed precisely at pos if pos is less than the size of the list before insertion, else it is inserted at the end of the list.
| iter | The position in the list. |
| args | the arguments passed to the constructor. |
References List(), back(), clear(), emplace(), empty(), erase(), eraseAllVal(), eraseByVal(), exists(), front(), map(), popBack(), popFront(), size(), swap(), and toString().
| INLINE Val & gum::List< Val >::emplace | ( | const const_iterator_safe & | iter, |
| Args &&... | args ) |
Definition at line 1697 of file list_tpl.h.
| Val & gum::List< Val >::emplaceBack | ( | Args &&... | args | ) |
Emplace elements at the end of the chained list.
Emplace is a method that allows to construct directly an element of type Val by passing to its constructor all the arguments it needs
| Args | The emplaced arguments types. |
| args | The arguments passed to the constructor |
References emplaceBack(), and insert().
Referenced by emplaceBack().
| INLINE Val & gum::List< Val >::emplaceBack | ( | Args &&... | args | ) |
Definition at line 1508 of file list_tpl.h.
| Val & gum::List< Val >::emplaceFront | ( | Args &&... | args | ) |
Emplace elements at the beginning of the chained list.
Emplace is a method that allows to construct directly an element of type Val by passing to its constructor all the arguments it needs
| args | The arguments passed to the constructor. |
References emplaceFront(), and pushBack().
Referenced by emplaceFront().
| INLINE Val & gum::List< Val >::emplaceFront | ( | Args &&... | args | ) |
Definition at line 1482 of file list_tpl.h.
Returns a boolean indicating whether the chained list is empty.
Definition at line 1831 of file list_tpl.h.
References _nb_elements_.
Referenced by gum::prm::SVE< GUM_SCALAR >::_eliminateNodes_(), gum::prm::SVED< GUM_SCALAR >::_eliminateNodes_(), gum::prm::SVED< GUM_SCALAR >::_eliminateNodesDownward_(), gum::learning::Miic::_existsDirectedPath_(), gum::learning::SimpleMiic::_existsDirectedPath_(), gum::MeekRules::_existsDirectedPath_(), gum::BarrenNodesFinder::barrenNodes(), gum::BarrenNodesFinder::barrenNodes(), gum::ArcGraphPart::directedPath(), gum::ArcGraphPart::directedUnorientedPath(), emplace(), gum::InfluenceDiagram< GUM_SCALAR >::existsPathBetween(), gum::InfluenceDiagram< GUM_SCALAR >::getChildrenDecision_(), gum::DiGraph::hasDirectedPath(), gum::MixedGraph::hasMixedOrientedPath(), gum::UndiGraph::hasUndirectedCycle(), gum::MixedGraph::mixedOrientedPath(), gum::MixedGraph::mixedUnorientedPath(), gum::BayesBall::relevantTensors(), gum::dSeparationAlgorithm::relevantTensors(), gum::BayesBall::requisiteNodes(), gum::dSeparationAlgorithm::requisiteNodes(), gum::DAGCycleDetector::setDAG(), and gum::EdgeGraphPart::undirectedPath().
|
noexcept |
Returns an unsafe const iterator pointing to the end of the List.
Unsafe const iterators are a little bit faster than safe const iterators and they consume less memory. However, if the element they point to is erased, their dereference or their increment/decrement will produce a mess, probably a segfault. You should use them only when performance is an issue and if you are sure that they will never point to an element erased.
Definition at line 1306 of file list_tpl.h.
References ListConstIterator< Val >.
|
noexcept |
Returns an unsafe iterator pointing to the end of the List.
Unsafe iterators are a little bit faster than safe iterators and they consume less memory. However, if the element they point to is erased, their dereference or their increment/decrement will produce a mess, probably a segfault. You should use them only when performance is an issue and if you are sure that they will never point to an element erased.
Definition at line 1300 of file list_tpl.h.
References ListIterator< Val >.
Referenced by map(), map(), and map().
|
noexcept |
Returns a safe iterator pointing to the end of the List.
Safe iterators are iterators whose state is updated by the list when the element they point to is erased. As such, in this case, they can throw an exception when we try to derefence them and they are able to perform a valid ++ or – step.
Ceturns a safe iterator pointing to the end of the List.
Definition at line 1288 of file list_tpl.h.
References ListIteratorSafe< Val >.
| INLINE void gum::List< Val >::erase | ( | const const_iterator_safe & | iter | ) |
Erases the element of the List pointed to by the safe const iterator.
If the element cannot be found, i.e., it has already been erased or the iterator points to end/rend, the function returns without throwing any exception. It runs in linear time in the size of the list.
| iter | An iterator pointing to the element to remove. |
Definition at line 1787 of file list_tpl.h.
References _erase_(), and gum::ListConstIteratorSafe< Val >::_getBucket_().
| INLINE void gum::List< Val >::erase | ( | const iterator_safe & | iter | ) |
Erases the element of the List pointed to by the safe iterator.
If the element cannot be found, i.e., it has already been erased or the iterator points to end/rend, the function returns without throwing any exception. It runs in linear time in the size of the list.
| iter | An iterator pointing to the element to remove. |
Definition at line 1781 of file list_tpl.h.
References _erase_(), and gum::ListConstIteratorSafe< Val >::_getBucket_().
Erases the ith element of the List (the first one is in position 0).
If the element cannot be found, the function returns without throwing any exception. It runs in linear time in the size of the list.
| i | The position in the list of the element we wish to remove. |
Definition at line 1772 of file list_tpl.h.
References _erase_(), _getIthBucket_(), and _nb_elements_.
Referenced by gum::prm::StructuredInference< GUM_SCALAR >::_reduceAloneInstances_(), and emplace().
| INLINE void gum::List< Val >::eraseAllVal | ( | const Val & | val | ) |
erases all the elements encountered with a given value
If no element equal to val can be found, the function returns without throwing any exception.
Comparisons between Val instances are performed through == operators.
| val | the value of the element we wish to remove. |
Definition at line 1808 of file list_tpl.h.
References _deb_list_, and _erase_().
Referenced by emplace().
| INLINE void gum::List< Val >::eraseByVal | ( | const Val & | val | ) |
erases the first element encountered with a given value.
If no element equal to val can be found, the function returns without throwing any exception. It runs in linear time both in the size of the list and in the number of iterators referenced in the list. Comparisons between Val instances are performed through == operators.
| val | The value of the element we wish to remove. |
Definition at line 1802 of file list_tpl.h.
References _erase_(), and _getBucket_().
Referenced by emplace().
Checks whether there exists a given element in the list.
This method runs in linear time.
Comparisons between Val instances are performed through == operators.
| val | the value of the element we wish to check the existence of. |
Definition at line 1725 of file list_tpl.h.
References _deb_list_.
Referenced by emplace(), gum::EssentialGraph::toDot(), gum::PDAG::toDot(), and gum::UndiGraph::toDot().
| INLINE Val & gum::List< Val >::front | ( | ) | const |
Returns a reference to first element of a list, if any.
| NotFound | exception is thrown if the list is empty. |
Definition at line 1703 of file list_tpl.h.
References _deb_list_, _nb_elements_, and GUM_ERROR.
Referenced by gum::prm::SVE< GUM_SCALAR >::_eliminateNodes_(), gum::prm::SVED< GUM_SCALAR >::_eliminateNodes_(), gum::prm::SVED< GUM_SCALAR >::_eliminateNodesDownward_(), gum::learning::Miic::_existsDirectedPath_(), gum::learning::SimpleMiic::_existsDirectedPath_(), gum::MeekRules::_existsDirectedPath_(), gum::BarrenNodesFinder::barrenNodes(), gum::BarrenNodesFinder::barrenNodes(), gum::ArcGraphPart::directedPath(), gum::ArcGraphPart::directedUnorientedPath(), emplace(), gum::InfluenceDiagram< GUM_SCALAR >::existsPathBetween(), gum::InfluenceDiagram< GUM_SCALAR >::getChildrenDecision_(), gum::DiGraph::hasDirectedPath(), gum::MixedGraph::hasMixedOrientedPath(), gum::UndiGraph::hasUndirectedCycle(), gum::MixedGraph::mixedOrientedPath(), gum::MixedGraph::mixedUnorientedPath(), gum::BayesBall::relevantTensors(), gum::dSeparationAlgorithm::relevantTensors(), gum::BayesBall::requisiteNodes(), gum::dSeparationAlgorithm::requisiteNodes(), gum::DAGCycleDetector::setDAG(), and gum::EdgeGraphPart::undirectedPath().
| INLINE Val & gum::List< Val >::insert | ( | const const_iterator & | iter, |
| const Val & | val, | ||
| location | place = location::BEFORE ) |
Inserts a new element before or after a given iterator.
| iter | The iterator pointing where to inser the new element. |
| val | The value to insert. |
| place | Defines where to insert the new element relatively to iter. |
Definition at line 1676 of file list_tpl.h.
References _createBucket_(), and _insert_().
| INLINE Val & gum::List< Val >::insert | ( | const const_iterator & | iter, |
| Val && | val, | ||
| location | place = location::BEFORE ) |
Inserts an rvalue before or after a given iterator.
| iter | The iterator pointing where to inser the new element. |
| val | The value to insert. |
| place | Defines where to insert the new element relatively to iter. |
Definition at line 1683 of file list_tpl.h.
References _createBucket_(), and _insert_().
| INLINE Val & gum::List< Val >::insert | ( | const const_iterator_safe & | iter, |
| const Val & | val, | ||
| location | place = location::BEFORE ) |
Inserts a new element before or after a given iterator.
| iter | The iterator pointing where to inser the new element. |
| val | The value to insert. |
| place | Defines where to insert the new element relatively to iter. |
Definition at line 1652 of file list_tpl.h.
References _createBucket_(), _insert_(), gum::ListConstIteratorSafe< Val >::_list_, and GUM_ERROR.
| INLINE Val & gum::List< Val >::insert | ( | const const_iterator_safe & | iter, |
| Val && | val, | ||
| location | place = location::BEFORE ) |
Inserts an rvalue before or after a given iterator.
| iter | The iterator pointing where to inser the new element. |
| val | The value to insert. |
| place | Defines where to insert the new element relatively to iter. |
Definition at line 1664 of file list_tpl.h.
References _createBucket_(), _insert_(), gum::ListConstIteratorSafe< Val >::_list_, and GUM_ERROR.
| INLINE Val & gum::List< Val >::insert | ( | const Val & | val | ) |
Inserts a new element at the end of the chained list (alias of pushBack).
| val | The value inserted. |
Definition at line 1515 of file list_tpl.h.
References pushBack().
Referenced by gum::prm::SVE< GUM_SCALAR >::_eliminateNodes_(), gum::prm::SVED< GUM_SCALAR >::_eliminateNodes_(), gum::prm::SVED< GUM_SCALAR >::_eliminateNodesDownward_(), gum::prm::SVE< GUM_SCALAR >::_eliminateNodesUpward_(), gum::prm::gspan::StrictSearch< GUM_SCALAR >::_elimination_cost_(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::_insertEvidence_(), gum::prm::StructuredInference< GUM_SCALAR >::_reduceAloneInstances_(), gum::BarrenNodesFinder::barrenNodes(), gum::BarrenNodesFinder::barrenNodes(), emplaceBack(), gum::UndiGraph::hasUndirectedCycle(), gum::BayesBall::relevantTensors(), gum::dSeparationAlgorithm::relevantTensors(), gum::BayesBall::requisiteNodes(), gum::dSeparationAlgorithm::requisiteNodes(), gum::DAGCycleDetector::setDAG(), gum::EssentialGraph::toDot(), gum::PDAG::toDot(), and gum::UndiGraph::toDot().
Inserts a new element at the ith pos of the chained list.
The first element of the list is at pos 0. After the insert, the element is placed precisely at pos if pos is less than the size of the list before insertion, else it is inserted at the end of the list.
| pos | The position where to inser the new element. |
| val | The value to insert. |
Definition at line 1577 of file list_tpl.h.
References _createBucket_(), _getIthBucket_(), _insertBefore_(), _nb_elements_, and pushBack().
Insert an rvalue at the ith pos of the chained list.
The first element of the list is at pos 0. After the insert, the element is placed precisely at pos if pos is less than the size of the list before insertion, else it is inserted at the end of the list.
| pos | The position where to inser the new element. |
| val | The value to insert. |
Definition at line 1586 of file list_tpl.h.
References _createBucket_(), _getIthBucket_(), _insertBefore_(), _nb_elements_, and pushBack().
| INLINE Val & gum::List< Val >::insert | ( | Val && | val | ) |
Inserts a new element at the end of the chained list (alias of pushBack).
| val | The value inserted. |
Definition at line 1521 of file list_tpl.h.
References pushBack().
| List< Mount > gum::List< Val >::map | ( | const Mount & | mount | ) | const |
Creates a list of mountains with a given value from a list of val.
| mount | the value taken by all the elements of the resulting list |
| Mount | The type of mountains. |
Definition at line 1901 of file list_tpl.h.
References List(), _nb_elements_, and pushBack().
| List< Mount > gum::List< Val >::map | ( | Mount(* | f )(const Val &) | ) | const |
Creates a list of mountains from a list of val.
| f | A function that maps any Val element into a Mount |
| Mount | The type of mountains. |
Definition at line 1886 of file list_tpl.h.
References List(), begin(), end(), and pushBack().
| List< Mount > gum::List< Val >::map | ( | Mount(* | f )(Val &) | ) | const |
Creates a list of mountains from a list of val.
| f | A function that maps any Val element into a Mount |
| Mount | The type of mountains. |
Definition at line 1871 of file list_tpl.h.
References List(), begin(), end(), and pushBack().
| List< Mount > gum::List< Val >::map | ( | Mount(* | f )(Val) | ) | const |
Creates a list of mountains from a list of val.
| f | A function that maps any Val element into a Mount |
| Mount | The type of mountains. |
Definition at line 1856 of file list_tpl.h.
References List(), begin(), end(), and pushBack().
Referenced by emplace().
Checks whether two lists are different (different elements or orders).
This method runs in time linear in the number of elements of the list.
Definition at line 1942 of file list_tpl.h.
References List(), and gum::operator==().
| INLINE Val & gum::List< Val >::operator+= | ( | const Val & | val | ) |
Inserts a new element at the end of the list (alias of pushBack).
This enables writing code like list += xxx; to add element xxx to the list.
| val | Tha value inserted int the list. |
Definition at line 1915 of file list_tpl.h.
References pushBack().
| INLINE Val & gum::List< Val >::operator+= | ( | Val && | val | ) |
Inserts a new element at the end of the list (alias of pushBack).
This enables writing code like list += xxx; to add element xxx to the list.
| val | Tha value inserted int the list. |
Definition at line 1922 of file list_tpl.h.
References pushBack().
Copy operator.
The new list and that which is copied do not share the elements: the new list contains new instances of the values stored in the list to be copied. Of course if these values are pointers, the new values point toward the same elements. The List on which the operator is applied keeps its iterator's list. Of course, if it previously contained some elements, those are removed prior to the copy. This operator runs in linear time.
| src | the list the content of which will be copied into the current List. |
Definition at line 1238 of file list_tpl.h.
References List(), _copy_elements_(), and clear().
Move operator.
| src | The gum::List to move. |
Definition at line 1256 of file list_tpl.h.
References List(), _deb_list_, _end_list_, _nb_elements_, _safe_iterators_, and clear().
Checks whether two lists are identical (same elements in the same order).
This method runs in time linear in the number of elements of the list.
Definition at line 1928 of file list_tpl.h.
References List(), _deb_list_, and _nb_elements_.
Returns the ith element in the current chained list.
The first of the list element has index 0.
This method runs in linear time.
| i | The position of the element in the list (0 = first element). |
| NotFound | Raised if the element to be retrieved does not exist. |
Definition at line 1948 of file list_tpl.h.
References _getIthBucket_(), _nb_elements_, and GUM_ERROR.
Returns the const ith element in the current chained list.
The first of the list element has index 0.
This method runs in linear time.
| i | the position of the element in the list (0 = first element). |
| NotFound | Raised if the element to be retrieved does not exist. |
Definition at line 1957 of file list_tpl.h.
References _getIthBucket_(), _nb_elements_, and GUM_ERROR.
| INLINE void gum::List< Val >::popBack | ( | ) |
Removes the last element of a List, if any.
When the list is empty, it does not do anything.
Definition at line 1819 of file list_tpl.h.
References _end_list_, and _erase_().
Referenced by emplace().
| INLINE void gum::List< Val >::popFront | ( | ) |
Removes the first element of a List, if any.
When the list is empty, it does not do anything.
Definition at line 1825 of file list_tpl.h.
References _deb_list_, and _erase_().
Referenced by gum::prm::SVE< GUM_SCALAR >::_eliminateNodes_(), gum::prm::SVED< GUM_SCALAR >::_eliminateNodes_(), gum::prm::SVED< GUM_SCALAR >::_eliminateNodesDownward_(), gum::learning::Miic::_existsDirectedPath_(), gum::learning::SimpleMiic::_existsDirectedPath_(), gum::MeekRules::_existsDirectedPath_(), gum::BarrenNodesFinder::barrenNodes(), gum::BarrenNodesFinder::barrenNodes(), gum::ArcGraphPart::directedPath(), gum::ArcGraphPart::directedUnorientedPath(), emplace(), gum::InfluenceDiagram< GUM_SCALAR >::existsPathBetween(), gum::InfluenceDiagram< GUM_SCALAR >::getChildrenDecision_(), gum::DiGraph::hasDirectedPath(), gum::MixedGraph::hasMixedOrientedPath(), gum::UndiGraph::hasUndirectedCycle(), gum::MixedGraph::mixedOrientedPath(), gum::MixedGraph::mixedUnorientedPath(), gum::BayesBall::relevantTensors(), gum::dSeparationAlgorithm::relevantTensors(), gum::BayesBall::requisiteNodes(), gum::dSeparationAlgorithm::requisiteNodes(), gum::DAGCycleDetector::setDAG(), and gum::EdgeGraphPart::undirectedPath().
| Val & gum::List< Val >::push_back | ( | Args &&... | args | ) |
An alias for pushBack used for STL compliance.
Defining push_back allows using, for instance, BackInserters.
| Args | The emplace arguments type. |
| args | The emplace arguments values. |
References push_back().
Referenced by gum::prm::SVE< GUM_SCALAR >::_initLiftedNodes_(), gum::prm::StructuredInference< GUM_SCALAR >::_reduceAloneInstances_(), gum::AggregatorDecomposition< GUM_SCALAR >::addDepthLayer_(), gum::AggregatorDecomposition< GUM_SCALAR >::decomposeAggregator_(), and push_back().
| INLINE Val & gum::List< Val >::push_back | ( | Args &&... | args | ) |
Definition at line 1501 of file list_tpl.h.
| Val & gum::List< Val >::push_front | ( | Args &&... | args | ) |
An alias for pushFront used for STL compliance.
Defining push_front allows using, for instance, FrontInserters.
| Args | The emplace values type. |
| args | The emplace values. |
References push_front().
Referenced by push_front().
| INLINE Val & gum::List< Val >::push_front | ( | Args &&... | args | ) |
Definition at line 1475 of file list_tpl.h.
| INLINE Val & gum::List< Val >::pushBack | ( | const Val & | val | ) |
Inserts a new element (a copy) at the end of the chained list.
The value passed in argument is not actually inserted into the list: this is a copy of this value that is inserted. The method runs in constant time.
| val | The value pushed back. |
Definition at line 1488 of file list_tpl.h.
References _createBucket_(), and _pushBack_().
Referenced by List(), gum::learning::Miic::_existsDirectedPath_(), gum::learning::SimpleMiic::_existsDirectedPath_(), gum::MeekRules::_existsDirectedPath_(), gum::BayesNetFactory< GUM_SCALAR >::_fillProbaWithValuesTable_(), gum::prm::SVED< GUM_SCALAR >::_initLiftedNodes_(), gum::ArcGraphPart::directedPath(), gum::ArcGraphPart::directedUnorientedPath(), emplaceFront(), gum::InfluenceDiagram< GUM_SCALAR >::existsPathBetween(), gum::InfluenceDiagram< GUM_SCALAR >::getChildrenDecision_(), gum::DiGraph::hasDirectedPath(), gum::MixedGraph::hasMixedOrientedPath(), insert(), insert(), insert(), insert(), gum::Set< Key >::listMap(), map(), map(), map(), map(), gum::MixedGraph::mixedOrientedPath(), gum::MixedGraph::mixedUnorientedPath(), operator+=(), operator+=(), and gum::EdgeGraphPart::undirectedPath().
| INLINE Val & gum::List< Val >::pushBack | ( | Val && | val | ) |
Inserts a new element (a move) at the end of the chained list.
The value passed in argument is not actually inserted into the list: this is a copy of this value that is inserted. The method runs in constant time.
| val | The value pushed back. |
Definition at line 1494 of file list_tpl.h.
References _createBucket_(), and _pushBack_().
| INLINE Val & gum::List< Val >::pushFront | ( | const Val & | val | ) |
Inserts a new element (a copy) at the beginning of the chained list.
The value passed in argument is not actually inserted into the list: this is a copy of this value that is inserted. The method runs in constant time.
| val | The valus pushed at the front. |
Definition at line 1462 of file list_tpl.h.
References _createBucket_(), and _pushFront_().
| INLINE Val & gum::List< Val >::pushFront | ( | Val && | val | ) |
Inserts a new element (a move) at the beginning of the chained list.
| val | The valus pushed at the front. |
Definition at line 1468 of file list_tpl.h.
References _createBucket_(), and _pushFront_().
| INLINE ListIterator< Val > gum::List< Val >::rbegin | ( | ) |
Returns an unsafe iterator pointing to the last element of the List.
Unsafe iterators are a little bit faster than safe iterators and they consume less memory. However, if the element they point to is erased, their dereference or their increment/decrement will produce a mess, probably a segfault. You should use them only when performance is an issue and if you are sure that they will never point to an element erased.
Definition at line 1393 of file list_tpl.h.
References _nb_elements_, and ListIterator< Val >.
| INLINE ListConstIterator< Val > gum::List< Val >::rbegin | ( | ) | const |
Returns an unsafe const iterator pointing to the last element of the List.
Unsafe iterators are a little bit faster than safe iterators and they consume less memory. However, if the element they point to is erased, their dereference or their increment/decrement will produce a mess, probably a segfault. You should use them only when performance is an issue and if you are sure that they will never point to an element erased.
Definition at line 1400 of file list_tpl.h.
References _nb_elements_, and ListConstIterator< Val >.
| INLINE ListIteratorSafe< Val > gum::List< Val >::rbeginSafe | ( | ) |
Returns a safe iterator pointing to the last element of the List.
Safe iterators are iterators whose state is updated by the list when the element they point to is erased. As such, in this case, they can throw an exception when we try to derefence them and they are able to perform a valid ++ or – step.
Definition at line 1379 of file list_tpl.h.
References _nb_elements_, and ListIteratorSafe< Val >.
|
noexcept |
Returns an unsafe const iterator pointing just before the beginning of the List.
Unsafe const iterators are a little bit faster than safe const iterators and they consume less memory. However, if the element they point to is erased, their dereference or their increment/decrement will produce a mess, probably a segfault. You should use them only when performance is an issue and if you are sure that they will never point to an element erased.
Definition at line 1336 of file list_tpl.h.
References ListConstIterator< Val >.
|
noexcept |
Returns an unsafe iterator pointing just before the beginning of the List.
Unsafe iterators are a little bit faster than safe iterators and they consume less memory. However, if the element they point to is erased, their dereference or their increment/decrement will produce a mess, probably a segfault. You should use them only when performance is an issue and if you are sure that they will never point to an element erased.
Returns an unsafe iterator pointing just before the beginning of the List.
Definition at line 1330 of file list_tpl.h.
References ListIterator< Val >.
|
noexcept |
Returns a safe iterator pointing just before the beginning of the List.
Safe iterators are iterators whose state is updated by the list when the element they point to is erased. As such, in this case, they can throw an exception when we try to derefence them and they are able to perform a valid ++ or – step.
Definition at line 1318 of file list_tpl.h.
References ListIteratorSafe< Val >.
Returns the number of elements in the list.
This method runs in constant time.
Definition at line 1719 of file list_tpl.h.
References _nb_elements_.
Referenced by gum::BayesNetFactory< GUM_SCALAR >::_fillProbaWithValuesTable_(), gum::BayesNetFactory< GUM_SCALAR >::_increment_(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::_insertEvidence_(), gum::prm::StructuredInference< GUM_SCALAR >::_reduceAloneInstances_(), and emplace().
Swap the current list with another one.
| other_list | The list to swap elements with. |
Definition at line 1966 of file list_tpl.h.
References List(), _deb_list_, _end_list_, _nb_elements_, and _safe_iterators_.
Referenced by emplace().
| std::string gum::List< Val >::toString | ( | ) | const |
Converts a list into a string.
Definition at line 1837 of file list_tpl.h.
References _deb_list_.
Referenced by emplace(), and gum::operator<<().
|
friend |
|
friend |
ListIterator should be a friend to optimize access to elements.
Definition at line 1385 of file list.h.
Referenced by cendSafe(), and crbeginSafe().
|
friend |
|
friend |
ListIterator should be a friend to optimize access to elements.
Definition at line 1385 of file list.h.
Referenced by beginSafe(), endSafe(), rbeginSafe(), and rendSafe().
|
private |
A pointer on the first element of the chained list.
Definition at line 1254 of file list.h.
Referenced by List(), gum::ListConstIterator< Val >::ListConstIterator(), _copy_elements_(), _erase_(), _getBucket_(), _getIthBucket_(), _insertBefore_(), _pushBack_(), _pushFront_(), clear(), eraseAllVal(), exists(), front(), operator=(), operator==(), popFront(), swap(), and toString().
|
private |
A pointer on the last element of the chained list.
Definition at line 1257 of file list.h.
Referenced by _copy_elements_(), _erase_(), _getIthBucket_(), _insertAfter_(), _pushBack_(), _pushFront_(), back(), operator=(), popBack(), and swap().
The number of elements in the list.
Definition at line 1260 of file list.h.
Referenced by gum::ListConstIterator< Val >::ListConstIterator(), _copy_elements_(), _erase_(), _getIthBucket_(), _insertAfter_(), _insertBefore_(), _pushBack_(), _pushFront_(), back(), crbegin(), crbeginSafe(), empty(), erase(), front(), insert(), insert(), map(), operator=(), operator==(), operator[](), operator[](), rbegin(), rbegin(), rbeginSafe(), size(), and swap().
|
mutableprivate |