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 // <algorithm>
11 
12 // template<RandomAccessIterator Iter>
13 //   requires ShuffleIterator<Iter> && LessThanComparable<Iter::value_type>
14 //   void
15 //   make_heap(Iter first, Iter last);
16 
17 #include <algorithm>
18 #include <cassert>
19 
20 void test(unsigned N)
21 {
22     int* ia = new int [N];
23     for (int i = 0; i < N; ++i)
24         ia[i] = i;
25     std::random_shuffle(ia, ia+N);
26     std::make_heap(ia, ia+N);
27     assert(std::is_heap(ia, ia+N));
28     delete [] ia;
29 }
30 
31 int main()
32 {
33     test(0);
34     test(1);
35     test(2);
36     test(3);
37     test(10);
38     test(1000);
39 }
40