Debian Codegraph @

headers/queue

raw
1 /* Copyright (C) 2015 Povilas Kanapickas <[email protected]>
2
3 This file is part of cppreference-doc
4
5 This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
6 Unported License. To view a copy of this license, visit
7 http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
8 Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
9
10 Permission is granted to copy, distribute and/or modify this document
11 under the terms of the GNU Free Documentation License, Version 1.3 or
12 any later version published by the Free Software Foundation; with no
13 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
14 */
15
16 #ifndef CPPREFERENCE_QUEUE_H
17 #define CPPREFERENCE_QUEUE_H
18
19 #if CPPREFERENCE_STDVER>= 2011
20 #include <initializer_list>
21 #endif
22
23 namespace std {
24
25 template <
26 class T,
27 class Container = std::deque<T>
28 > class queue {
29 public:
30 typedef Container container_type;
31 typedef typename Container::value_type value_type;
32 typedef typename Container::size_type size_type;
33 typedef typename Container::reference reference;
34 typedef typename Container::const_reference const_reference;
35
36 #if CPPREFERENCE_STDVER <2011
37 explicit queue(const Container& cont = Container());
38 #else
39 explicit queue(const Container& cont);
40 explicit queue(Container&& cont = Container());
41 queue(const queue& other);
42 queue(queue&& other);
43
44 template<class Alloc>
45 explicit queue(const Alloc& alloc);
46
47 template<class Alloc>
48 queue(const Container& cont, const Alloc& alloc);
49
50 template<class Alloc>
51 queue(Container&& cont, const Alloc& alloc);
52
53 template<class Alloc>
54 queue(const queue& other, const Alloc& alloc);
55
56 template<class Alloc>
57 queue(queue&& other, const Alloc& alloc);
58 #endif
59
60 ~queue();
61
62 queue<T, Container>&
63 operator=(const queue<T, Container>& other);
64
65 #if CPPREFERENCE_STDVER>= 2011
66 queue<T, Container>&
67 operator=(queue<T, Container>&& other);
68 #endif
69
70 reference front();
71 const_reference front() const;
72
73 reference back();
74 const_reference back() const;
75
76 bool empty() const;
77 size_type size() const;
78
79 void push(const T& value);
80
81 #if CPPREFERENCE_STDVER>= 2011
82 void push(T&& value);
83 template<class... Args>
84 void emplace(Args&& ... args);
85 #endif
86
87 void pop();
88
89 #if CPPREFERENCE_STDVER>= 2011
90 void swap(queue& other);
91 #endif
92
93 protected:
94 Container c;
95 };
96
97 template<class T, class Container>
98 bool operator==(queue<T, Container>& lhs,
99 queue<T, Container>& rhs);
100
101 template<class T, class Container>
102 bool operator!=(queue<T, Container>& lhs,
103 queue<T, Container>& rhs);
104
105 template<class T, class Container>
106 bool operator<(queue<T, Container>& lhs,
107 queue<T, Container>& rhs);
108
109 template<class T, class Container>
110 bool operator<=(queue<T, Container>& lhs,
111 queue<T, Container>& rhs);
112
113 template<class T, class Container>
114 bool operator>(queue<T, Container>& lhs,
115 queue<T, Container>& rhs);
116
117 template<class T, class Container>
118 bool operator>=(queue<T, Container>& lhs,
119 queue<T, Container>& rhs);
120
121 template<class T, class Container>
122 void swap(queue<T, Container>& lhs,
123 queue<T, Container>& rhs);
124
125
126 template <
127 class T,
128 class Container = std::vector<T>,
129 class Compare = std::less<typename Container::value_type>
130 > class priority_queue {
131 public:
132 typedef Container container_type;
133 typedef typename Container::value_type value_type;
134 typedef typename Container::size_type size_type;
135 typedef typename Container::reference reference;
136 typedef typename Container::const_reference const_reference;
137
138 priority_queue(const priority_queue& other);
139 #if CPPREFERENCE_STDVER <2011
140 explicit priority_queue(const Compare& compare = Compare(),
141 const Container& cont = Container());
142 #else
143 priority_queue(const Compare& compare, const Container& cont);
144
145 explicit priority_queue(const Compare& compare = Compare(),
146 Container && cont = Container());
147
148 priority_queue(priority_queue&& other);
149
150 template<class Alloc>
151 explicit priority_queue(const Alloc& alloc);
152
153 template<class Alloc>
154 priority_queue(const Compare& compare, const Alloc& alloc);
155
156 template<class Alloc>
157 priority_queue(const Compare& compare, const Container& cont,
158 const Alloc& alloc);
159
160 template<class Alloc>
161 priority_queue(const Compare& compare, Container&& cont,
162 const Alloc& alloc);
163
164 template<class Alloc>
165 priority_queue(const priority_queue& other, const Alloc& alloc);
166
167 template<class Alloc>
168 priority_queue(priority_queue&& other, const Alloc& alloc);
169
170 template<class InputIt>
171 priority_queue(InputIt first, InputIt last,
172 const Compare& compare, const Container& cont);
173
174 template<class InputIt>
175 priority_queue(InputIt first, InputIt last,
176 const Compare& compare = Compare(),
177 Container && cont = Container());
178 #endif
179
180 ~priority_queue();
181
182 priority_queue<T, Container>&
183 operator=(const priority_queue<T, Container>& other);
184
185 #if CPPREFERENCE_STDVER>= 2011
186 priority_queue<T, Container>&
187 operator=(priority_queue<T, Container>&& other);
188 #endif
189
190 const_reference top() const;
191
192 bool empty() const;
193 size_type size() const;
194
195 void push(const T& value);
196
197 #if CPPREFERENCE_STDVER>= 2011
198 void push(T&& value);
199 template<class... Args>
200 void emplace(Args&& ... args);
201 #endif
202
203 void pop();
204
205 #if CPPREFERENCE_STDVER>= 2011
206 void swap(priority_queue& other);
207 #endif
208
209 protected:
210 Container c;
211 Compare comp;
212 };
213
214 template<class T, class Container>
215 bool operator==(priority_queue<T, Container>& lhs,
216 priority_queue<T, Container>& rhs);
217
218 template<class T, class Container>
219 bool operator!=(priority_queue<T, Container>& lhs,
220 priority_queue<T, Container>& rhs);
221
222 template<class T, class Container>
223 bool operator<(priority_queue<T, Container>& lhs,
224 priority_queue<T, Container>& rhs);
225
226 template<class T, class Container>
227 bool operator<=(priority_queue<T, Container>& lhs,
228 priority_queue<T, Container>& rhs);
229
230 template<class T, class Container>
231 bool operator>(priority_queue<T, Container>& lhs,
232 priority_queue<T, Container>& rhs);
233
234 template<class T, class Container>
235 bool operator>=(priority_queue<T, Container>& lhs,
236 priority_queue<T, Container>& rhs);
237
238 template<class T, class Container, class Compare>
239 void swap(priority_queue<T, Container, Compare>& lhs,
240 priority_queue<T, Container, Compare>& rhs);
241
242
243 } // namespace std
244
245 #endif // CPPREFERENCE_QUEUE_H