LIFOStack< T > Class Template Reference

A LIFO stack based on a singly-linked list. More...

Inheritance diagram for LIFOStack< T >:
[legend]
Collaboration diagram for LIFOStack< T >:
[legend]

Public Member Functions

const Ttop () const
 Const reference to the top element. More...
 
const Tbottom () const
 Const reference to the bottom element. More...
 
void push (const T &elem)
 Push an element onto the front of the stack. More...
 
void push (T &&elem)
 Move an element onto the front of the stack. More...
 
T pop ()
 Pop the top element off the stack. More...
 
- Public Member Functions inherited from LList< LListBase, T >
 LList ()=default
 Default construct. More...
 
 LList (const T &elem)
 Construct and copy add initial item. More...
 
 LList (T &&elem)
 Construct and move add initial item. More...
 
 LList (Istream &is)
 Construct from Istream. More...
 
 LList (const LList< LListBase, T > &lst)
 Copy construct. More...
 
 LList (LList< LListBase, T > &&lst)
 Move construct. More...
 
 LList (std::initializer_list< T > lst)
 Copy construct from an initializer list. More...
 
 ~LList ()
 Destructor. More...
 
reference first ()
 The first entry in the list. More...
 
const_reference first () const
 The first entry in the list (const access) More...
 
reference last ()
 The last entry in the list. More...
 
const_reference last () const
 The last entry in the list (const access) More...
 
void prepend (const T &elem)
 Add copy at front of list. More...
 
void prepend (T &&elem)
 Move construct at front of list. More...
 
void append (const T &elem)
 Add copy at back of list. More...
 
void append (T &&elem)
 Move construct at back of list. More...
 
bool eraseHead ()
 Erase the first entry. More...
 
T removeHead ()
 Remove and return first entry. More...
 
T remove (link *item)
 Remove and return element. More...
 
T remove (iterator &iter)
 Remove and return element specified by iterator. More...
 
void clear ()
 Delete contents of list. More...
 
void transfer (LList< LListBase, T > &lst)
 
void operator= (const LList< LListBase, T > &lst)
 Copy assignment. More...
 
void operator= (LList< LListBase, T > &&lst)
 Move assignment. More...
 
void operator= (std::initializer_list< T > lst)
 Copy assignment from an initializer list. More...
 
IstreamreadList (Istream &is)
 Read list from Istream. More...
 
OstreamwriteList (Ostream &os, const label shortLen=0) const
 Write LList with line-breaks when length exceeds shortLen. More...
 
iterator begin ()
 Iterator to first item in list with non-const access. More...
 
const_iterator cbegin () const
 Iterator to first item in list with const access. More...
 
reverse_iterator rbegin ()
 Iterator to last item in list with non-const access. More...
 
const_reverse_iterator crbegin () const
 Iterator to last item in list with const access. More...
 
const_iterator begin () const
 Iterator to first item in list with const access. More...
 
const_reverse_iterator rbegin () const
 Iterator to last item in list with const access. More...
 
const iteratorend ()
 End of list for forward iterators. More...
 
const const_iteratorcend () const
 End of list for forward iterators. More...
 
const reverse_iteratorrend ()
 End of list for reverse iterators. More...
 
const const_reverse_iteratorcrend () const
 End of list for reverse iterators. More...
 
const const_iteratorend () const
 End of list for forward iterators. More...
 
const const_reverse_iteratorrend () const
 End of list for reverse iterators. More...
 
void insert (const T &elem)
 Add copy at front of list. Same as prepend() More...
 
void insert (T &&elem)
 Move construct at front of list. Same as prepend() More...
 

Additional Inherited Members

- Public Types inherited from LList< LListBase, T >
typedef T value_type
 Type of values stored. More...
 
typedef Tpointer
 Pointer for value_type. More...
 
typedef const Tconst_pointer
 Const pointer for value_type. More...
 
typedef Treference
 Reference for value_type. More...
 
typedef const Tconst_reference
 Const reference for value_type. More...
 
typedef label size_type
 The type that can represent the container size. More...
 
typedef label difference_type
 The difference between iterators. More...
 
using base_iterator = typename LListBase::iterator
 
using const_base_iterator = typename LListBase::const_iterator
 

Detailed Description

template<class T>
class Foam::LIFOStack< T >

A LIFO stack based on a singly-linked list.

Stack operations are push(), pop(), top(), bottom().

Definition at line 51 of file LIFOStack.H.

Member Function Documentation

◆ top()

const T & top ( ) const
inline

Const reference to the top element.

Definition at line 66 of file LIFOStack.H.

References LList< LListBase, T >::first().

Here is the call graph for this function:

◆ bottom()

const T & bottom ( ) const
inline

Const reference to the bottom element.

Definition at line 72 of file LIFOStack.H.

References LList< LListBase, T >::last().

Here is the call graph for this function:

◆ push() [1/2]

void push ( const T elem)
inline

Push an element onto the front of the stack.

Definition at line 78 of file LIFOStack.H.

References LList< LListBase, T >::prepend().

Referenced by Foam::readFields(), and Foam::readUniformFields().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ push() [2/2]

void push ( T &&  elem)
inline

Move an element onto the front of the stack.

Definition at line 84 of file LIFOStack.H.

References LList< LListBase, T >::prepend().

Here is the call graph for this function:

◆ pop()

T pop ( )
inline

Pop the top element off the stack.

Definition at line 90 of file LIFOStack.H.

References LList< LListBase, T >::removeHead().

Here is the call graph for this function:

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