[simd.overview] (original) (raw)

29 Numerics library [numerics]

29.10 Data-parallel types [simd]

29.10.7 Class template basic_vec [simd.class]

29.10.7.1 Overview [simd.overview]

namespace std::simd { template<class T, class Abi> class basic_vec { using real-type = see below; public: using value_type = T;using mask_type = basic_mask<sizeof(T), Abi>;using abi_type = Abi;using iterator = simd-iterator<basic_vec>;using const_iterator = simd-iterator<const basic_vec>;constexpr iterator begin() noexcept { return {*this, 0}; } constexpr const_iterator begin() const noexcept { return {*this, 0}; } constexpr const_iterator cbegin() const noexcept { return {*this, 0}; } constexpr default_sentinel_t end() const noexcept { return {}; } constexpr default_sentinel_t cend() const noexcept { return {}; } static constexpr integral_constant<_simd-size-type_, _simd-size-v_<T, Abi>> size {};constexpr basic_vec() noexcept = default;template<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);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...> = {});constexpr basic_vec(const real-type& reals, const real-type& imags = {}) noexcept;constexpr value_type operator[](_simd-size-type_) const;template<simd-integral I> constexpr resize_t<I::size(), basic_vec> operator[](const I& indices) const;constexpr real-type real() const noexcept;constexpr real-type imag() const noexcept;constexpr void real(const real-type& v) noexcept;constexpr void imag(const real-type& v) noexcept;constexpr 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;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&, 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;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&, 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;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;friend constexpr mask_type operator<(const basic_vec&, const basic_vec&) noexcept;friend constexpr basic_vec _simd-select-impl_( const mask_type&, const basic_vec&, const basic_vec&) noexcept;};template<class R, class... Ts> basic_vec(R&& r, Ts...) -> see below;template<size_t Bytes, class Abi> basic_vec(basic_mask<Bytes, Abi>) -> see below;}

Every specialization of basic_vec is a complete type.

The specialization of basic_vec<T, Abi> is

If basic_vec<T, Abi> is disabled, then the specialization has a deleted default constructor, deleted destructor, deleted copy constructor, and deleted copy assignment.

In addition only the value_type, abi_type, andmask_type members are present.

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]).

Recommended practice: Implementations should support implicit conversions between specializations ofbasic_vec and appropriate implementation-defined types.

[Note 1:

Appropriate types are non-standard vector types which are available in the implementation.

— _end note_]

If T is a specialization of complex,real-type denotes the same type asrebind_t<typename T​::​value_type, basic_vec<T, Abi>>, otherwise an unspecified non-array object type.