mCRL2
Loading...
Searching...
No Matches
mcrl2::lts::detail::simple_list< T > Class Template Reference

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

entryfirst
 pointer to the beginning of the list
 

Detailed Description

template<class T>
class mcrl2::lts::detail::simple_list< T >

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.

Constructor & Destructor Documentation

◆ simple_list()

template<class T >
mcrl2::lts::detail::simple_list< T >::simple_list ( )
inline

constructor

Definition at line 492 of file simple_list.h.

Member Function Documentation

◆ back()

template<class T >
T & mcrl2::lts::detail::simple_list< T >::back ( )
inline

return a reference to the last element of the list

Definition at line 547 of file simple_list.h.

◆ before_end() [1/2]

template<class T >
iterator mcrl2::lts::detail::simple_list< T >::before_end ( )
inline

return an iterator to the last element of the list

Definition at line 530 of file simple_list.h.

◆ before_end() [2/2]

template<class T >
const_iterator mcrl2::lts::detail::simple_list< T >::before_end ( ) const
inline

Definition at line 535 of file simple_list.h.

◆ begin() [1/2]

template<class T >
iterator mcrl2::lts::detail::simple_list< T >::begin ( )
inline

return an iterator to the first element of the list

Definition at line 515 of file simple_list.h.

◆ begin() [2/2]

template<class T >
const_iterator mcrl2::lts::detail::simple_list< T >::begin ( ) const
inline

return a constant iterator to the first element of the list

Definition at line 527 of file simple_list.h.

◆ cbegin()

template<class T >
const_iterator mcrl2::lts::detail::simple_list< T >::cbegin ( ) const
inline

return a constant iterator to the first element of the list

Definition at line 521 of file simple_list.h.

◆ cend()

template<class T >
static const_iterator mcrl2::lts::detail::simple_list< T >::cend ( )
inlinestatic

return a constant iterator past the last element of the list

Definition at line 524 of file simple_list.h.

◆ check_linked_list()

template<class T >
bool mcrl2::lts::detail::simple_list< T >::check_linked_list ( ) const
inline

Definition at line 552 of file simple_list.h.

◆ emplace()

template<class T >
template<class... Args>
iterator mcrl2::lts::detail::simple_list< T >::emplace ( iterator  pos,
Args &&...  args 
)
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.

◆ emplace_after()

template<class T >
template<class... Args>
iterator mcrl2::lts::detail::simple_list< T >::emplace_after ( iterator  pos,
Args &&...  args 
)
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.

◆ emplace_back()

template<class T >
template<class... Args>
iterator mcrl2::lts::detail::simple_list< T >::emplace_back ( Args &&...  args)
inline

Puts a new element at the end.

Definition at line 625 of file simple_list.h.

◆ emplace_front()

template<class T >
template<class... Args>
iterator mcrl2::lts::detail::simple_list< T >::emplace_front ( Args &&...  args)
inline

construct a new list entry at the beginning

Definition at line 680 of file simple_list.h.

◆ empty()

template<class T >
bool mcrl2::lts::detail::simple_list< T >::empty ( ) const
inline

return true iff the list is empty

Definition at line 512 of file simple_list.h.

◆ end()

template<class T >
static iterator mcrl2::lts::detail::simple_list< T >::end ( )
inlinestatic

return an iterator past the last element of the list

Definition at line 518 of file simple_list.h.

◆ erase()

template<class T >
void mcrl2::lts::detail::simple_list< T >::erase ( iterator const  pos)
inline

erase an element from a list

Definition at line 861 of file simple_list.h.

◆ front()

template<class T >
T & mcrl2::lts::detail::simple_list< T >::front ( )
inline

return a reference to the first element of the list

Definition at line 541 of file simple_list.h.

◆ get_pool()

template<class T >
static my_pool< entry > & mcrl2::lts::detail::simple_list< T >::get_pool ( )
inlinestatic

Definition at line 330 of file simple_list.h.

◆ next() [1/2]

template<class T >
const_iterator mcrl2::lts::detail::simple_list< T >::next ( const_iterator  pos) const
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.

◆ next() [2/2]

template<class T >
iterator mcrl2::lts::detail::simple_list< T >::next ( iterator  pos) const
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.

◆ operator==()

template<class T >
bool mcrl2::lts::detail::simple_list< T >::operator== ( const simple_list< T > &  other) const
inline

Definition at line 960 of file simple_list.h.

◆ prev() [1/2]

template<class T >
const_iterator mcrl2::lts::detail::simple_list< T >::prev ( const_iterator  pos) const
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.

◆ prev() [2/2]

template<class T >
iterator mcrl2::lts::detail::simple_list< T >::prev ( iterator  pos) const
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.

◆ splice()

template<class T >
void mcrl2::lts::detail::simple_list< T >::splice ( iterator const  to_pos,
simple_list< T > &  from_list,
iterator const  from_pos 
)
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.

◆ splice_to_after()

template<class T >
void mcrl2::lts::detail::simple_list< T >::splice_to_after ( iterator const  to_pos,
simple_list< T > &  from_list,
iterator const  from_pos 
)
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.

Member Data Documentation

◆ first

template<class T >
entry* mcrl2::lts::detail::simple_list< T >::first
private

pointer to the beginning of the list

Definition at line 326 of file simple_list.h.


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