Generated on for Gecode by doxygen 1.15.0

Stack with arbitrary number of elements. More...

#include <gecode/support/dynamic-stack.hpp>

Public Member Functions

 DynamicStack (A &a, int n=64)
 Initialize stack with n elements.
 ~DynamicStack (void)
 Release memory.
bool empty (void) const
 Test whether stack is empty.
int entries (void) const
 Return number of entries currently on stack.
T pop (void)
 Pop topmost element from stack and return it.
T & top (void) const
 Return element on top of stack.
T & last (void) const
 Return element that has just been popped.
void push (const T &x)
 Push element x on top of stack.
T & operator[] (int i)
 Return entry at position i.
const T & operator[] (int i) const
 Return entry at position i.
 DynamicStack (const DynamicStack &s)=delete
 Copy constructor (disabled).
const DynamicStack & operator= (const DynamicStack &)=delete
 Assignment operator (disabled).

Static Public Member Functions

static void * operator new (size_t s)=delete
 Allocate memory from heap (disabled).
static void operator delete (void *p)=delete
 Free memory allocated from heap (disabled).

Detailed Description

template<class T, class A>
class Gecode::Support::DynamicStack< T, A >

Stack with arbitrary number of elements.

Definition at line 42 of file dynamic-stack.hpp.

Constructor & Destructor Documentation

◆ DynamicStack() [1/2]

template<class T, class A>
Gecode::Support::DynamicStack< T, A >::DynamicStack ( A & a,
int n = 64 )
inline

Initialize stack with n elements.

Definition at line 111 of file dynamic-stack.hpp.

◆ ~DynamicStack()

template<class T, class A>
Gecode::Support::DynamicStack< T, A >::~DynamicStack ( void )
inline

Release memory.

Definition at line 116 of file dynamic-stack.hpp.

◆ DynamicStack() [2/2]

template<class T, class A>
Gecode::Support::DynamicStack< T, A >::DynamicStack ( const DynamicStack< T, A > & s)
delete

Copy constructor (disabled).

Member Function Documentation

◆ empty()

template<class T, class A>
bool Gecode::Support::DynamicStack< T, A >::empty ( void ) const
inline

Test whether stack is empty.

Definition at line 148 of file dynamic-stack.hpp.

◆ entries()

template<class T, class A>
int Gecode::Support::DynamicStack< T, A >::entries ( void ) const
inline

Return number of entries currently on stack.

Definition at line 154 of file dynamic-stack.hpp.

◆ pop()

template<class T, class A>
T Gecode::Support::DynamicStack< T, A >::pop ( void )
inline

Pop topmost element from stack and return it.

Definition at line 122 of file dynamic-stack.hpp.

◆ top()

template<class T, class A>
T & Gecode::Support::DynamicStack< T, A >::top ( void ) const
inline

Return element on top of stack.

Definition at line 128 of file dynamic-stack.hpp.

◆ last()

template<class T, class A>
T & Gecode::Support::DynamicStack< T, A >::last ( void ) const
inline

Return element that has just been popped.

Definition at line 134 of file dynamic-stack.hpp.

◆ push()

template<class T, class A>
void Gecode::Support::DynamicStack< T, A >::push ( const T & x)
inline

Push element x on top of stack.

Definition at line 140 of file dynamic-stack.hpp.

◆ operator[]() [1/2]

template<class T, class A>
T & Gecode::Support::DynamicStack< T, A >::operator[] ( int i)
inline

Return entry at position i.

Position 0 corresponds to the element first pushed, whereas position entries()-1 corresponds to the element pushed last.

Definition at line 160 of file dynamic-stack.hpp.

◆ operator[]() [2/2]

template<class T, class A>
const T & Gecode::Support::DynamicStack< T, A >::operator[] ( int i) const
inline

Return entry at position i.

Position 0 corresponds to the element first pushed, whereas position entries()-1 corresponds to the element pushed last.

Definition at line 166 of file dynamic-stack.hpp.

◆ operator new()

template<class T, class A>
void * Gecode::Support::DynamicStack< T, A >::operator new ( size_t s)
staticdelete

Allocate memory from heap (disabled).

◆ operator delete()

template<class T, class A>
void Gecode::Support::DynamicStack< T, A >::operator delete ( void * p)
staticdelete

Free memory allocated from heap (disabled).

◆ operator=()

template<class T, class A>
const DynamicStack & Gecode::Support::DynamicStack< T, A >::operator= ( const DynamicStack< T, A > & )
delete

Assignment operator (disabled).


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