queue

标准库标头<queue>

此标头是集装箱图书馆。

包括

*。

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

队列调整容器以提供队列%28 FIFO数据结构%29%28类模板%29

优先权[医]队列调整容器以提供优先级队列%28类模板%29

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

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

功能

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

:交换%28std::Queue%29专门处理std::swp算法%28函数模板%29

STD::交换%28std::优先级[医]Queue%29专门使用std::交换算法%28函数模板%29

简介

二次

#include <initializer_list> namespace std { template <class T, class Container = deque<T> > class queue; template <class T, class Container = vector<T>, class Compare = less<typename Container::value_type> > class priority_queue; template <class T, class Container> bool operator==(const queue<T, Container>& x,const queue<T, Container>& y template <class T, class Container> bool operator!=(const queue<T, Container>& x,const queue<T, Container>& y template <class T, class Container> bool operator< (const queue<T, Container>& x,const queue<T, Container>& y template <class T, class Container> bool operator> (const queue<T, Container>& x,const queue<T, Container>& y template <class T, class Container> bool operator>=(const queue<T, Container>& x,const queue<T, Container>& y template <class T, class Container> bool operator<=(const queue<T, Container>& x,const queue<T, Container>& y template <class T, class Container> void swap(queue<T, Container>& x, queue<T, Container>& y) noexcept(noexcept(x.swap(y)) template <class T, class Container, class Compare> void swap(priority_queue<T, Container, Compare>& x, priority_queue<T, Container, Compare>& y) noexcept(noexcept(x.swap(y)) template <class T, class Container, class Alloc> struct uses_allocator<queue<T, Container>, Alloc> : uses_allocator<Container, Alloc>::type { }; }

二次

类std::queue

二次

template <class T, class Container = deque<T> > class queue { 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 queue(const Container& explicit queue(Container&& = Container() template <class Alloc> explicit queue(const Alloc& template <class Alloc> queue(const Container&, const Alloc& template <class Alloc> queue(Container&&, const Alloc& template <class Alloc> queue(const queue&, const Alloc& template <class Alloc> queue(queue&&, const Alloc& bool empty() const { return c.empty( } size_type size() const { return c.size( } reference front() { return c.front( } const_reference front() const { return c.front( } reference back() { return c.back( } const_reference back() 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_front( } void swap(queue& q) noexcept(noexcept(swap(c, q.c))) { using std::swap; swap(c, q.c } };

二次

类std::priority_queue

二次

template <class T, class Container = vector<T>, class Compare = less<typename Container::value_type> > class priority_queue { 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; Compare comp; public: priority_queue(const Compare& x, const Container& explicit priority_queue(const Compare& x = Compare(), Container&& = Container() template <class InputIterator> priority_queue(InputIterator first, InputIterator last, const Compare& x, const Container& template <class InputIterator> priority_queue(InputIterator first, InputIterator last, const Compare& x = Compare(), Container&& = Container() template <class Alloc> explicit priority_queue(const Alloc& template <class Alloc> priority_queue(const Compare&, const Alloc& template <class Alloc> priority_queue(const Compare&, const Container&, const Alloc& template <class Alloc> priority_queue(const Compare&, Container&&, const Alloc& template <class Alloc> priority_queue(const priority_queue&, const Alloc& template <class Alloc> priority_queue(priority_queue&&, const Alloc& bool empty() const { return c.empty( } size_type size() const { return c.size( } const_reference top() const { return c.front( } void push(const value_type& x void push(value_type&& x template <class... Args> void emplace(Args&&... args void pop( void swap(priority_queue& q) noexcept( noexcept(swap(c, q.c)) && noexcept(swap(comp, q.comp))) { using std::swap; swap(c, q.c swap(comp, q.comp } };

二次

© cppreference.com

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

http://en.cppreference.com/w/cpp/报头/队列