Home | History | Annotate | Download | only in queue.defn
      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 // void swap(queue& q);
     13 
     14 #include <queue>
     15 #include <cassert>
     16 
     17 template <class C>
     18 C
     19 make(int n)
     20 {
     21     C c;
     22     for (int i = 0; i < n; ++i)
     23         c.push(i);
     24     return c;
     25 }
     26 
     27 int main()
     28 {
     29     std::queue<int> q1 = make<std::queue<int> >(5);
     30     std::queue<int> q2 = make<std::queue<int> >(10);
     31     std::queue<int> q1_save = q1;
     32     std::queue<int> q2_save = q2;
     33     q1.swap(q2);
     34     assert(q1 == q2_save);
     35     assert(q2 == q1_save);
     36 }
     37