57template <
bool... values>
61 template <std::size_t idx,
bool v1,
bool... vs>
64 static constexpr std::size_t
value =
69 template <std::
size_t idx,
bool v>
72 static constexpr std::size_t
value = (v ? idx : idx + 1);
80template <
bool... conds>
84static_assert(first_true_v<true, false, false> == 0);
85static_assert(first_true_v<false, true, false> == 1);
86static_assert(first_true_v<false, false, true> == 2);
87static_assert(first_true_v<false, false, false> == 3);
88static_assert(first_true_v<false, false, true, false> == 2);
89static_assert(first_true_v<false, false, false, true> == 3);
static constexpr std::size_t first_true_v
Shorthand for first_true.
Definition: first_true.hpp:81
Main namespace of the library.
Definition: basic_types.hpp:50
Implementation of first_true.
Definition: first_true.hpp:62
static constexpr std::size_t value
The index of the first value set to true.
Definition: first_true.hpp:64
From a list of Boolean values, find the first that is set to true.
Definition: first_true.hpp:58
static constexpr std::size_t value
The index of the value in values set to true.
Definition: first_true.hpp:76