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> sort(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[] = {4, 8, 1, 0, 5, 7, 2, 3, 6, 11, 10, 9};
24     int a2[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
25     std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
26     c1.sort(std::greater<int>());
27     assert(c1 == std::list<int>(a2, a2+sizeof(a2)/sizeof(a2[0])));
28     }
29 #if __cplusplus >= 201103L
30     {
31     int a1[] = {4, 8, 1, 0, 5, 7, 2, 3, 6, 11, 10, 9};
32     int a2[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
33     std::list<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
34     c1.sort(std::greater<int>());
35     assert((c1 == std::list<int, min_allocator<int>>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
36     }
37 #endif
38 }
39