Home | History | Annotate | Download | only in priqueue.special
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <queue>
     11 
     12 // priority_queue();
     13 
     14 // template <class T, class Container, class Compare>
     15 //   void swap(priority_queue<T, Container, Compare>& x,
     16 //             priority_queue<T, Container, Compare>& y);
     17 
     18 #include <queue>
     19 #include <cassert>
     20 
     21 int main()
     22 {
     23     std::priority_queue<int> q1;
     24     std::priority_queue<int> q2;
     25     q1.push(1);
     26     q1.push(3);
     27     q1.push(2);
     28     swap(q1, q2);
     29     assert(q1.empty());
     30     assert(q2.size() == 3);
     31     assert(q2.top() == 3);
     32 }
     33