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<ForwardIterator Iter>
13 // requires LessThanComparable<Iter::value_type>
15 // max_element(Iter first, Iter last);
21 #include "test_iterators.h"
23 std::mt19937 randomness;
27 test(Iter first, Iter last)
29 Iter i = std::max_element(first, last);
32 for (Iter j = first; j != last; ++j)
44 for (int i = 0; i < N; ++i)
46 std::shuffle(a, a+N, randomness);
47 test(Iter(a), Iter(a+N));
63 #if TEST_STD_VER >= 14
64 constexpr int il[] = { 2, 4, 6, 8, 7, 5, 3, 1 };
69 #if TEST_STD_VER >= 14
70 constexpr auto p = std::max_element(il,il+8);
71 static_assert ( *p == 8, "" );
77 test<forward_iterator<const int*> >();
78 test<bidirectional_iterator<const int*> >();
79 test<random_access_iterator<const int*> >();