• 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 // <vector>
11 
12 // void swap(vector& x);
13 
14 #include <vector>
15 #include <cassert>
16 
17 #include "min_allocator.h"
18 
main()19 int main()
20 {
21     {
22         std::vector<int> v1(100);
23         std::vector<int> v2(200);
24         v1.swap(v2);
25         assert(v1.size() == 200);
26         assert(v1.capacity() == 200);
27         assert(v2.size() == 100);
28         assert(v2.capacity() == 100);
29     }
30 #if __cplusplus >= 201103L
31     {
32         std::vector<int, min_allocator<int>> v1(100);
33         std::vector<int, min_allocator<int>> v2(200);
34         v1.swap(v2);
35         assert(v1.size() == 200);
36         assert(v1.capacity() == 200);
37         assert(v2.size() == 100);
38         assert(v2.capacity() == 100);
39     }
40 #endif
41 }
42