Conditional expression¶
-
template<class T, class A>
inline batch<T, A> xsimd::select(batch_bool<T, A> const &cond, batch<T, A> const &true_br, batch<T, A> const &false_br) noexcept¶ Ternary operator for batches: selects values from the batches
true_br
orfalse_br
depending on the boolean values in the constant batchcond
.Equivalent to
for(std::size_t i = 0; i < N; ++i) res[i] = cond[i] ? true_br[i] : false_br[i];
- Parameters:
cond – batch condition.
true_br – batch values for truthy condition.
false_br – batch value for falsy condition.
- Returns:
the result of the selection.
Warning
doxygenfunction: Unable to resolve function “xsimd::select” with arguments (batch_bool_constant<T, A> const&, batch<T, A> const&, batch<T, A> const&) in doxygen xml output for project “xsimd” from directory: ../xml. Potential matches:
- template<class T, class A, bool... Values> batch<T, A> select(batch_bool_constant<batch<T, A>, Values...> const &cond, batch<T, A> const &true_br, batch<T, A> const &false_br) noexcept
- template<class T, class A> batch<T, A> select(batch_bool<T, A> const &cond, batch<T, A> const &true_br, batch<T, A> const &false_br) noexcept
- template<class T, class A> batch<std::complex<T>, A> select(batch_bool<T, A> const &cond, batch<std::complex<T>, A> const &true_br, batch<std::complex<T>, A> const &false_br) noexcept