|
Template Class stack<T, Cont>
Synopsis
|
#include "boost/stack.hpp"
template <class T, class Cont = std::vector<T> >
class boost::stack
{
public:
typedef typename Cont::value_type value_type;
typedef typename Cont::reference reference;
typedef typename Cont::const_reference const_reference;
typedef typename Cont::size_type size_type;
typedef Cont container_type;
typedef typename Cont::iterator iterator;
typedef typename Cont::const_iterator const_iterator;
explicit stack(Cont const& cont = Cont());
bool empty() const;
size_type size() const;
void push(value_type const& val);
void pop();
value_type const& top() const;
value_type& top();
iterator begin();
iterator end();
const_iterator begin() const;
const_iterator end() const;
};
|
Description
The class stack is actually not really a priority queue in
the normal sense. However, if you assume that the element which
is stored the shortest time in the stack has the largest
priority, you can view this class as a priority queue: It provides
access to the element which is stored the shortest time in the
stack (ie. stack has "last in, first out" semantics).
The class stack is a replacement for the standard class
std::stack which provides
logical inspectabiliy
in addition to the methods provided by the standard version.
If you only need functionality provided by the
standard class then you can use the standard class as well.
For a description of the methods of stack<T, Cont> see the
description of common methods or the
documentation of the standard class std::stack.
See Also
heap(3),
heap-common(3)
Copyright © 1999 Dietmar Kühl (dietmar.kuehl@claas-solutions.de)
Claas Solutions GmbH
|