1 // Copyright Louis Dionne 2013-2017
2 // Copyright Jason Rice 2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
5 
6 #include <boost/hana/core/is_a.hpp>
7 #include <boost/hana/equal.hpp>
8 #include <boost/hana/index_if.hpp>
9 #include <boost/hana/integral_constant.hpp>
10 #include <boost/hana/optional.hpp>
11 #include <boost/hana/tuple.hpp>
12 namespace hana = boost::hana;
13 
14 
15 constexpr auto xs = hana::make_tuple(0, '1', 2.0);
16 
17 static_assert(hana::index_if(xs, hana::is_an<int>)   == hana::just(hana::size_c<0>), "");
18 static_assert(hana::index_if(xs, hana::is_a<char>)   == hana::just(hana::size_c<1>), "");
19 static_assert(hana::index_if(xs, hana::is_a<double>) == hana::just(hana::size_c<2>), "");
20 static_assert(hana::index_if(xs, hana::is_a<hana::tuple_tag>) == hana::nothing, "");
21 
main()22 int main() { }
23