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