29 #ifndef VC_COMMON_IIF_H_
30 #define VC_COMMON_IIF_H_
32 #include <Vc/type_traits>
35 namespace Vc_VERSIONED_NAMESPACE
60 template <
typename Mask,
typename T>
61 Vc_ALWAYS_INLINE enable_if<is_simd_mask<Mask>::value && is_simd_vector<T>::value, T>
iif(
62 const Mask &condition,
const T &trueValue,
const T &falseValue)
65 Vc::where(condition) | result = trueValue;
73 template <
typename Mask,
typename T>
74 enable_if<is_simd_mask<Mask>::value && !is_simd_vector<T>::value, T>
iif(
75 const Mask &,
const T &,
const T &) =
delete;
91 template<
typename T> constexpr T
iif (
bool condition,
const T &trueValue,
const T &falseValue)
93 return condition ? trueValue : falseValue;
98 #endif // VC_COMMON_IIF_H_
The main SIMD mask class.
constexpr T iif(bool condition, const T &trueValue, const T &falseValue)
Overload of the above for boolean conditions.
constexpr WhereImpl::WhereMask< M > where(const M &mask)
Conditional assignment.