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 |
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 295 of file simple_list.h.
|
inline |
constructor
Definition at line 471 of file simple_list.h.
|
inline |
return a reference to the last element of the list
Definition at line 525 of file simple_list.h.
|
inline |
return an iterator to the last element of the list
Definition at line 508 of file simple_list.h.
|
inline |
Definition at line 513 of file simple_list.h.
|
inline |
return an iterator to the first element of the list
Definition at line 493 of file simple_list.h.
|
inline |
return a constant iterator to the first element of the list
Definition at line 505 of file simple_list.h.
|
inline |
return a constant iterator to the first element of the list
Definition at line 499 of file simple_list.h.
|
inlinestatic |
return a constant iterator past the last element of the list
Definition at line 502 of file simple_list.h.
|
inline |
Definition at line 531 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 557 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 614 of file simple_list.h.
|
inline |
Puts a new element at the end.
Definition at line 605 of file simple_list.h.
|
inline |
construct a new list entry at the beginning
Definition at line 660 of file simple_list.h.
|
inline |
return true iff the list is empty
Definition at line 490 of file simple_list.h.
|
inlinestatic |
return an iterator past the last element of the list
Definition at line 496 of file simple_list.h.
|
inline |
erase an element from a list
Definition at line 841 of file simple_list.h.
|
inline |
return a reference to the first element of the list
Definition at line 519 of file simple_list.h.
|
inlinestatic |
Definition at line 331 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 904 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 886 of file simple_list.h.
|
inline |
Definition at line 957 of file simple_list.h.
|
inline |
Definition at line 940 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 931 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 919 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 757 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 670 of file simple_list.h.
|
private |
pointer to the beginning of the list
Definition at line 327 of file simple_list.h.