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