[simd.class]

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

## 29.10 Data-parallel types [[simd]](simd#class)

### 29.10.7 Class template basic_vec [simd.class]

#### [29.10.7.1](#simd.overview) Class template basic_vec overview [[simd.overview]](simd.overview)

[ð](#lib:basic_vec)

namespace std::simd {template<class T, class Abi> class basic_vec {public:using [value_type](#lib:basic_vec,value_type "29.10.7.1 Class template basic_­vec overview [simd.overview]") = T; using [mask_type](#lib:basic_vec,mask_type "29.10.7.1 Class template basic_­vec overview [simd.overview]") = basic_mask<sizeof(T), Abi>; using [abi_type](#lib:basic_vec,abi_type "29.10.7.1 Class template basic_­vec overview [simd.overview]") = Abi; using [iterator](#lib:basic_vec,iterator "29.10.7.1 Class template basic_­vec overview [simd.overview]") = *simd-iterator*<basic_vec>; using [const_iterator](#lib:basic_vec,const_iterator "29.10.7.1 Class template basic_­vec overview [simd.overview]") = *simd-iterator*<const basic_vec>; constexpr iterator [begin](#lib:basic_vec,begin "29.10.7.1 Class template basic_­vec overview [simd.overview]")() noexcept { return {*this, 0}; }constexpr const_iterator [begin](#lib:basic_vec,begin "29.10.7.1 Class template basic_­vec overview [simd.overview]")() const noexcept { return {*this, 0}; }constexpr const_iterator [cbegin](#lib:basic_vec,cbegin "29.10.7.1 Class template basic_­vec overview [simd.overview]")() const noexcept { return {*this, 0}; }constexpr default_sentinel_t [end](#lib:basic_vec,end "29.10.7.1 Class template basic_­vec overview [simd.overview]")() const noexcept { return {}; }constexpr default_sentinel_t [cend](#lib:basic_vec,cend "29.10.7.1 Class template basic_­vec overview [simd.overview]")() const noexcept { return {}; }static constexpr integral_constant<*simd-size-type*, *simd-size-v*<T, Abi>> [size](#lib:basic_vec,size "29.10.7.1 Class template basic_­vec overview [simd.overview]") {}; constexpr basic_vec() noexcept = default; // [[simd.ctor]](#simd.ctor "29.10.7.2 basic_­vec constructors"), basic_vec constructorstemplate<class U>constexpr explicit(*see below*) basic_vec(U&& value) noexcept; template<class U, class UAbi>constexpr explicit(*see below*) basic_vec(const basic_vec<U, UAbi>&) noexcept; template<class G>constexpr explicit basic_vec(G&& gen) noexcept; template<class R, class... Flags>constexpr basic_vec(R&& range, flags<Flags...> = {}); template<class R, class... Flags>constexpr basic_vec(R&& range, const mask_type& mask, flags<Flags...> = {}); template<[*simd-floating-point*](simd.expos#concept:simd-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr explicit(*see below*) basic_vec(const V& reals, const V& imags = {}) noexcept; // [[simd.subscr]](#simd.subscr "29.10.7.3 basic_­vec subscript operator"), basic_vec subscript operatorsconstexpr value_type operator[](*simd-size-type*) const; template<[*simd-integral*](simd.expos#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I>constexpr resize_t<I::size(), basic_vec> operator[](const I& indices) const; // [[simd.complex.access]](#simd.complex.access "29.10.7.4 basic_­vec complex accessors"), basic_vec complex accessorsconstexpr auto real() const noexcept; constexpr auto imag() const noexcept; template<[*simd-floating-point*](simd.expos#concept:simd-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr void real(const V& v) noexcept; template<[*simd-floating-point*](simd.expos#concept:simd-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>constexpr void imag(const V& v) noexcept; // [[simd.unary]](#simd.unary "29.10.7.5 basic_­vec unary operators"), basic_vec unary operatorsconstexpr basic_vec& operator++() noexcept; constexpr basic_vec operator++(int) noexcept; constexpr basic_vec& operator--() noexcept; constexpr basic_vec operator--(int) noexcept; constexpr mask_type operator!() const noexcept; constexpr basic_vec operator~() const noexcept; constexpr basic_vec operator+() const noexcept; constexpr basic_vec operator-() const noexcept; // [[simd.binary]](simd.binary "29.10.8.1 basic_­vec binary operators"), basic_vec binary operatorsfriend constexpr basic_vec operator+(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator-(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator*(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator/(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator%(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator&(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator|(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator^(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator<<(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator>>(const basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec operator<<(const basic_vec&, *simd-size-type*) noexcept; friend constexpr basic_vec operator>>(const basic_vec&, *simd-size-type*) noexcept; // [[simd.cassign]](simd.cassign "29.10.8.2 basic_­vec compound assignment"), basic_vec compound assignmentfriend constexpr basic_vec& operator+=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator-=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator*=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator/=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator%=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator&=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator|=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator^=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator<<=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator>>=(basic_vec&, const basic_vec&) noexcept; friend constexpr basic_vec& operator<<=(basic_vec&, *simd-size-type*) noexcept; friend constexpr basic_vec& operator>>=(basic_vec&, *simd-size-type*) noexcept; // [[simd.comparison]](simd.comparison "29.10.8.3 basic_­vec compare operators"), basic_vec compare operatorsfriend constexpr mask_type operator==(const basic_vec&, const basic_vec&) noexcept; friend constexpr mask_type operator!=(const basic_vec&, const basic_vec&) noexcept; friend constexpr mask_type operator>=(const basic_vec&, const basic_vec&) noexcept; friend constexpr mask_type operator<=(const basic_vec&, const basic_vec&) noexcept; friend constexpr mask_type operator>(const basic_vec&, const basic_vec&) noexcept; friend constexpr mask_type operator<(const basic_vec&, const basic_vec&) noexcept; // [[simd.cond]](simd.cond "29.10.8.4 basic_­vec exposition only conditional operators"), basic_vec exposition only conditional operatorsfriend constexpr basic_vec *simd-select-impl*( // *exposition only*const mask_type&, const basic_vec&, const basic_vec&) noexcept; }; template<class R, class... Ts> basic_vec(R&& r, Ts...) -> *see below*;}

[1](#simd.overview-1)

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

Every specialization of basic_vec is a complete type[.](#simd.overview-1.sentence-1)

The specialization of basic_vec<T, Abi> is

- [(1.1)](#simd.overview-1.1)

enabled, if T is a vectorizable type, and there exists value N in the range [1, 64], such that Abi is *deduce-abi-t*<T, N>,

- [(1.2)](#simd.overview-1.2)

otherwise, disabled, if T is not a vectorizable type,

- [(1.3)](#simd.overview-1.3)

otherwise, it is implementation-defined if such a specialization is enabled[.](#simd.overview-1.sentence-2)

If basic_vec<T, Abi> is disabled, then the specialization has a
deleted default constructor, deleted destructor, deleted copy constructor, and
deleted copy assignment[.](#simd.overview-1.sentence-3)

In addition only the value_type, abi_type, andmask_type members are present[.](#simd.overview-1.sentence-4)

If basic_vec<T, Abi> is enabled, then basic_vec<T, Abi> is
trivially copyable, default-initialization of an object of such a type
default-initializes all elements, and value-initialization value-initializes
all elements ([[dcl.init.general]](dcl.init.general "9.5.1 General"))[.](#simd.overview-1.sentence-5)

[2](#simd.overview-2)

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

*Recommended practice*: Implementations should support implicit conversions between specializations ofbasic_vec and appropriate implementation-defined types[.](#simd.overview-2.sentence-1)

[*Note [1](#simd.overview-note-1)*:

Appropriate types are non-standard vector types which are available in the
implementation[.](#simd.overview-2.sentence-2)

â *end note*]

#### [29.10.7.2](#simd.ctor) basic_vec constructors [[simd.ctor]](simd.ctor)

[ð](#lib:basic_vec,constructor)

`template<class U> constexpr explicit(see below) basic_vec(U&& value) noexcept;
`

[1](#simd.ctor-1)

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

Let From denote the type remove_cvref_t<U>[.](#simd.ctor-1.sentence-1)

[2](#simd.ctor-2)

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

*Constraints*: value_type satisfies [constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_­from [concept.constructible]")<U>[.](#simd.ctor-2.sentence-1)

[3](#simd.ctor-3)

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

*Effects*: Initializes each element to the value of the argument after conversion tovalue_type[.](#simd.ctor-3.sentence-1)

[4](#simd.ctor-4)

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

*Remarks*: The expression inside explicit evaluates to false if and only ifU satisfies [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")<value_type>, and either

- [(4.1)](#simd.ctor-4.1)

From is not an arithmetic type and does not satisfy [*constexpr-wrapper-like*](simd.expos#concept:constexpr-wrapper-like "29.10.2 Exposition-only types, variables, and concepts [simd.expos]"),

- [(4.2)](#simd.ctor-4.2)

From is an arithmetic type and the conversion from From to value_type is value-preserving ([[simd.general]](simd.general "29.10.1 General")), or

- [(4.3)](#simd.ctor-4.3)

From satisfies [*constexpr-wrapper-like*](simd.expos#concept:constexpr-wrapper-like "29.10.2 Exposition-only types, variables, and concepts [simd.expos]"), remove_const_t<decltype(From​::​value)> is an arithmetic type, and From​::​value is representable by value_type[.](#simd.ctor-4.sentence-1)

[ð](#lib:basic_vec,constructor_)

`template<class U, class UAbi>
  constexpr explicit(see below) basic_vec(const basic_vec<U, UAbi>& x) noexcept;
`

[5](#simd.ctor-5)

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

*Constraints*: *simd-size-v*<U, UAbi> == size() is true[.](#simd.ctor-5.sentence-1)

[6](#simd.ctor-6)

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

*Effects*: Initializes the ith element with static_cast<T>(x[i]) for
all i in the range of [0, size())[.](#simd.ctor-6.sentence-1)

[7](#simd.ctor-7)

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

*Remarks*: The expression inside explicit evaluates to true if either

- [(7.1)](#simd.ctor-7.1)

the conversion from U to value_type is not value-preserving,
 or

- [(7.2)](#simd.ctor-7.2)

both U and value_type are integral types and the integer
 conversion rank ([[conv.rank]](conv.rank "6.9.6 Conversion ranks")) of U is greater than the integer
 conversion rank of value_type, or

- [(7.3)](#simd.ctor-7.3)

both U and value_type are floating-point types and the
 floating-point conversion rank ([[conv.rank]](conv.rank "6.9.6 Conversion ranks")) of U is greater than
 the floating-point conversion rank of value_type[.](#simd.ctor-7.sentence-1)

[ð](#lib:basic_vec,constructor__)

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

[8](#simd.ctor-8)

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

Let Fromi denote the typedecltype(gen(integral_constant<*simd-size-type*, i>()))[.](#simd.ctor-8.sentence-1)

[9](#simd.ctor-9)

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

*Constraints*: Fromi satisfies [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")<value_type> for all i in
the range of [0, size())[.](#simd.ctor-9.sentence-1)

In addition, for all i in the range of [0, size()), if Fromi is an arithmetic type, conversion from Fromi to value_type is value-preserving[.](#simd.ctor-9.sentence-2)

[10](#simd.ctor-10)

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

*Effects*: Initializes the ith element withstatic_cast<value_type>(gen(integral_constant<*simd-​size-​type*,
i>())) for all i in the range of [0, size())[.](#simd.ctor-10.sentence-1)

[11](#simd.ctor-11)

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

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

[ð](#lib:basic_vec,constructor___)

`template<class R, class... Flags>
  constexpr basic_vec(R&& r, flags<Flags...> = {});
template<class R, class... Flags>
  constexpr basic_vec(R&& r, const mask_type& mask, flags<Flags...> = {});
`

[12](#simd.ctor-12)

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

Let mask be mask_type(true) for the overload with nomask parameter[.](#simd.ctor-12.sentence-1)

[13](#simd.ctor-13)

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

*Constraints*: 

- [(13.1)](#simd.ctor-13.1)

R models ranges​::​[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") and ranges​::​[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]"),

- [(13.2)](#simd.ctor-13.2)

ranges​::​size(r) is a constant expression, and

- [(13.3)](#simd.ctor-13.3)

ranges​::​size(r) is equal to size()[.](#simd.ctor-13.sentence-1)

[14](#simd.ctor-14)

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

*Mandates*: 

- [(14.1)](#simd.ctor-14.1)

ranges​::​range_value_t<R> is a vectorizable type, and

- [(14.2)](#simd.ctor-14.2)

if the template parameter pack Flags does not contain *convert-flag*, then the conversion from ranges​::​range_value_t<R> to value_type is value-preserving[.](#simd.ctor-14.sentence-1)

[15](#simd.ctor-15)

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

*Preconditions*: 

- [(15.1)](#simd.ctor-15.1)

  If the template parameter pack Flags contains *aligned-flag*, ranges​::​data(r) points to
 storage aligned by alignment_v<basic_vec,
 ranges​::​range_value_t<R>>[.](#simd.ctor-15.1.sentence-1)

- [(15.2)](#simd.ctor-15.2)

  If the template parameter pack Flags contains *overaligned-flag*<N>, ranges​::​data(r) points to
 storage aligned by N[.](#simd.ctor-15.2.sentence-1)

[16](#simd.ctor-16)

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

*Effects*: Initializes the ith element with mask[i] ?static_cast<T>(​ranges​::​​data(r)[i]) : T() for all i in the
range of [0, size())[.](#simd.ctor-16.sentence-1)

[ð](#simd.ctor-itemdecl:5)

`template<class R, class... Ts>
  basic_vec(R&& r, Ts...) -> see below;
`

[17](#simd.ctor-17)

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

*Constraints*: 

- [(17.1)](#simd.ctor-17.1)

R models ranges​::​[contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]") and ranges​::​[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]"), and

- [(17.2)](#simd.ctor-17.2)

ranges​::​size(r) is a constant expression[.](#simd.ctor-17.sentence-1)

[18](#simd.ctor-18)

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

*Remarks*: The deduced type is equivalent to vec<ranges​::​range_value_t<R>,
ranges​::​size(r)>[.](#simd.ctor-18.sentence-1)

[ð](#lib:basic_vec,constructor____)

`template<[simd-floating-point](simd.expos#concept:simd-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr explicit(see below)
    basic_vec(const V& reals, const V& imags = {}) noexcept;
`

[19](#simd.ctor-19)

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

*Constraints*: 

- [(19.1)](#simd.ctor-19.1)

[*simd-complex*](simd.expos#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]")<basic_vec> is modeled, and

- [(19.2)](#simd.ctor-19.2)

V​::​size() == size() is true[.](#simd.ctor-19.sentence-1)

[20](#simd.ctor-20)

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

*Effects*: Initializes the ith element with value_type(reals[i],
imags[i]) for all i in the range [0, size())[.](#simd.ctor-20.sentence-1)

[21](#simd.ctor-21)

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

*Remarks*: The expression inside explicit evaluates to false if and only
if the floating-point conversion rank of T​::​value_type is greater than
or equal to the floating-point conversion rank of V​::​value_type[.](#simd.ctor-21.sentence-1)

#### [29.10.7.3](#simd.subscr) basic_vec subscript operator [[simd.subscr]](simd.subscr)

[ð](#lib:operator%5b%5d,basic_vec)

`constexpr value_type operator[](simd-size-type i) const;
`

[1](#simd.subscr-1)

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

*Preconditions*: i >= 0 && i < size() is true[.](#simd.subscr-1.sentence-1)

[2](#simd.subscr-2)

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

*Returns*: The value of the ith element[.](#simd.subscr-2.sentence-1)

[3](#simd.subscr-3)

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

*Throws*: Nothing[.](#simd.subscr-3.sentence-1)

[ð](#lib:operator%5b%5d,basic_vec_)

`template<[simd-integral](simd.expos#concept:simd-integral "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") I>
  constexpr resize_t<I::size(), basic_vec> operator[](const I& indices) const;
`

[4](#simd.subscr-4)

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

*Effects*: Equivalent to: return permute(*this, indices);

#### [29.10.7.4](#simd.complex.access) basic_vec complex accessors [[simd.complex.access]](simd.complex.access)

[ð](#lib:real,basic_vec)

`constexpr auto real() const noexcept;
constexpr auto imag() const noexcept;
`

[1](#simd.complex.access-1)

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

*Constraints*: [*simd-complex*](simd.expos#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]")<basic_vec> is modeled[.](#simd.complex.access-1.sentence-1)

[2](#simd.complex.access-2)

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

*Returns*: An object of type rebind_t<typename T​::​value_type, basic_vec> where the ith element is initialized to the result of*cmplx-func*(operator[](i)) for all i in the range
[0, size()), where *cmplx-func* is the corresponding function
from [<complex>](complex.syn#header:%3ccomplex%3e "29.4.2 Header <complex> synopsis [complex.syn]")[.](#simd.complex.access-2.sentence-1)

[ð](#lib:real,basic_vec_)

`template<[simd-floating-point](simd.expos#concept:simd-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr void real(const V& v) noexcept;
template<[simd-floating-point](simd.expos#concept:simd-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]") V>
  constexpr void imag(const V& v) noexcept;
`

[3](#simd.complex.access-3)

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

*Constraints*: 

- [(3.1)](#simd.complex.access-3.1)

[*simd-complex*](simd.expos#concept:simd-complex "29.10.2 Exposition-only types, variables, and concepts [simd.expos]")<basic_vec> is modeled,

- [(3.2)](#simd.complex.access-3.2)

[same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<typename V​::​value_type, typename T​::​value_type> is modeled, and

- [(3.3)](#simd.complex.access-3.3)

V​::​size() == size() is true[.](#simd.complex.access-3.sentence-1)

[4](#simd.complex.access-4)

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

*Effects*: Replaces each element of the basic_vec object such that theith element is replaced with value_type(v[i],operator[](i).imag()) or value_type(operator[](i).real(), v[i]) for real and imag respectively, for all i in the range [0, size())[.](#simd.complex.access-4.sentence-1)

#### [29.10.7.5](#simd.unary) basic_vec unary operators [[simd.unary]](simd.unary)

[1](#simd.unary-1)

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

Effects in [[simd.unary]](#simd.unary "29.10.7.5 basic_­vec unary operators") are applied as unary element-wise operations[.](#simd.unary-1.sentence-1)

[ð](#lib:operator++,basic_vec)

`constexpr basic_vec& operator++() noexcept;
`

[2](#simd.unary-2)

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

*Constraints*: requires (value_type a) { ++a; } is true[.](#simd.unary-2.sentence-1)

[3](#simd.unary-3)

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

*Effects*: Increments every element by one[.](#simd.unary-3.sentence-1)

[4](#simd.unary-4)

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

*Returns*: *this[.](#simd.unary-4.sentence-1)

[ð](#lib:operator++,basic_vec_)

`constexpr basic_vec operator++(int) noexcept;
`

[5](#simd.unary-5)

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

*Constraints*: requires (value_type a) { a++; } is true[.](#simd.unary-5.sentence-1)

[6](#simd.unary-6)

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

*Effects*: Increments every element by one[.](#simd.unary-6.sentence-1)

[7](#simd.unary-7)

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

*Returns*: A copy of *this before incrementing[.](#simd.unary-7.sentence-1)

[ð](#lib:operator--,basic_vec)

`constexpr basic_vec& operator--() noexcept;
`

[8](#simd.unary-8)

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

*Constraints*: requires (value_type a) { --a; } is true[.](#simd.unary-8.sentence-1)

[9](#simd.unary-9)

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

*Effects*: Decrements every element by one[.](#simd.unary-9.sentence-1)

[10](#simd.unary-10)

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

*Returns*: *this[.](#simd.unary-10.sentence-1)

[ð](#lib:operator--,basic_vec_)

`constexpr basic_vec operator--(int) noexcept;
`

[11](#simd.unary-11)

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

*Constraints*: requires (value_type a) { a--; } is true[.](#simd.unary-11.sentence-1)

[12](#simd.unary-12)

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

*Effects*: Decrements every element by one[.](#simd.unary-12.sentence-1)

[13](#simd.unary-13)

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

*Returns*: A copy of *this before decrementing[.](#simd.unary-13.sentence-1)

[ð](#lib:operator,operator,basic_vec)

`constexpr mask_type operator!() const noexcept;
`

[14](#simd.unary-14)

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

*Constraints*: requires (const value_type a) { !a; } is true[.](#simd.unary-14.sentence-1)

[15](#simd.unary-15)

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

*Returns*: A basic_mask object with the ith element set to!operator[](i) for all i in the range of [0, size())[.](#simd.unary-15.sentence-1)

[ð](#lib:operator~,basic_vec)

`constexpr basic_vec operator~() const noexcept;
`

[16](#simd.unary-16)

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

*Constraints*: requires (const value_type a) { ~a; } is true[.](#simd.unary-16.sentence-1)

[17](#simd.unary-17)

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

*Returns*: A basic_vec object with the ith element set to~operator[](i) for all i in the range of [0, size())[.](#simd.unary-17.sentence-1)

[ð](#lib:operator+,basic_vec)

`constexpr basic_vec operator+() const noexcept;
`

[18](#simd.unary-18)

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

*Constraints*: requires (const value_type a) { +a; } is true[.](#simd.unary-18.sentence-1)

[19](#simd.unary-19)

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

*Returns*: *this[.](#simd.unary-19.sentence-1)

[ð](#lib:operator-,basic_vec)

`constexpr basic_vec operator-() const noexcept;
`

[20](#simd.unary-20)

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

*Constraints*: requires (const value_type a) { -a; } is true[.](#simd.unary-20.sentence-1)

[21](#simd.unary-21)

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

*Returns*: A basic_vec object where the ith element is initialized to-operator[](i) for all i in the range of [0, size())[.](#simd.unary-21.sentence-1)
