stack

标准库标头<stack>

此标头是集装箱图书馆。

包括

*。

<初始化器[医]列表>%28C++11%29

堆栈调整容器以提供堆栈%28 LIFO数据结构%29%28类模板%29

STD::用途[医]分配器<std::stack>%28C++11%29专门使用std::use[医]配位器类型特征%28功能模板%29

功能

运算符==运算符%21=运算符<运算符<=运算符>>=按字典顺序比较堆栈%28函数模板%29中的值

std::swp%28std::stack%29专门介绍std::swp算法%28函数模板%29

简介

二次

#include <initializer_list> namespace std { template <class T, class Container = deque<T> > class stack; 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 template <class T, class Container> void swap(stack<T, Container>& x, stack<T, Container>& y) noexcept(noexcept(x.swap(y)) template <class T, class Container, class Alloc> struct uses_allocator<stack<T, Container>, Alloc> : uses_allocator<Container, Alloc>::type { }; }

二次

类std::stack

二次

template <class T, class Container = std::deque<T> > class stack { public: typedef typename Container::value_type value_type; typedef typename Container::reference reference; typedef typename Container::const_reference const_reference; typedef typename Container::size_type size_type; typedef Container container_type; protected: Container c; public: explicit stack(const Container& explicit stack(Container&& = Container() template <class Alloc> explicit stack(const Alloc& template <class Alloc> stack(const Container&, const Alloc& template <class Alloc> stack(Container&&, const Alloc& template <class Alloc> stack(const stack&, const Alloc& template <class Alloc> stack(stack&&, const Alloc& bool empty() const { return c.empty( } size_type size() const { return c.size( } reference top() { return c.back( } const_reference top() const { return c.back( } void push(const value_type& x) { c.push_back(x } void push(value_type&& x) { c.push_back(std::move(x) } template <class... Args> void emplace(Args&&... args) { c.emplace_back(std::forward<Args>(args)... } void pop() { c.pop_back( } void swap(stack& s) noexcept(noexcept(swap(c, s.c))) { using std::swap; swap(c, s.c } };

二次

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/报头/堆栈