muParserX 2.0.0
Loading...
Searching...
No Matches
mup::Stack< TVal, TCont > Class Template Reference

Parser stack implementation. More...

#include <mpStack.h>

Public Member Functions

value_type pop ()
 Pop a value from the stack.
 
void push (const value_type &a_Val)
 Push an object into the stack.
 
unsigned size () const
 Return the number of stored elements.
 
bool empty () const
 Returns true if stack is empty false otherwise.
 
value_type & top ()
 Return reference to the top object in the stack.
 

Detailed Description

template<typename TVal, typename TCont = std::vector<TVal>>
class mup::Stack< TVal, TCont >

Parser stack implementation.

Stack implementation based on a std::stack. The behaviour of pop() had been slightly changed in order to get an error code if the stack is empty. The stack is used within the Parser both as a value stack and as an operator stack.

Author
(C) 2010 Ingo Berg

Member Function Documentation

◆ pop()

template<typename TVal, typename TCont = std::vector<TVal>>
value_type mup::Stack< TVal, TCont >::pop ( )
inline

Pop a value from the stack.

Unlike the standard implementation this function will return the value that is going to be taken from the stack.

Exceptions
ParserExceptionin case the stack is empty.
See also
pop(int &a_iErrc)
Here is the call graph for this function:

◆ push()

template<typename TVal, typename TCont = std::vector<TVal>>
void mup::Stack< TVal, TCont >::push ( const value_type & a_Val)
inline

Push an object into the stack.

Parameters
a_Valobject to push into the stack.
Exceptions
nothrow

◆ top()

template<typename TVal, typename TCont = std::vector<TVal>>
value_type & mup::Stack< TVal, TCont >::top ( )
inline

Return reference to the top object in the stack.

The top object is the one pushed most recently.


muParserX documentation - (C) 2010 Ingo Berg