[simd.overview]

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

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

### 29.10.7 Class template basic_vec [[simd.class]](simd.class#simd.overview)

#### 29.10.7.1 Class template basic_vec 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](#1)

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

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

The specialization of basic_vec<T, Abi> is

- [(1.1)](#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)](#1.2)

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

- [(1.3)](#1.3)

otherwise, it is implementation-defined if such a specialization is enabled[.](#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[.](#1.sentence-3)

In addition only the value_type, abi_type, andmask_type members are present[.](#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"))[.](#1.sentence-5)

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

[*Note [1](#note-1)*:

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

â *end note*]
