29 Numerics library [numerics]

29.10 Data-parallel types [simd]

29.10.8 Class template basic_simd_mask [simd.mask.class]

29.10.8.1 Class template basic_simd_mask overview [simd.mask.overview]

namespace std { template<size_t Bytes, class Abi> class basic_simd_mask { public: using value_type = bool; using abi_type = Abi; static constexpr integral_constant<simd-size-type, simd-size-v<integer-from<Bytes>, Abi>> size {}; constexpr basic_simd_mask() noexcept = default; // [simd.mask.ctor], basic_simd_mask constructors constexpr explicit basic_simd_mask(value_type) noexcept; template<size_t UBytes, class UAbi> constexpr explicit basic_simd_mask(const basic_simd_mask<UBytes, UAbi>&) noexcept; template<class G> constexpr explicit basic_simd_mask(G&& gen) noexcept; // [simd.mask.subscr], basic_simd_mask subscript operators constexpr value_type operator[](simd-size-type) const; // [simd.mask.unary], basic_simd_mask unary operators constexpr basic_simd_mask operator!() const noexcept; constexpr basic_simd<integer-from<Bytes>, Abi> operator+() const noexcept; constexpr basic_simd<integer-from<Bytes>, Abi> operator-() const noexcept; constexpr basic_simd<integer-from<Bytes>, Abi> operator~() const noexcept; // [simd.mask.conv], basic_simd_mask conversion operators template<class U, class A> constexpr explicit(sizeof(U) != Bytes) operator basic_simd<U, A>() const noexcept; // [simd.mask.binary], basic_simd_mask binary operators friend constexpr basic_simd_mask operator&&(const basic_simd_mask&, const basic_simd_mask&) noexcept; friend constexpr basic_simd_mask operator||(const basic_simd_mask&, const basic_simd_mask&) noexcept; friend constexpr basic_simd_mask operator&(const basic_simd_mask&, const basic_simd_mask&) noexcept; friend constexpr basic_simd_mask operator|(const basic_simd_mask&, const basic_simd_mask&) noexcept; friend constexpr basic_simd_mask operator^(const basic_simd_mask&, const basic_simd_mask&) noexcept; // [simd.mask.cassign], basic_simd_mask compound assignment friend constexpr basic_simd_mask& operator&=(basic_simd_mask&, const basic_simd_mask&) noexcept; friend constexpr basic_simd_mask& operator|=(basic_simd_mask&, const basic_simd_mask&) noexcept; friend constexpr basic_simd_mask& operator^=(basic_simd_mask&, const basic_simd_mask&) noexcept; // [simd.mask.comparison], basic_simd_mask comparisons friend constexpr basic_simd_mask operator==(const basic_simd_mask&, const basic_simd_mask&) noexcept; friend constexpr basic_simd_mask operator!=(const basic_simd_mask&, const basic_simd_mask&) noexcept; friend constexpr basic_simd_mask operator>=(const basic_simd_mask&, const basic_simd_mask&) noexcept; friend constexpr basic_simd_mask operator<=(const basic_simd_mask&, const basic_simd_mask&) noexcept; friend constexpr basic_simd_mask operator>(const basic_simd_mask&, const basic_simd_mask&) noexcept; friend constexpr basic_simd_mask operator<(const basic_simd_mask&, const basic_simd_mask&) noexcept; // [simd.mask.cond], basic_simd_mask exposition only conditional operators friend constexpr basic_simd_mask simd-select-impl( // exposition only const basic_simd_mask&, const basic_simd_mask&, const basic_simd_mask&) noexcept; friend constexpr basic_simd_mask simd-select-impl( // exposition only const basic_simd_mask&, same_as<bool> auto, same_as<bool> auto) noexcept; template<class T0, class T1> friend constexpr simd<see below, size()> simd-select-impl(const basic_simd_mask&, const T0&, const T1&) noexcept; // exposition only }; }
Every specialization of basic_simd_mask is a complete type.
The specialization of basic_simd_mask<Bytes, Abi> is:
  • disabled, if there is no vectorizable type T such that Bytes is equal to sizeof(T),
  • otherwise, enabled, if there exists a vectorizable type T and a value N in the range [1, 64] such that Bytes is equal to sizeof(T) and Abi is deduce-abi-t<T, N>,
  • otherwise, it is implementation-defined if such a specialization is enabled.
If basic_simd_mask<Bytes, Abi> is disabled, the specialization has a deleted default constructor, deleted destructor, deleted copy constructor, and deleted copy assignment.
In addition only the value_type and abi_type members are present.
If basic_simd_mask<Bytes, Abi> is enabled, basic_simd_mask<Bytes, Abi> is trivially copyable.
Recommended practice: Implementations should support explicit conversions between specializations of basic_simd_mask and appropriate implementation-defined types.
[Note 1: 
Appropriate types are non-standard vector types which are available in the implementation.
— end note]

29.10.8.2 basic_simd_mask constructors [simd.mask.ctor]

constexpr explicit basic_simd_mask(value_type x) noexcept;
Effects: Initializes each element with x.
template<size_t UBytes, class UAbi> constexpr explicit basic_simd_mask(const basic_simd_mask<UBytes, UAbi>& x) noexcept;
Constraints: basic_simd_mask<UBytes, UAbi>​::​size() == size() is true.
Effects: Initializes the element with x[i] for all i in the range of [0, size()).
template<class G> constexpr explicit basic_simd_mask(G&& gen) noexcept;
Constraints: The expression gen(integral_constant<simd-size-type, i>()) is well-formed and its type is bool for all i in the range of [0, size()).
Effects: Initializes the element with gen(integral_constant<simd-size-type, i>()) for all i in the range of [0, size()).
Remarks: The calls to gen are unsequenced with respect to each other.
Vectorization-unsafe ([algorithms.parallel.defns]) standard library functions may not be invoked by gen.
gen is invoked exactly once for each i.

29.10.8.3 basic_simd_mask subscript operator [simd.mask.subscr]

constexpr value_type operator[](simd-size-type i) const;
Preconditions: i >= 0 && i < size() is true.
Returns: The value of the element.
Throws: Nothing.

29.10.8.4 basic_simd_mask unary operators [simd.mask.unary]

constexpr basic_simd_mask operator!() const noexcept; constexpr basic_simd<integer-from<Bytes>, Abi> operator+() const noexcept; constexpr basic_simd<integer-from<Bytes>, Abi> operator-() const noexcept; constexpr basic_simd<integer-from<Bytes>, Abi> operator~() const noexcept;
Let op be the operator.
Returns: A data-parallel object where the element is initialized to the results of applying op to operator[](i) for all i in the range of [0, size()).

29.10.8.5 basic_simd_mask conversion operators [simd.mask.conv]

template<class U, class A> constexpr explicit(sizeof(U) != Bytes) operator basic_simd<U, A>() const noexcept;
Constraints: simd-size-v<U, A> == simd-size-v<T, Abi>.
Returns: A data-parallel object where the element is initialized to static_cast<U>(operator[](i)).