|
mCRL2
|
a simple implementation of lists More...
#include <simple_list.h>
Classes | |
| class | const_iterator |
| constant iterator class for simple_list More... | |
| class | entry |
| list entry More... | |
| class | iterator |
| iterator class for simple_list More... | |
| class | iterator_or_null |
| class that stores either an iterator or a null value More... | |
Public Member Functions | |
| simple_list () | |
| constructor | |
| bool | empty () const |
| return true iff the list is empty | |
| iterator | begin () |
| return an iterator to the first element of the list | |
| const_iterator | cbegin () const |
| return a constant iterator to the first element of the list | |
| const_iterator | begin () const |
| return a constant iterator to the first element of the list | |
| iterator | before_end () |
| return an iterator to the last element of the list | |
| const_iterator | before_end () const |
| T & | front () |
| return a reference to the first element of the list | |
| T & | back () |
| return a reference to the last element of the list | |
| bool | check_linked_list () const |
| template<class... Args> | |
| iterator | emplace (iterator pos, Args &&... args) |
| construct a new list entry before pos | |
| template<class... Args> | |
| iterator | emplace_back (Args &&... args) |
| Puts a new element at the end. | |
| template<class... Args> | |
| iterator | emplace_after (iterator pos, Args &&... args) |
| construct a new list entry after pos | |
| template<class... Args> | |
| iterator | emplace_front (Args &&... args) |
| construct a new list entry at the beginning | |
| void | splice_to_after (iterator const to_pos, simple_list< T > &from_list, iterator const from_pos) |
| void | splice (iterator const to_pos, simple_list< T > &from_list, iterator const from_pos) |
| move a list entry from one position to another (possibly in a different list) The function moves the element pointed at by from_pos (that is in the list indicated by the 2nd parameter) just before position to_pos (that is in this list). If to_pos == end(), move the element to the end of this list. | |
| void | erase (iterator const pos) |
| erase an element from a list | |
| iterator | next (iterator pos) const |
| const_iterator | next (const_iterator pos) const |
| iterator | prev (iterator pos) const |
| const_iterator | prev (const_iterator pos) const |
| bool | operator== (const simple_list &other) const |
Static Public Member Functions | |
| static my_pool< entry > & | get_pool () |
| static iterator | end () |
| return an iterator past the last element of the list | |
| static const_iterator | cend () |
| return a constant iterator past the last element of the list | |
Private Attributes | |
| entry * | first |
| pointer to the beginning of the list | |
a simple implementation of lists
This class simplifies lists: It assumes that list entries are trivially destructible, and it does not store the size of a list. Therefore, the destructor, erase() and splice() can be simplified. Also, the simple_list object itself is trivially destructible if the pool allocator is used; therefore, destroying a block_t object becomes trivial as well.
Definition at line 296 of file simple_list.h.
|
inline |
constructor
Definition at line 494 of file simple_list.h.
|
inline |
return a reference to the last element of the list
Definition at line 549 of file simple_list.h.
|
inline |
return an iterator to the last element of the list
Definition at line 532 of file simple_list.h.
|
inline |
Definition at line 537 of file simple_list.h.
|
inline |
return an iterator to the first element of the list
Definition at line 517 of file simple_list.h.
|
inline |
return a constant iterator to the first element of the list
Definition at line 529 of file simple_list.h.
|
inline |
return a constant iterator to the first element of the list
Definition at line 523 of file simple_list.h.
|
inlinestatic |
return a constant iterator past the last element of the list
Definition at line 526 of file simple_list.h.
|
inline |
Definition at line 554 of file simple_list.h.
|
inline |
construct a new list entry before pos
If pos==end(), construct a new list entry at the end
Definition at line 579 of file simple_list.h.
|
inline |
construct a new list entry after pos
if pos==end(), the new list entry is created at the front.
Definition at line 636 of file simple_list.h.
|
inline |
Puts a new element at the end.
Definition at line 627 of file simple_list.h.
|
inline |
construct a new list entry at the beginning
Definition at line 682 of file simple_list.h.
|
inline |
return true iff the list is empty
Definition at line 514 of file simple_list.h.
|
inlinestatic |
return an iterator past the last element of the list
Definition at line 520 of file simple_list.h.
|
inline |
erase an element from a list
Definition at line 863 of file simple_list.h.
|
inline |
return a reference to the first element of the list
Definition at line 543 of file simple_list.h.
|
inlinestatic |
Definition at line 332 of file simple_list.h.
|
inline |
The function computes the successor of pos in the list. If pos is the last element of the list, it returns end(). It is an error if pos==end() or if pos is not in the list.
Definition at line 926 of file simple_list.h.
|
inline |
The function computes the successor of pos in the list. If pos is the last element of the list, it returns end(). It is an error if pos==end() or if pos is not in the list.
Definition at line 908 of file simple_list.h.
|
inline |
Definition at line 962 of file simple_list.h.
|
inline |
The function computes the predecessor of pos in the list. If pos is at the beginning of the list, it returns end(). It is an error if pos==end() or if pos is not in the list.
Definition at line 953 of file simple_list.h.
|
inline |
The function computes the predecessor of pos in the list. If pos is at the beginning of the list, it returns end(). It is an error if pos==end() or if pos is not in the list.
Definition at line 941 of file simple_list.h.
|
inline |
move a list entry from one position to another (possibly in a different list) The function moves the element pointed at by from_pos (that is in the list indicated by the 2nd parameter) just before position to_pos (that is in this list). If to_pos == end(), move the element to the end of this list.
Definition at line 779 of file simple_list.h.
|
inline |
The function moves the element pointed at by from_pos (that is in the list indicated by the 2nd parameter) just after position to_pos (that is in this list). If to_pos == end(), move the element to the beginning of this list.
Definition at line 692 of file simple_list.h.
|
private |
pointer to the beginning of the list
Definition at line 328 of file simple_list.h.