1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // template<RandomAccessIterator Iter>
13 // requires ShuffleIterator<Iter>
14 // && LessThanComparable<Iter::value_type>
16 // push_heap(Iter first, Iter last);
22 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
28 bool operator()(const P& x, const P& y)
32 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
34 std::mt19937 randomness;
38 int* ia = new int [N];
39 for (int i = 0; i < N; ++i)
41 std::shuffle(ia, ia+N, randomness);
42 for (int i = 0; i <= N; ++i)
44 std::push_heap(ia, ia+i, std::greater<int>());
45 assert(std::is_heap(ia, ia+i, std::greater<int>()));
54 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
57 std::unique_ptr<int>* ia = new std::unique_ptr<int> [N];
58 for (int i = 0; i < N; ++i)
59 ia[i].reset(new int(i));
60 std::shuffle(ia, ia+N, randomness);
61 for (int i = 0; i <= N; ++i)
63 std::push_heap(ia, ia+i, indirect_less());
64 assert(std::is_heap(ia, ia+i, indirect_less()));
68 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES