1 // Copyright Louis Dionne 2013-2017
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4 
5 #include <boost/hana/assert.hpp>
6 #include <boost/hana/equal.hpp>
7 #include <boost/hana/greater.hpp>
8 #include <boost/hana/integral_constant.hpp>
9 #include <boost/hana/maximum.hpp>
10 #include <boost/hana/tuple.hpp>
11 namespace hana = boost::hana;
12 
13 
main()14 int main() {
15     // without a predicate
16     BOOST_HANA_CONSTANT_CHECK(
17         hana::maximum(hana::tuple_c<int, -1, 0, 2, -4, 6, 9>) == hana::int_c<9>
18     );
19 
20     // with a predicate
21     auto smallest = hana::maximum(hana::tuple_c<int, -1, 0, 2, -4, 6, 9>, [](auto x, auto y) {
22         return x > y; // order is reversed!
23     });
24     BOOST_HANA_CONSTANT_CHECK(smallest == hana::int_c<-4>);
25 }
26