libstdc++
|
00001 // Queue implementation -*- C++ -*- 00002 00003 // Copyright (C) 2001-2018 Free Software Foundation, Inc. 00004 // 00005 // This file is part of the GNU ISO C++ Library. This library is free 00006 // software; you can redistribute it and/or modify it under the 00007 // terms of the GNU General Public License as published by the 00008 // Free Software Foundation; either version 3, or (at your option) 00009 // any later version. 00010 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 00016 // Under Section 7 of GPL version 3, you are granted additional 00017 // permissions described in the GCC Runtime Library Exception, version 00018 // 3.1, as published by the Free Software Foundation. 00019 00020 // You should have received a copy of the GNU General Public License and 00021 // a copy of the GCC Runtime Library Exception along with this program; 00022 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00023 // <http://www.gnu.org/licenses/>. 00024 00025 /* 00026 * 00027 * Copyright (c) 1994 00028 * Hewlett-Packard Company 00029 * 00030 * Permission to use, copy, modify, distribute and sell this software 00031 * and its documentation for any purpose is hereby granted without fee, 00032 * provided that the above copyright notice appear in all copies and 00033 * that both that copyright notice and this permission notice appear 00034 * in supporting documentation. Hewlett-Packard Company makes no 00035 * representations about the suitability of this software for any 00036 * purpose. It is provided "as is" without express or implied warranty. 00037 * 00038 * 00039 * Copyright (c) 1996,1997 00040 * Silicon Graphics Computer Systems, Inc. 00041 * 00042 * Permission to use, copy, modify, distribute and sell this software 00043 * and its documentation for any purpose is hereby granted without fee, 00044 * provided that the above copyright notice appear in all copies and 00045 * that both that copyright notice and this permission notice appear 00046 * in supporting documentation. Silicon Graphics makes no 00047 * representations about the suitability of this software for any 00048 * purpose. It is provided "as is" without express or implied warranty. 00049 */ 00050 00051 /** @file bits/stl_queue.h 00052 * This is an internal header file, included by other library headers. 00053 * Do not attempt to use it directly. @headername{queue} 00054 */ 00055 00056 #ifndef _STL_QUEUE_H 00057 #define _STL_QUEUE_H 1 00058 00059 #include <bits/concept_check.h> 00060 #include <debug/debug.h> 00061 #if __cplusplus >= 201103L 00062 # include <bits/uses_allocator.h> 00063 #endif 00064 00065 namespace std _GLIBCXX_VISIBILITY(default) 00066 { 00067 _GLIBCXX_BEGIN_NAMESPACE_VERSION 00068 00069 /** 00070 * @brief A standard container giving FIFO behavior. 00071 * 00072 * @ingroup sequences 00073 * 00074 * @tparam _Tp Type of element. 00075 * @tparam _Sequence Type of underlying sequence, defaults to deque<_Tp>. 00076 * 00077 * Meets many of the requirements of a 00078 * <a href="tables.html#65">container</a>, 00079 * but does not define anything to do with iterators. Very few of the 00080 * other standard container interfaces are defined. 00081 * 00082 * This is not a true container, but an @e adaptor. It holds another 00083 * container, and provides a wrapper interface to that container. The 00084 * wrapper is what enforces strict first-in-first-out %queue behavior. 00085 * 00086 * The second template parameter defines the type of the underlying 00087 * sequence/container. It defaults to std::deque, but it can be any type 00088 * that supports @c front, @c back, @c push_back, and @c pop_front, 00089 * such as std::list or an appropriate user-defined type. 00090 * 00091 * Members not found in @a normal containers are @c container_type, 00092 * which is a typedef for the second Sequence parameter, and @c push and 00093 * @c pop, which are standard %queue/FIFO operations. 00094 */ 00095 template<typename _Tp, typename _Sequence = deque<_Tp> > 00096 class queue 00097 { 00098 #ifdef _GLIBCXX_CONCEPT_CHECKS 00099 // concept requirements 00100 typedef typename _Sequence::value_type _Sequence_value_type; 00101 # if __cplusplus < 201103L 00102 __glibcxx_class_requires(_Tp, _SGIAssignableConcept) 00103 # endif 00104 __glibcxx_class_requires(_Sequence, _FrontInsertionSequenceConcept) 00105 __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept) 00106 __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept) 00107 #endif 00108 00109 template<typename _Tp1, typename _Seq1> 00110 friend bool 00111 operator==(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&); 00112 00113 template<typename _Tp1, typename _Seq1> 00114 friend bool 00115 operator<(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&); 00116 00117 #if __cplusplus >= 201103L 00118 template<typename _Alloc> 00119 using _Uses = typename 00120 enable_if<uses_allocator<_Sequence, _Alloc>::value>::type; 00121 #endif 00122 00123 public: 00124 typedef typename _Sequence::value_type value_type; 00125 typedef typename _Sequence::reference reference; 00126 typedef typename _Sequence::const_reference const_reference; 00127 typedef typename _Sequence::size_type size_type; 00128 typedef _Sequence container_type; 00129 00130 protected: 00131 /* Maintainers wondering why this isn't uglified as per style 00132 * guidelines should note that this name is specified in the standard, 00133 * C++98 [23.2.3.1]. 00134 * (Why? Presumably for the same reason that it's protected instead 00135 * of private: to allow derivation. But none of the other 00136 * containers allow for derivation. Odd.) 00137 */ 00138 /// @c c is the underlying container. 00139 _Sequence c; 00140 00141 public: 00142 /** 00143 * @brief Default constructor creates no elements. 00144 */ 00145 #if __cplusplus < 201103L 00146 explicit 00147 queue(const _Sequence& __c = _Sequence()) 00148 : c(__c) { } 00149 #else 00150 template<typename _Seq = _Sequence, typename _Requires = typename 00151 enable_if<is_default_constructible<_Seq>::value>::type> 00152 queue() 00153 : c() { } 00154 00155 explicit 00156 queue(const _Sequence& __c) 00157 : c(__c) { } 00158 00159 explicit 00160 queue(_Sequence&& __c) 00161 : c(std::move(__c)) { } 00162 00163 template<typename _Alloc, typename _Requires = _Uses<_Alloc>> 00164 explicit 00165 queue(const _Alloc& __a) 00166 : c(__a) { } 00167 00168 template<typename _Alloc, typename _Requires = _Uses<_Alloc>> 00169 queue(const _Sequence& __c, const _Alloc& __a) 00170 : c(__c, __a) { } 00171 00172 template<typename _Alloc, typename _Requires = _Uses<_Alloc>> 00173 queue(_Sequence&& __c, const _Alloc& __a) 00174 : c(std::move(__c), __a) { } 00175 00176 template<typename _Alloc, typename _Requires = _Uses<_Alloc>> 00177 queue(const queue& __q, const _Alloc& __a) 00178 : c(__q.c, __a) { } 00179 00180 template<typename _Alloc, typename _Requires = _Uses<_Alloc>> 00181 queue(queue&& __q, const _Alloc& __a) 00182 : c(std::move(__q.c), __a) { } 00183 #endif 00184 00185 /** 00186 * Returns true if the %queue is empty. 00187 */ 00188 bool 00189 empty() const 00190 { return c.empty(); } 00191 00192 /** Returns the number of elements in the %queue. */ 00193 size_type 00194 size() const 00195 { return c.size(); } 00196 00197 /** 00198 * Returns a read/write reference to the data at the first 00199 * element of the %queue. 00200 */ 00201 reference 00202 front() 00203 { 00204 __glibcxx_requires_nonempty(); 00205 return c.front(); 00206 } 00207 00208 /** 00209 * Returns a read-only (constant) reference to the data at the first 00210 * element of the %queue. 00211 */ 00212 const_reference 00213 front() const 00214 { 00215 __glibcxx_requires_nonempty(); 00216 return c.front(); 00217 } 00218 00219 /** 00220 * Returns a read/write reference to the data at the last 00221 * element of the %queue. 00222 */ 00223 reference 00224 back() 00225 { 00226 __glibcxx_requires_nonempty(); 00227 return c.back(); 00228 } 00229 00230 /** 00231 * Returns a read-only (constant) reference to the data at the last 00232 * element of the %queue. 00233 */ 00234 const_reference 00235 back() const 00236 { 00237 __glibcxx_requires_nonempty(); 00238 return c.back(); 00239 } 00240 00241 /** 00242 * @brief Add data to the end of the %queue. 00243 * @param __x Data to be added. 00244 * 00245 * This is a typical %queue operation. The function creates an 00246 * element at the end of the %queue and assigns the given data 00247 * to it. The time complexity of the operation depends on the 00248 * underlying sequence. 00249 */ 00250 void 00251 push(const value_type& __x) 00252 { c.push_back(__x); } 00253 00254 #if __cplusplus >= 201103L 00255 void 00256 push(value_type&& __x) 00257 { c.push_back(std::move(__x)); } 00258 00259 #if __cplusplus > 201402L 00260 template<typename... _Args> 00261 decltype(auto) 00262 emplace(_Args&&... __args) 00263 { return c.emplace_back(std::forward<_Args>(__args)...); } 00264 #else 00265 template<typename... _Args> 00266 void 00267 emplace(_Args&&... __args) 00268 { c.emplace_back(std::forward<_Args>(__args)...); } 00269 #endif 00270 #endif 00271 00272 /** 00273 * @brief Removes first element. 00274 * 00275 * This is a typical %queue operation. It shrinks the %queue by one. 00276 * The time complexity of the operation depends on the underlying 00277 * sequence. 00278 * 00279 * Note that no data is returned, and if the first element's 00280 * data is needed, it should be retrieved before pop() is 00281 * called. 00282 */ 00283 void 00284 pop() 00285 { 00286 __glibcxx_requires_nonempty(); 00287 c.pop_front(); 00288 } 00289 00290 #if __cplusplus >= 201103L 00291 void 00292 swap(queue& __q) 00293 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 00294 noexcept(__is_nothrow_swappable<_Sequence>::value) 00295 #else 00296 noexcept(__is_nothrow_swappable<_Tp>::value) 00297 #endif 00298 { 00299 using std::swap; 00300 swap(c, __q.c); 00301 } 00302 #endif // __cplusplus >= 201103L 00303 }; 00304 00305 /** 00306 * @brief Queue equality comparison. 00307 * @param __x A %queue. 00308 * @param __y A %queue of the same type as @a __x. 00309 * @return True iff the size and elements of the queues are equal. 00310 * 00311 * This is an equivalence relation. Complexity and semantics depend on the 00312 * underlying sequence type, but the expected rules are: this relation is 00313 * linear in the size of the sequences, and queues are considered equivalent 00314 * if their sequences compare equal. 00315 */ 00316 template<typename _Tp, typename _Seq> 00317 inline bool 00318 operator==(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) 00319 { return __x.c == __y.c; } 00320 00321 /** 00322 * @brief Queue ordering relation. 00323 * @param __x A %queue. 00324 * @param __y A %queue of the same type as @a x. 00325 * @return True iff @a __x is lexicographically less than @a __y. 00326 * 00327 * This is an total ordering relation. Complexity and semantics 00328 * depend on the underlying sequence type, but the expected rules 00329 * are: this relation is linear in the size of the sequences, the 00330 * elements must be comparable with @c <, and 00331 * std::lexicographical_compare() is usually used to make the 00332 * determination. 00333 */ 00334 template<typename _Tp, typename _Seq> 00335 inline bool 00336 operator<(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) 00337 { return __x.c < __y.c; } 00338 00339 /// Based on operator== 00340 template<typename _Tp, typename _Seq> 00341 inline bool 00342 operator!=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) 00343 { return !(__x == __y); } 00344 00345 /// Based on operator< 00346 template<typename _Tp, typename _Seq> 00347 inline bool 00348 operator>(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) 00349 { return __y < __x; } 00350 00351 /// Based on operator< 00352 template<typename _Tp, typename _Seq> 00353 inline bool 00354 operator<=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) 00355 { return !(__y < __x); } 00356 00357 /// Based on operator< 00358 template<typename _Tp, typename _Seq> 00359 inline bool 00360 operator>=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) 00361 { return !(__x < __y); } 00362 00363 #if __cplusplus >= 201103L 00364 template<typename _Tp, typename _Seq> 00365 inline 00366 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 00367 // Constrained free swap overload, see p0185r1 00368 typename enable_if<__is_swappable<_Seq>::value>::type 00369 #else 00370 void 00371 #endif 00372 swap(queue<_Tp, _Seq>& __x, queue<_Tp, _Seq>& __y) 00373 noexcept(noexcept(__x.swap(__y))) 00374 { __x.swap(__y); } 00375 00376 template<typename _Tp, typename _Seq, typename _Alloc> 00377 struct uses_allocator<queue<_Tp, _Seq>, _Alloc> 00378 : public uses_allocator<_Seq, _Alloc>::type { }; 00379 #endif // __cplusplus >= 201103L 00380 00381 /** 00382 * @brief A standard container automatically sorting its contents. 00383 * 00384 * @ingroup sequences 00385 * 00386 * @tparam _Tp Type of element. 00387 * @tparam _Sequence Type of underlying sequence, defaults to vector<_Tp>. 00388 * @tparam _Compare Comparison function object type, defaults to 00389 * less<_Sequence::value_type>. 00390 * 00391 * This is not a true container, but an @e adaptor. It holds 00392 * another container, and provides a wrapper interface to that 00393 * container. The wrapper is what enforces priority-based sorting 00394 * and %queue behavior. Very few of the standard container/sequence 00395 * interface requirements are met (e.g., iterators). 00396 * 00397 * The second template parameter defines the type of the underlying 00398 * sequence/container. It defaults to std::vector, but it can be 00399 * any type that supports @c front(), @c push_back, @c pop_back, 00400 * and random-access iterators, such as std::deque or an 00401 * appropriate user-defined type. 00402 * 00403 * The third template parameter supplies the means of making 00404 * priority comparisons. It defaults to @c less<value_type> but 00405 * can be anything defining a strict weak ordering. 00406 * 00407 * Members not found in @a normal containers are @c container_type, 00408 * which is a typedef for the second Sequence parameter, and @c 00409 * push, @c pop, and @c top, which are standard %queue operations. 00410 * 00411 * @note No equality/comparison operators are provided for 00412 * %priority_queue. 00413 * 00414 * @note Sorting of the elements takes place as they are added to, 00415 * and removed from, the %priority_queue using the 00416 * %priority_queue's member functions. If you access the elements 00417 * by other means, and change their data such that the sorting 00418 * order would be different, the %priority_queue will not re-sort 00419 * the elements for you. (How could it know to do so?) 00420 */ 00421 template<typename _Tp, typename _Sequence = vector<_Tp>, 00422 typename _Compare = less<typename _Sequence::value_type> > 00423 class priority_queue 00424 { 00425 #ifdef _GLIBCXX_CONCEPT_CHECKS 00426 // concept requirements 00427 typedef typename _Sequence::value_type _Sequence_value_type; 00428 # if __cplusplus < 201103L 00429 __glibcxx_class_requires(_Tp, _SGIAssignableConcept) 00430 # endif 00431 __glibcxx_class_requires(_Sequence, _SequenceConcept) 00432 __glibcxx_class_requires(_Sequence, _RandomAccessContainerConcept) 00433 __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept) 00434 __glibcxx_class_requires4(_Compare, bool, _Tp, _Tp, 00435 _BinaryFunctionConcept) 00436 #endif 00437 00438 #if __cplusplus >= 201103L 00439 template<typename _Alloc> 00440 using _Uses = typename 00441 enable_if<uses_allocator<_Sequence, _Alloc>::value>::type; 00442 #endif 00443 00444 public: 00445 typedef typename _Sequence::value_type value_type; 00446 typedef typename _Sequence::reference reference; 00447 typedef typename _Sequence::const_reference const_reference; 00448 typedef typename _Sequence::size_type size_type; 00449 typedef _Sequence container_type; 00450 // _GLIBCXX_RESOLVE_LIB_DEFECTS 00451 // DR 2684. priority_queue lacking comparator typedef 00452 typedef _Compare value_compare; 00453 00454 protected: 00455 // See queue::c for notes on these names. 00456 _Sequence c; 00457 _Compare comp; 00458 00459 public: 00460 /** 00461 * @brief Default constructor creates no elements. 00462 */ 00463 #if __cplusplus < 201103L 00464 explicit 00465 priority_queue(const _Compare& __x = _Compare(), 00466 const _Sequence& __s = _Sequence()) 00467 : c(__s), comp(__x) 00468 { std::make_heap(c.begin(), c.end(), comp); } 00469 #else 00470 template<typename _Seq = _Sequence, typename _Requires = typename 00471 enable_if<__and_<is_default_constructible<_Compare>, 00472 is_default_constructible<_Seq>>::value>::type> 00473 priority_queue() 00474 : c(), comp() { } 00475 00476 explicit 00477 priority_queue(const _Compare& __x, const _Sequence& __s) 00478 : c(__s), comp(__x) 00479 { std::make_heap(c.begin(), c.end(), comp); } 00480 00481 explicit 00482 priority_queue(const _Compare& __x, _Sequence&& __s = _Sequence()) 00483 : c(std::move(__s)), comp(__x) 00484 { std::make_heap(c.begin(), c.end(), comp); } 00485 00486 template<typename _Alloc, typename _Requires = _Uses<_Alloc>> 00487 explicit 00488 priority_queue(const _Alloc& __a) 00489 : c(__a), comp() { } 00490 00491 template<typename _Alloc, typename _Requires = _Uses<_Alloc>> 00492 priority_queue(const _Compare& __x, const _Alloc& __a) 00493 : c(__a), comp(__x) { } 00494 00495 template<typename _Alloc, typename _Requires = _Uses<_Alloc>> 00496 priority_queue(const _Compare& __x, const _Sequence& __c, 00497 const _Alloc& __a) 00498 : c(__c, __a), comp(__x) { } 00499 00500 template<typename _Alloc, typename _Requires = _Uses<_Alloc>> 00501 priority_queue(const _Compare& __x, _Sequence&& __c, const _Alloc& __a) 00502 : c(std::move(__c), __a), comp(__x) { } 00503 00504 template<typename _Alloc, typename _Requires = _Uses<_Alloc>> 00505 priority_queue(const priority_queue& __q, const _Alloc& __a) 00506 : c(__q.c, __a), comp(__q.comp) { } 00507 00508 template<typename _Alloc, typename _Requires = _Uses<_Alloc>> 00509 priority_queue(priority_queue&& __q, const _Alloc& __a) 00510 : c(std::move(__q.c), __a), comp(std::move(__q.comp)) { } 00511 #endif 00512 00513 /** 00514 * @brief Builds a %queue from a range. 00515 * @param __first An input iterator. 00516 * @param __last An input iterator. 00517 * @param __x A comparison functor describing a strict weak ordering. 00518 * @param __s An initial sequence with which to start. 00519 * 00520 * Begins by copying @a __s, inserting a copy of the elements 00521 * from @a [first,last) into the copy of @a __s, then ordering 00522 * the copy according to @a __x. 00523 * 00524 * For more information on function objects, see the 00525 * documentation on @link functors functor base 00526 * classes@endlink. 00527 */ 00528 #if __cplusplus < 201103L 00529 template<typename _InputIterator> 00530 priority_queue(_InputIterator __first, _InputIterator __last, 00531 const _Compare& __x = _Compare(), 00532 const _Sequence& __s = _Sequence()) 00533 : c(__s), comp(__x) 00534 { 00535 __glibcxx_requires_valid_range(__first, __last); 00536 c.insert(c.end(), __first, __last); 00537 std::make_heap(c.begin(), c.end(), comp); 00538 } 00539 #else 00540 template<typename _InputIterator> 00541 priority_queue(_InputIterator __first, _InputIterator __last, 00542 const _Compare& __x, 00543 const _Sequence& __s) 00544 : c(__s), comp(__x) 00545 { 00546 __glibcxx_requires_valid_range(__first, __last); 00547 c.insert(c.end(), __first, __last); 00548 std::make_heap(c.begin(), c.end(), comp); 00549 } 00550 00551 template<typename _InputIterator> 00552 priority_queue(_InputIterator __first, _InputIterator __last, 00553 const _Compare& __x = _Compare(), 00554 _Sequence&& __s = _Sequence()) 00555 : c(std::move(__s)), comp(__x) 00556 { 00557 __glibcxx_requires_valid_range(__first, __last); 00558 c.insert(c.end(), __first, __last); 00559 std::make_heap(c.begin(), c.end(), comp); 00560 } 00561 #endif 00562 00563 /** 00564 * Returns true if the %queue is empty. 00565 */ 00566 bool 00567 empty() const 00568 { return c.empty(); } 00569 00570 /** Returns the number of elements in the %queue. */ 00571 size_type 00572 size() const 00573 { return c.size(); } 00574 00575 /** 00576 * Returns a read-only (constant) reference to the data at the first 00577 * element of the %queue. 00578 */ 00579 const_reference 00580 top() const 00581 { 00582 __glibcxx_requires_nonempty(); 00583 return c.front(); 00584 } 00585 00586 /** 00587 * @brief Add data to the %queue. 00588 * @param __x Data to be added. 00589 * 00590 * This is a typical %queue operation. 00591 * The time complexity of the operation depends on the underlying 00592 * sequence. 00593 */ 00594 void 00595 push(const value_type& __x) 00596 { 00597 c.push_back(__x); 00598 std::push_heap(c.begin(), c.end(), comp); 00599 } 00600 00601 #if __cplusplus >= 201103L 00602 void 00603 push(value_type&& __x) 00604 { 00605 c.push_back(std::move(__x)); 00606 std::push_heap(c.begin(), c.end(), comp); 00607 } 00608 00609 template<typename... _Args> 00610 void 00611 emplace(_Args&&... __args) 00612 { 00613 c.emplace_back(std::forward<_Args>(__args)...); 00614 std::push_heap(c.begin(), c.end(), comp); 00615 } 00616 #endif 00617 00618 /** 00619 * @brief Removes first element. 00620 * 00621 * This is a typical %queue operation. It shrinks the %queue 00622 * by one. The time complexity of the operation depends on the 00623 * underlying sequence. 00624 * 00625 * Note that no data is returned, and if the first element's 00626 * data is needed, it should be retrieved before pop() is 00627 * called. 00628 */ 00629 void 00630 pop() 00631 { 00632 __glibcxx_requires_nonempty(); 00633 std::pop_heap(c.begin(), c.end(), comp); 00634 c.pop_back(); 00635 } 00636 00637 #if __cplusplus >= 201103L 00638 void 00639 swap(priority_queue& __pq) 00640 noexcept(__and_< 00641 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 00642 __is_nothrow_swappable<_Sequence>, 00643 #else 00644 __is_nothrow_swappable<_Tp>, 00645 #endif 00646 __is_nothrow_swappable<_Compare> 00647 >::value) 00648 { 00649 using std::swap; 00650 swap(c, __pq.c); 00651 swap(comp, __pq.comp); 00652 } 00653 #endif // __cplusplus >= 201103L 00654 }; 00655 00656 // No equality/comparison operators are provided for priority_queue. 00657 00658 #if __cplusplus >= 201103L 00659 template<typename _Tp, typename _Sequence, typename _Compare> 00660 inline 00661 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 00662 // Constrained free swap overload, see p0185r1 00663 typename enable_if<__and_<__is_swappable<_Sequence>, 00664 __is_swappable<_Compare>>::value>::type 00665 #else 00666 void 00667 #endif 00668 swap(priority_queue<_Tp, _Sequence, _Compare>& __x, 00669 priority_queue<_Tp, _Sequence, _Compare>& __y) 00670 noexcept(noexcept(__x.swap(__y))) 00671 { __x.swap(__y); } 00672 00673 template<typename _Tp, typename _Sequence, typename _Compare, 00674 typename _Alloc> 00675 struct uses_allocator<priority_queue<_Tp, _Sequence, _Compare>, _Alloc> 00676 : public uses_allocator<_Sequence, _Alloc>::type { }; 00677 #endif // __cplusplus >= 201103L 00678 00679 _GLIBCXX_END_NAMESPACE_VERSION 00680 } // namespace 00681 00682 #endif /* _STL_QUEUE_H */