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/any_of.hpp>
6 #include <boost/hana/assert.hpp>
7 #include <boost/hana/equal.hpp>
8 #include <boost/hana/map.hpp>
9 #include <boost/hana/not.hpp>
10 
11 #include <laws/base.hpp>
12 #include <support/minimal_product.hpp>
13 namespace hana = boost::hana;
14 
15 
16 template <int i>
key()17 auto key() { return hana::test::ct_eq<i>{}; }
18 
19 template <int i>
val()20 auto val() { return hana::test::ct_eq<-i>{}; }
21 
22 template <int i, int j>
p()23 auto p() { return ::minimal_product(key<i>(), val<j>()); }
24 
main()25 int main() {
26     BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::any_of(
27         hana::make_map(),
28         hana::equal.to(key<1>()
29     ))));
30 
31     BOOST_HANA_CONSTANT_CHECK(hana::any_of(
32         hana::make_map(p<1, 1>()),
33         hana::equal.to(key<1>())
34     ));
35     BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::any_of(
36         hana::make_map(p<1, 1>()),
37         hana::equal.to(key<2>())
38     )));
39 
40     BOOST_HANA_CONSTANT_CHECK(hana::any_of(
41         hana::make_map(p<1, 1>(), p<2, 2>()),
42         hana::equal.to(key<1>())
43     ));
44     BOOST_HANA_CONSTANT_CHECK(hana::any_of(
45         hana::make_map(p<1, 1>(), p<2, 2>()),
46         hana::equal.to(key<2>())
47     ));
48     BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::any_of(
49         hana::make_map(p<1, 1>(), p<2, 2>()),
50         hana::equal.to(key<3>())
51     )));
52 }
53