File indexing completed on 2025-12-15 09:52:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_HANA_DETAIL_FIRST_UNSATISFIED_INDEX_HPP
0011 #define BOOST_HANA_DETAIL_FIRST_UNSATISFIED_INDEX_HPP
0012
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/integral_constant.hpp>
0015 #include <boost/hana/value.hpp>
0016
0017 #include <utility>
0018
0019
0020 namespace boost { namespace hana { namespace detail {
0021 template <bool, typename Pred, typename ...Xs>
0022 struct find_tail_size;
0023
0024 template <typename Pred, typename X, typename ...Xs>
0025 struct find_tail_size<true, Pred, X, Xs...> {
0026 static constexpr int value = find_tail_size<
0027 static_cast<bool>(hana::value<decltype(std::declval<Pred>()(std::declval<X>()))>()),
0028 Pred, Xs...
0029 >::value;
0030 };
0031
0032 template <typename Pred>
0033 struct find_tail_size<true, Pred> {
0034 static constexpr int value = -1;
0035 };
0036
0037 template <typename Pred, typename ...Xs>
0038 struct find_tail_size<false, Pred, Xs...> {
0039 static constexpr int value = sizeof...(Xs);
0040 };
0041
0042
0043
0044
0045 template <typename Pred>
0046 struct first_unsatisfied_index {
0047 template <typename ...Xs>
0048 constexpr auto operator()(Xs&& ...) const {
0049 return hana::size_c<
0050 sizeof...(Xs) - 1 - find_tail_size<true, Pred, Xs&&...>::value
0051 >;
0052 }
0053 };
0054 } }}
0055
0056 #endif