[simd.complex.access]

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

## 29.10 Data-parallel types [[simd]](simd#complex.access)

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

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

[ð](#lib:real,basic_vec)

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

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

[2](#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]")[.](#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](#3)

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

*Constraints*: 

- [(3.1)](#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)](#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)](#3.3)

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

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