|
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 294 of file simple_list.h.
|
inline |
constructor
Definition at line 492 of file simple_list.h.
|
inline |
return a reference to the last element of the list
Definition at line 547 of file simple_list.h.
|
inline |
return an iterator to the last element of the list
Definition at line 530 of file simple_list.h.
|
inline |
Definition at line 535 of file simple_list.h.
|
inline |
return an iterator to the first element of the list
Definition at line 515 of file simple_list.h.
|
inline |
return a constant iterator to the first element of the list
Definition at line 527 of file simple_list.h.
|
inline |
return a constant iterator to the first element of the list
Definition at line 521 of file simple_list.h.
|
inlinestatic |
return a constant iterator past the last element of the list
Definition at line 524 of file simple_list.h.
|
inline |
Definition at line 552 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 577 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 634 of file simple_list.h.
|
inline |
Puts a new element at the end.
Definition at line 625 of file simple_list.h.
|
inline |
construct a new list entry at the beginning
Definition at line 680 of file simple_list.h.
|
inline |
return true iff the list is empty
Definition at line 512 of file simple_list.h.
|
inlinestatic |
return an iterator past the last element of the list
Definition at line 518 of file simple_list.h.
|
inline |
erase an element from a list
Definition at line 861 of file simple_list.h.
|
inline |
return a reference to the first element of the list
Definition at line 541 of file simple_list.h.
|
inlinestatic |
Definition at line 330 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 924 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 906 of file simple_list.h.
|
inline |
Definition at line 960 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 951 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 939 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 777 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 690 of file simple_list.h.
|
private |
pointer to the beginning of the list
Definition at line 326 of file simple_list.h.