[simd.mask.ctor]

# 29 Numerics library [[numerics]](./#numerics)

## 29.10 Data-parallel types [[simd]](simd#mask.ctor)

### 29.10.9 Class template basic_mask [[simd.mask.class]](simd.mask.class#simd.mask.ctor)

#### 29.10.9.2 basic_mask constructors [simd.mask.ctor]

[ð](#lib:basic_mask,constructor)

`constexpr explicit basic_mask(value_type x) noexcept;
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L20152)

*Effects*: Initializes each element with x[.](#1.sentence-1)

[ð](#lib:basic_mask,constructor_)

`template<size_t UBytes, class UAbi>
  constexpr explicit basic_mask(const basic_mask<UBytes, UAbi>& x) noexcept;
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L20164)

*Constraints*: basic_mask<UBytes, UAbi>​::​size() == size() istrue[.](#2.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L20169)

*Effects*: Initializes the ith element with x[i] for all i in the
range of [0, size())[.](#3.sentence-1)

[ð](#lib:basic_mask,constructor__)

`template<class G> constexpr explicit basic_mask(G&& gen);
`

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L20181)

*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())[.](#4.sentence-1)

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L20187)

*Effects*: Initializes the ith element withgen(integral_constant<*simd-size-type*, i>()) for all i in
the range of [0, size())[.](#5.sentence-1)

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L20193)

*Remarks*: gen is invoked exactly once for each i, in increasing order of i[.](#6.sentence-1)

[ð](#lib:basic_mask,constructor___)

`constexpr basic_mask(const bitset<size()>& b) noexcept;
`

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L20204)

*Effects*: Initializes the ith element with b[i] for all i in the
range [0, size())[.](#7.sentence-1)

[ð](#lib:basic_mask,constructor____)

`constexpr explicit basic_mask([unsigned_integral](concepts.arithmetic#concept:unsigned_integral "18.4.7 Arithmetic concepts [concepts.arithmetic]") auto val) noexcept;
`

[8](#8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L20216)

*Effects*: Initializes the first M elements to the corresponding bit values inval, where M is the smaller of size() and the number of bits in
the value representation ([[basic.types.general]](basic.types.general "6.9.1 General")) of the type of val[.](#8.sentence-1)

IfM is less than size(), the remaining elements are initialized to
zero[.](#8.sentence-2)
