Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

ogdf::StackPure< E > Class Template Reference

List-based stacks. More...

#include <ogdf/basic/SList.h>

+ Inheritance diagram for ogdf::StackPure< E >:

Classes

struct  Element
 

Public Member Functions

 StackPure ()
 Constructs an empty stack. More...
 
 StackPure (std::initializer_list< E > initList)
 Constructs a stack and pushes the elements in initList on it (last element will be on top). More...
 
 StackPure (const StackPure< E > &S)
 Constructs a stack that is a copy of S. More...
 
 StackPure (StackPure< E > &&S)
 Constructs a stack containing the elements of S (move semantics). More...
 
 ~StackPure ()
 Destruction. More...
 
void clear ()
 Makes the stack empty. More...
 
template<class ... Args>
void emplace (Args &&... args)
 Adds a new element at as top-most element to the stack. More...
 
bool empty () const
 Returns true iff the stack is empty. More...
 
StackPure< E > & operator= (const StackPure< E > &S)
 Assignment operator. More...
 
StackPure< E > & operator= (StackPure< E > &&S)
 Assignment operator (move semantics). More...
 
E pop ()
 Removes the top-most element from the stack and returns it. More...
 
void print (ostream &os, char delim=' ') const
 
void push (const E &x)
 Adds element x as top-most element to the stack. More...
 
const E & top () const
 Returns a reference to the top element. More...
 
E & top ()
 Returns a reference to the top element. More...
 

Private Member Functions

void copy (const StackPure< E > &S)
 

Private Attributes

Element * m_head
 

Detailed Description

template<class E>
class ogdf::StackPure< E >

List-based stacks.

In contrast to Stack<E>, instances of StackPure<E> do not store the number of elements contained in the stack.

Template Parameters
Eis the element type.

Definition at line 39 of file SList.h.

Constructor & Destructor Documentation

◆ StackPure() [1/4]

template<class E>
ogdf::StackPure< E >::StackPure ( )
inline

Constructs an empty stack.

Definition at line 68 of file Stack.h.

◆ StackPure() [2/4]

template<class E>
ogdf::StackPure< E >::StackPure ( std::initializer_list< E >  initList)
inline

Constructs a stack and pushes the elements in initList on it (last element will be on top).

Definition at line 71 of file Stack.h.

◆ StackPure() [3/4]

template<class E>
ogdf::StackPure< E >::StackPure ( const StackPure< E > &  S)
inline

Constructs a stack that is a copy of S.

Definition at line 77 of file Stack.h.

◆ StackPure() [4/4]

template<class E>
ogdf::StackPure< E >::StackPure ( StackPure< E > &&  S)
inline

Constructs a stack containing the elements of S (move semantics).

Stack S is empty afterwards.

Definition at line 86 of file Stack.h.

◆ ~StackPure()

template<class E>
ogdf::StackPure< E >::~StackPure ( )
inline

Destruction.

Definition at line 91 of file Stack.h.

Member Function Documentation

◆ clear()

template<class E>
void ogdf::StackPure< E >::clear ( )
inline

Makes the stack empty.

Definition at line 151 of file Stack.h.

◆ copy()

template<class E>
void ogdf::StackPure< E >::copy ( const StackPure< E > &  S)
inlineprivate

Definition at line 170 of file Stack.h.

◆ emplace()

template<class E>
template<class ... Args>
void ogdf::StackPure< E >::emplace ( Args &&...  args)
inline

Adds a new element at as top-most element to the stack.

The element is constructed in-place with exactly the same arguments args as supplied to the function.

Definition at line 136 of file Stack.h.

◆ empty()

template<class E>
bool ogdf::StackPure< E >::empty ( ) const
inline

Returns true iff the stack is empty.

Definition at line 96 of file Stack.h.

◆ operator=() [1/2]

template<class E>
StackPure<E>& ogdf::StackPure< E >::operator= ( const StackPure< E > &  S)
inline

Assignment operator.

Definition at line 109 of file Stack.h.

◆ operator=() [2/2]

template<class E>
StackPure<E>& ogdf::StackPure< E >::operator= ( StackPure< E > &&  S)
inline

Assignment operator (move semantics).

Stack S is empty afterwards.

Definition at line 119 of file Stack.h.

◆ pop()

template<class E>
E ogdf::StackPure< E >::pop ( )
inline

Removes the top-most element from the stack and returns it.

Definition at line 141 of file Stack.h.

◆ print()

template<class E>
void ogdf::StackPure< E >::print ( ostream &  os,
char  delim = ' ' 
) const
inline

Definition at line 159 of file Stack.h.

◆ push()

template<class E>
void ogdf::StackPure< E >::push ( const E &  x)
inline

Adds element x as top-most element to the stack.

Definition at line 127 of file Stack.h.

◆ top() [1/2]

template<class E>
const E& ogdf::StackPure< E >::top ( ) const
inline

Returns a reference to the top element.

Definition at line 99 of file Stack.h.

◆ top() [2/2]

template<class E>
E& ogdf::StackPure< E >::top ( )
inline

Returns a reference to the top element.

Definition at line 104 of file Stack.h.

Member Data Documentation

◆ m_head

template<class E>
Element* ogdf::StackPure< E >::m_head
private

Definition at line 64 of file Stack.h.


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