• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/concept/struct.hpp>
8 #include <boost/hana/equal.hpp>
9 #include <boost/hana/integral_constant.hpp>
10 #include <boost/hana/not.hpp>
11 
12 #include "minimal_struct.hpp"
13 namespace hana = boost::hana;
14 
15 
16 template <int i = 0>
17 struct undefined { };
18 
main()19 int main() {
20     BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::any_of(
21         obj(),
22         undefined<>{}
23     )));
24 
25     BOOST_HANA_CONSTANT_CHECK(hana::any_of(
26         obj(undefined<0>{}),
27         hana::equal.to(hana::int_c<0>)
28     ));
29     BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::any_of(
30         obj(undefined<0>{}),
31         hana::equal.to(hana::int_c<1>)
32     )));
33 
34     BOOST_HANA_CONSTANT_CHECK(hana::any_of(
35         obj(undefined<0>{}, undefined<1>{}),
36         hana::equal.to(hana::int_c<0>)
37     ));
38     BOOST_HANA_CONSTANT_CHECK(hana::any_of(
39         obj(undefined<0>{}, undefined<1>{}),
40         hana::equal.to(hana::int_c<1>)
41     ));
42     BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::any_of(
43         obj(undefined<0>{}, undefined<1>{}),
44         hana::equal.to(hana::int_c<2>)
45     )));
46 }
47