• 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 // <list>
11 
12 // void merge(list& x);
13 
14 #include <list>
15 #include <cassert>
16 
17 #include "min_allocator.h"
18 
main()19 int main()
20 {
21     {
22     int a1[] = {1, 3, 7, 9, 10};
23     int a2[] = {0, 2, 4, 5, 6, 8, 11};
24     int a3[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
25     std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
26     std::list<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
27     c1.merge(c2);
28     assert(c1 == std::list<int>(a3, a3+sizeof(a3)/sizeof(a3[0])));
29     }
30 #if TEST_STD_VER >= 11
31     {
32     int a1[] = {1, 3, 7, 9, 10};
33     int a2[] = {0, 2, 4, 5, 6, 8, 11};
34     int a3[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
35     std::list<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
36     std::list<int, min_allocator<int>> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
37     c1.merge(c2);
38     assert((c1 == std::list<int, min_allocator<int>>(a3, a3+sizeof(a3)/sizeof(a3[0]))));
39     }
40 #endif
41 }
42