Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / hana / benchmark / find_if / compile.hana.set.erb.cpp
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/bool.hpp>
6 #include <boost/hana/find_if.hpp>
7 #include <boost/hana/integral_constant.hpp>
8 #include <boost/hana/set.hpp>
9 namespace hana = boost::hana;
10
11
12 struct is_last {
13     template <typename N>
14     constexpr auto operator()(N) const {
15         return hana::bool_c<N::value == <%= input_size %>>;
16     }
17 };
18
19 int main() {
20     constexpr auto set = hana::make_set(
21         <%= (1..input_size).map { |n| "hana::int_c<#{n}>" }.join(', ') %>
22     );
23     constexpr auto result = hana::find_if(set, is_last{});
24     (void)result;
25 }