# Conditional Expression

`select()` | conditional selection with mask

template<class T, class A>
inline batch<T, A> 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` or `false_br` depending on the boolean values in the constant batch `cond`.

  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.

template<class T, class A>
inline 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

  Ternary operator for batches: selects values from the batches `true_br` or `false_br` depending on the boolean values in the constant batch `cond`.

  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.

template<class T, class A, bool... Values>
inline batch<T, A> select(batch_bool_constant<T, A, Values...> 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` or `false_br` depending on the boolean values in the constant batch `cond`.

  Equivalent to

      for(std::size_t i = 0; i < N; ++i)
          res[i] = cond[i] ? true_br[i] : false_br[i];

  Parameters:

    - cond – constant batch condition.

    - true_br – batch values for truthy condition.

    - false_br – batch value for falsy condition.

  Returns:

    the result of the selection.

template<class T, class A, bool... Values>
inline batch_bool<T, A> select(batch_bool_constant<T, A, Values...> const &cond, batch_bool<T, A> const &true_br, batch_bool<T, A> const &false_br) noexcept

  Ternary operator for mask batches: selects values from the masks `true_br` or `false_br` depending on the boolean values in the constant batch `cond`.

  Equivalent to

      for(std::size_t i = 0; i < N; ++i)
          res[i] = cond[i] ? true_br[i] : false_br[i];

  Parameters:

    - cond – constant batch condition.

    - true_br – batch values for truthy condition.

    - false_br – batch value for falsy condition.

  Returns:

    the result of the selection.

In the specific case when one needs to conditionnaly increment or decrement a batch based on a mask, `incr_if()` and `decr_if()` provide specialized version.