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