Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Standard C++ Library Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

stack

Module:  Standard C++ Library   Library:  Containers


Does not inherit

Local Index

Members

Non-Members

Summary

A container adapter that behaves like a stack (last in, first out)

Synopsis

#include <stack>

namespace std {
  template <class T, class Container = deque<T> >
  class stack;
}

Description

The stack container adapter causes a container to behave like a last- in, first-out (LIFO) stack. The last item put (pushed) onto the stack is the first item removed (popped off). The stack can adapt any container that includes the operations back(), push_back(), and pop_back(). In particular, deque, list, and vector can be used.

Interface

Constructors

explicit
stack(const Container& = Container());

Member Functions

bool 
empty() const;
void 
pop();
void 
push(const value_type& x);
size_type 
size() const;
value_type& 
top();
const value_type& 
top() const;

Nonmember Operators

template <class T, class Container>
bool operator==(const stack<T, Container>& x,
                 const stack<T, Container>& y);
template <class T, class Container>
bool operator!=(const stack<T, Container>& x,
                 const stack<T, Container>& y);
template <class T, class Container>
bool operator<(const stack<T, Container>& x,
                const stack<T, Container>& y);
template <class T, class Container>
bool operator>(const stack<T, Container>& x,
                const stack<T, Container>& y);
template <class T, class Container>
bool operator<=(const stack<T, Container>& x,
                 const stack<T, Container>& y);
template <class T, class Container>
bool operator>=(const stack<T, Container>& x,
                 const stack<T, Container>& y);

Example

See Also

allocator, Containers, deque, list, vector

Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 23.2.3.3



Previous fileTop of DocumentContentsIndex pageNext file

Copyright (c) 1994-2006 Rogue Wave Software, a Quovadx Division.
Licensed under the Apache License, Version 2.0.
Contact Rogue Wave about documentation or support issues. You can also seek help from other developers through the Apache stdcxx community (see below).

For more information on the Rogue Wave Standard C++ Library under open source, see Section 1.2 of the user's guide.