libstdc++: Numeric Arrays

libstdc++

Numeric Arrays
Numerics
Collaboration diagram for Numeric Arrays:

## Classes
class | std::gslice
class | std::gslice_array< _Tp >
class | std::indirect_array< _Tp >
class | std::mask_array< _Tp >
class | std::slice
class | std::slice_array< _Tp >
class | std::valarray< _Tp >

## Functions
| std::gslice::gslice ()
| std::gslice::gslice (const gslice &)
| std::gslice::gslice (size_t __o, const valarray< size_t > &__l, const valarray< size_t > &__s)
| std::gslice_array< _Tp >::gslice_array (const gslice_array &)
| std::indirect_array< _Tp >::indirect_array (const indirect_array &)
| std::mask_array< _Tp >::mask_array (const mask_array &)
| std::slice::slice ()
| std::slice::slice (size_t __o, size_t __d, size_t __s)
| std::slice_array< _Tp >::slice_array (const slice_array &)
| std::valarray< _Tp >::valarray () noexcept
template<class _Dom>
| std::valarray< _Tp >::valarray (const _Expr< _Dom, _Tp > &__e)
| std::valarray< _Tp >::valarray (const _Tp &, size_t)
template<typename _Tp>
| std::valarray< _Tp >::valarray (const _Tp *__restrict__ __p, size_t __n)
| std::valarray< _Tp >::valarray (const gslice_array< _Tp > &)
| std::valarray< _Tp >::valarray (const indirect_array< _Tp > &)
| std::valarray< _Tp >::valarray (const mask_array< _Tp > &)
| std::valarray< _Tp >::valarray (const slice_array< _Tp > &)
| std::valarray< _Tp >::valarray (const valarray &)
| std::valarray< _Tp >::valarray (initializer_list< _Tp >)
| std::valarray< _Tp >::valarray (size_t)
| std::valarray< _Tp >::valarray (valarray &&) noexcept
| std::gslice::~gslice ()
_Expr< _ValFunClos< _ValArray, _Tp >, _Tp > | std::valarray< _Tp >::apply (_Tp __func(_Tp)) const
_Expr< _RefFunClos< _ValArray, _Tp >, _Tp > | std::valarray< _Tp >::apply (_Tp __func(const _Tp &)) const
template<class _Tp>
const _Tp * | std::begin (const valarray< _Tp > &__va) noexcept
template<class _Tp>
_Tp * | std::begin (valarray< _Tp > &__va) noexcept
valarray< _Tp > | std::valarray< _Tp >::cshift (int __n) const
template<class _Tp>
const _Tp * | std::end (const valarray< _Tp > &__va) noexcept
template<class _Tp>
_Tp * | std::end (valarray< _Tp > &__va) noexcept
_Tp | std::valarray< _Tp >::max () const
_Tp | std::valarray< _Tp >::min () const
gslice & | std::gslice::operator= (const gslice &)
template<class _Dom>
void | std::gslice_array< _Tp >::operator= (const _Expr< _Dom, _Tp > &) const
void | std::gslice_array< _Tp >::operator= (const _Tp &) const
gslice_array & | std::gslice_array< _Tp >::operator= (const gslice_array &)
void | std::gslice_array< _Tp >::operator= (const valarray< _Tp > &) const
template<class _Dom>
void | std::indirect_array< _Tp >::operator= (const _Expr< _Dom, _Tp > &) const
void | std::indirect_array< _Tp >::operator= (const _Tp &) const
indirect_array & | std::indirect_array< _Tp >::operator= (const indirect_array &)
void | std::indirect_array< _Tp >::operator= (const valarray< _Tp > &) const
template<class _Ex>
void | std::mask_array< _Tp >::operator= (const _Expr< _Ex, _Tp > &__e) const
void | std::mask_array< _Tp >::operator= (const _Tp &) const
mask_array & | std::mask_array< _Tp >::operator= (const mask_array &)
void | std::mask_array< _Tp >::operator= (const valarray< _Tp > &) const
template<class _Dom>
void | std::slice_array< _Tp >::operator= (const _Expr< _Dom, _Tp > &) const
void | std::slice_array< _Tp >::operator= (const _Tp &) const
slice_array & | std::slice_array< _Tp >::operator= (const slice_array &)
void | std::slice_array< _Tp >::operator= (const valarray< _Tp > &) const
template<class _Dom>
valarray< _Tp > & | std::valarray< _Tp >::operator= (const _Expr< _Dom, _Tp > &)
valarray< _Tp > & | std::valarray< _Tp >::operator= (const _Tp &__t)
valarray< _Tp > & | std::valarray< _Tp >::operator= (const gslice_array< _Tp > &__ga)
valarray< _Tp > & | std::valarray< _Tp >::operator= (const indirect_array< _Tp > &__ia)
valarray< _Tp > & | std::valarray< _Tp >::operator= (const mask_array< _Tp > &__ma)
valarray< _Tp > & | std::valarray< _Tp >::operator= (const slice_array< _Tp > &__sa)
valarray< _Tp > & | std::valarray< _Tp >::operator= (const valarray< _Tp > &__v)
valarray & | std::valarray< _Tp >::operator= (initializer_list< _Tp > __l)
valarray< _Tp > & | std::valarray< _Tp >::operator= (valarray< _Tp > &&__v) noexcept
gslice_array< _Tp > | std::valarray< _Tp >::operator[] (const gslice &__s)
_Expr< _GClos< _ValArray, _Tp >, _Tp > | std::valarray< _Tp >::operator[] (const gslice &__s) const
mask_array< _Tp > | std::valarray< _Tp >::operator[] (const valarray< bool > &__m)
valarray< _Tp > | std::valarray< _Tp >::operator[] (const valarray< bool > &__m) const
indirect_array< _Tp > | std::valarray< _Tp >::operator[] (const valarray< size_t > &__i)
_Expr< _IClos< _ValArray, _Tp >, _Tp > | std::valarray< _Tp >::operator[] (const valarray< size_t > &__i) const
_Tp & | std::valarray< _Tp >::operator[] (size_t __i) noexcept
const _Tp & | std::valarray< _Tp >::operator[] (size_t) const noexcept
slice_array< _Tp > | std::valarray< _Tp >::operator[] (slice __s)
_Expr< _SClos< _ValArray, _Tp >, _Tp > | std::valarray< _Tp >::operator[] (slice __s) const
void | std::valarray< _Tp >::resize (size_t __size, _Tp __c=_Tp())
valarray< _Tp > | std::valarray< _Tp >::shift (int __n) const
valarray< size_t > | std::gslice::size () const
size_t | std::slice::size () const
size_t | std::valarray< _Tp >::size () const
size_t | std::gslice::start () const
size_t | std::slice::start () const
valarray< size_t > | std::gslice::stride () const
size_t | std::slice::stride () const
_Tp | std::valarray< _Tp >::sum () const
void | std::valarray< _Tp >::swap (valarray< _Tp > &__v) noexcept
template<typename _Tp, size_t _Nm>
| std::valarray (const _Tp(&)[_Nm], size_t) -> valarray< _Tp >

## Detailed Description

Classes and functions for representing and manipulating arrays of elements.

## Function Documentation

## ◆ gslice() [1/3]

std::gslice::gslice | ( |  | ) |
| inline

Construct an empty slice.

Definition at line 151 of file gslice.h.

References gslice().

Referenced by gslice(), gslice(), gslice(), and operator=().

## ◆ gslice() [2/3]

std::gslice::gslice | ( | const gslice & | __g | ) |
| inline

Copy constructor.

Definition at line 160 of file gslice.h.

References gslice().

## ◆ gslice() [3/3]

std::gslice::gslice | ( | size_t | __o,
|  | const valarray< size_t > & | __l,
|  | const valarray< size_t > & | __s )
| inline

Construct a slice.

Constructs a slice with as many dimensions as the length of the l and s arrays.

Parameters

  __o | Offset in array of first element.
  __l | Array of dimension lengths.
  __s | Array of dimension strides between array elements.

Definition at line 155 of file gslice.h.

References gslice().

## ◆ gslice_array()

template<typename _Tp>

std::gslice_array< _Tp >::gslice_array | ( | const gslice_array< _Tp > & | __a | ) |
| inline

Copy constructor. Both slices refer to the same underlying array.

Definition at line 150 of file gslice_array.h.

References gslice_array().

Referenced by gslice_array(), and operator=().

## ◆ indirect_array()

template<typename _Tp>

std::indirect_array< _Tp >::indirect_array | ( | const indirect_array< _Tp > & | __a | ) |
| inline

Copy constructor. Both slices refer to the same underlying array.

Definition at line 145 of file indirect_array.h.

References indirect_array().

Referenced by indirect_array(), and operator=().

## ◆ mask_array()

template<typename _Tp>

std::mask_array< _Tp >::mask_array | ( | const mask_array< _Tp > & | __a | ) |
| inline

Copy constructor. Both slices refer to the same underlying array.

Definition at line 146 of file mask_array.h.

References mask_array().

Referenced by mask_array(), and operator=().

## ◆ slice() [1/2]

std::slice::slice | ( |  | ) |
| inline

Construct an empty slice.

Definition at line 97 of file slice_array.h.

Referenced by operator==.

## ◆ slice() [2/2]

std::slice::slice | ( | size_t | __o,
|  | size_t | __d,
|  | size_t | __s )
| inline

Construct a slice.

Parameters

  __o | Offset in array of first element.
  __d | Number of elements in slice.
  __s | Stride between array elements.

Definition at line 101 of file slice_array.h.

## ◆ slice_array()

template<typename _Tp>

std::slice_array< _Tp >::slice_array | ( | const slice_array< _Tp > & | __a | ) |
| inline

Copy constructor. Both slices refer to the same underlying array.

Definition at line 219 of file slice_array.h.

References slice_array().

Referenced by slice_array(), and operator=().

## ◆ valarray() [1/12]

template<typename _Tp>

std::valarray< _Tp >::valarray | ( |  | ) |
| inlinenoexcept

Construct an empty array.

Definition at line 626 of file valarray.

Referenced by valarray(), valarray(), valarray(), cshift(), operator%=(), operator%=(), operator&=(), operator&=(), operator*=(), operator*=(), operator+=(), operator+=(), operator-=(), operator-=(), operator/=(), operator/=(), operator<<=(), operator=(), operator=(), operator>>=(), operator>>=(), operator[](), operator[](), operator[](), operator[](), operator^=(), operator^=(), operator|=(), shift(), and swap().

## ◆ valarray() [2/12]

template<typename _Tp>
template<class _Dom>

std::valarray< _Tp >::valarray | ( | const _Expr< _Dom, _Tp > & | __e | ) |
| inline

Definition at line 715 of file valarray.

## ◆ valarray() [3/12]

template<typename _Tp>

std::valarray< _Tp >::valarray | ( | const _Tp & | __t,
|  | size_t | __n )
| inline

Construct an array with n elements initialized to t.

Definition at line 636 of file valarray.

## ◆ valarray() [4/12]

template<class _Tp>
template<typename _Tp>

std::valarray< _Tp >::valarray | ( | const _Tp *__restrict__ | __p,
|  | size_t | __n )
| inline

Definition at line 642 of file valarray.

## ◆ valarray() [5/12]

template<typename _Tp>

std::valarray< _Tp >::valarray | ( | const gslice_array< _Tp > & | __ga | ) |
| inline

Construct an array with the same size and values in ga.

Definition at line 678 of file valarray.

References size().

## ◆ valarray() [6/12]

template<typename _Tp>

std::valarray< _Tp >::valarray | ( | const indirect_array< _Tp > & | __ia | ) |
| inline

Construct an array with the same size and values in ia.

Definition at line 698 of file valarray.

## ◆ valarray() [7/12]

template<typename _Tp>

std::valarray< _Tp >::valarray | ( | const mask_array< _Tp > & | __ma | ) |
| inline

Construct an array with the same size and values in ma.

Definition at line 689 of file valarray.

## ◆ valarray() [8/12]

template<typename _Tp>

std::valarray< _Tp >::valarray | ( | const slice_array< _Tp > & | __sa | ) |
| inline

Construct an array with the same size and values in sa.

Definition at line 669 of file valarray.

## ◆ valarray() [9/12]

template<typename _Tp>

std::valarray< _Tp >::valarray | ( | const valarray< _Tp > & | __v | ) |
| inline

Copy constructor.

Definition at line 651 of file valarray.

References valarray().

## ◆ valarray() [10/12]

template<typename _Tp>

std::valarray< _Tp >::valarray | ( | initializer_list< _Tp > | __l | ) |
| inline

Construct an array with an initializer_list of values.

Definition at line 708 of file valarray.

References size().

## ◆ valarray() [11/12]

template<typename _Tp>

std::valarray< _Tp >::valarray | ( | size_t | __n | ) |
| inlineexplicit

Construct an array with n elements.

Definition at line 630 of file valarray.

## ◆ valarray() [12/12]

template<typename _Tp>

std::valarray< _Tp >::valarray | ( | valarray< _Tp > && | __v | ) |
| inlinenoexcept

Move constructor.

Definition at line 659 of file valarray.

References valarray().

## ◆ ~gslice()

std::gslice::~gslice | ( |  | ) |
| inline

Destructor.

Definition at line 165 of file gslice.h.

## ◆ ~valarray()

template<typename _Tp>

std::valarray< _Tp >::~valarray | ( |  | ) |
| inlinenoexcept

Definition at line 721 of file valarray.

## ◆ apply() [1/2]

template<class _Tp>

_Expr< _ValFunClos< _ValArray, _Tp >, _Tp > std::valarray< _Tp >::apply | ( | _Tp | __func_Tp | ) | const
| inline

Apply a function to the array.

Returns a new valarray with elements assigned to the result of applying __func to the corresponding element of this array. The new array has the same size as this one.

Parameters

  __func | Function of Tp returning Tp to apply.

Returns
  New valarray with transformed elements.

Definition at line 1078 of file valarray.

## ◆ apply() [2/2]

template<class _Tp>

_Expr< _RefFunClos< _ValArray, _Tp >, _Tp > std::valarray< _Tp >::apply | ( | _Tp | __funcconst _Tp & | ) | const
| inline

Apply a function to the array.

Returns a new valarray with elements assigned to the result of applying __func to the corresponding element of this array. The new array has the same size as this one.

Parameters

  __func | Function of const Tp& returning Tp to apply.

Returns
  New valarray with transformed elements.

Definition at line 1086 of file valarray.

## ◆ begin() [1/2]

template<class _Tp>

const _Tp * std::begin | ( | const valarray< _Tp > & | __va | ) |
| inlinenoexcept

Return an iterator pointing to the first element of the const valarray.

Parameters

  __va | valarray.

Definition at line 1241 of file valarray.

References __addressof().

## ◆ begin() [2/2]

template<class _Tp>

_Tp * std::begin | ( | valarray< _Tp > & | __va | ) |
| inlinenoexcept

Return an iterator pointing to the first element of the valarray.

Parameters

  __va | valarray.

Definition at line 1230 of file valarray.

References __addressof().

Referenced by cbegin(), std::vector< _Tp, _Alloc >::insert(), std::list< _Tp, _Alloc >::merge(), std::list< _Tp, _Alloc >::merge(), std::list< _Tp, _Alloc >::remove(), std::list< _Tp, _Alloc >::remove_if(), std::list< _Tp, _Alloc >::sort(), std::list< _Tp, _Alloc >::sort(), std::list< _Tp, _Alloc >::unique(), and std::list< _Tp, _Alloc >::unique().

## ◆ cshift()

template<class _Tp>

valarray< _Tp > std::valarray< _Tp >::cshift | ( | int | __n | ) | const
| inline

Return a rotated array.

A new valarray is constructed as a copy of this array with elements in shifted positions. For an element with index i, the new position is (i - n) % size(). The new valarray has the same size as the current one. Elements that are shifted beyond the array bounds are shifted into the other end of the array. No elements are lost.

Positive arguments shift toward index 0, wrapping around the top. Negative arguments shift towards the top, wrapping around to 0.

Parameters

  __n | Number of element positions to rotate.

Returns
  New valarray with elements in shifted positions.

Definition at line 1004 of file valarray.

References valarray().

## ◆ end() [1/2]

template<class _Tp>

const _Tp * std::end | ( | const valarray< _Tp > & | __va | ) |
| inlinenoexcept

Return an iterator pointing to one past the last element of the const valarray.

Parameters

  __va | valarray.

Definition at line 1268 of file valarray.

References __addressof().

## ◆ end() [2/2]

template<class _Tp>

_Tp * std::end | ( | valarray< _Tp > & | __va | ) |
| inlinenoexcept

Return an iterator pointing to one past the last element of the valarray.

Parameters

  __va | valarray.

Definition at line 1252 of file valarray.

References __addressof().

Referenced by cend(), std::vector< _Tp, _Alloc >::insert(), std::list< _Tp, _Alloc >::merge(), std::list< _Tp, _Alloc >::merge(), std::vector< _Tp, _Alloc >::operator=(), std::list< _Tp, _Alloc >::remove(), std::list< _Tp, _Alloc >::remove_if(), std::list< _Tp, _Alloc >::resize(), std::list< _Tp, _Alloc >::resize(), std::list< _Tp, _Alloc >::sort(), std::list< _Tp, _Alloc >::sort(), std::list< _Tp, _Alloc >::unique(), and std::list< _Tp, _Alloc >::unique().

## ◆ max()

template<typename _Tp>

_Tp std::valarray< _Tp >::max | ( |  | ) | const
| inline

Return the maximum element using operator<().

Definition at line 1070 of file valarray.

## ◆ min()

template<typename _Tp>

_Tp std::valarray< _Tp >::min | ( |  | ) | const
| inline

Return the minimum element using operator<().

Definition at line 1062 of file valarray.

## ◆ operator=() [1/26]

gslice & std::gslice::operator= | ( | const gslice & | __g | ) |
| inline

Assignment operator.

Definition at line 172 of file gslice.h.

References gslice().

## ◆ operator=() [2/26]

template<typename _Tp>
template<class _Dom>

void std::gslice_array< _Tp >::operator= | ( | const _Expr< _Dom, _Tp > & | __e | ) | const
| inline

Definition at line 182 of file gslice_array.h.

## ◆ operator=() [3/26]

template<typename _Tp>

void std::gslice_array< _Tp >::operator= | ( | const _Tp & | __t | ) | const
| inline

Assign all slice elements to t.

Definition at line 165 of file gslice_array.h.

## ◆ operator=() [4/26]

template<typename _Tp>

gslice_array< _Tp > & std::gslice_array< _Tp >::operator= | ( | const gslice_array< _Tp > & | __a | ) |
| inline

Assignment operator. Assigns slice elements to corresponding elements of a.

Definition at line 155 of file gslice_array.h.

References gslice_array().

## ◆ operator=() [5/26]

template<typename _Tp>

void std::gslice_array< _Tp >::operator= | ( | const valarray< _Tp > & | __v | ) | const
| inline

Assign slice elements to corresponding elements of v.

Definition at line 173 of file gslice_array.h.

References std::valarray< _Tp >::size().

## ◆ operator=() [6/26]

template<typename _Tp>
template<class _Dom>

void std::indirect_array< _Tp >::operator= | ( | const _Expr< _Dom, _Tp > & | __e | ) | const
| inline

Definition at line 176 of file indirect_array.h.

## ◆ operator=() [7/26]

template<typename _Tp>

void std::indirect_array< _Tp >::operator= | ( | const _Tp & | __t | ) | const
| inline

Assign all slice elements to t.

Definition at line 165 of file indirect_array.h.

## ◆ operator=() [8/26]

template<typename _Tp>

indirect_array< _Tp > & std::indirect_array< _Tp >::operator= | ( | const indirect_array< _Tp > & | __a | ) |
| inline

Assignment operator. Assigns elements to corresponding elements of a.

Definition at line 156 of file indirect_array.h.

References indirect_array().

## ◆ operator=() [9/26]

template<typename _Tp>

void std::indirect_array< _Tp >::operator= | ( | const valarray< _Tp > & | __v | ) | const
| inline

Assign slice elements to corresponding elements of v.

Definition at line 170 of file indirect_array.h.

## ◆ operator=() [10/26]

template<class _Tp>
template<class _Ex>

void std::mask_array< _Tp >::operator= | ( | const _Expr< _Ex, _Tp > & | __e | ) | const
| inline

Definition at line 180 of file mask_array.h.

## ◆ operator=() [11/26]

template<typename _Tp>

void std::mask_array< _Tp >::operator= | ( | const _Tp & | __t | ) | const
| inline

Assign all slice elements to t.

Definition at line 166 of file mask_array.h.

## ◆ operator=() [12/26]

template<typename _Tp>

mask_array< _Tp > & std::mask_array< _Tp >::operator= | ( | const mask_array< _Tp > & | __a | ) |
| inline

Assignment operator. Assigns elements to corresponding elements of a.

Definition at line 156 of file mask_array.h.

References mask_array().

## ◆ operator=() [13/26]

template<typename _Tp>

void std::mask_array< _Tp >::operator= | ( | const valarray< _Tp > & | __v | ) | const
| inline

Definition at line 171 of file mask_array.h.

## ◆ operator=() [14/26]

template<typename _Tp>
template<class _Dom>

void std::slice_array< _Tp >::operator= | ( | const _Expr< _Dom, _Tp > & | __e | ) | const
| inline

Definition at line 247 of file slice_array.h.

## ◆ operator=() [15/26]

template<typename _Tp>

void std::slice_array< _Tp >::operator= | ( | const _Tp & | __t | ) | const
| inline

Assign all slice elements to t.

Definition at line 236 of file slice_array.h.

## ◆ operator=() [16/26]

template<typename _Tp>

slice_array< _Tp > & std::slice_array< _Tp >::operator= | ( | const slice_array< _Tp > & | __a | ) |
| inline

Assignment operator. Assigns slice elements to corresponding elements of a.

Definition at line 227 of file slice_array.h.

References slice_array().

## ◆ operator=() [17/26]

template<typename _Tp>

void std::slice_array< _Tp >::operator= | ( | const valarray< _Tp > & | __v | ) | const
| inline

Assign slice elements to corresponding elements of v.

Definition at line 241 of file slice_array.h.

## ◆ operator=() [18/26]

template<typename _Tp>
template<class _Dom>

valarray< _Tp > & std::valarray< _Tp >::operator= | ( | const _Expr< _Dom, _Tp > & | __e | ) |
| inline

Definition at line 841 of file valarray.

## ◆ operator=() [19/26]

template<typename _Tp>

valarray< _Tp > & std::valarray< _Tp >::operator= | ( | const _Tp & | __t | ) |
| inline

Assign elements to a value.

Assign all elements of array to t.

Parameters

  __t | Value for elements.

Definition at line 793 of file valarray.

## ◆ operator=() [20/26]

template<typename _Tp>

valarray< _Tp > & std::valarray< _Tp >::operator= | ( | const gslice_array< _Tp > & | __ga | ) |
| inline

Assign elements to an array subset.

Assign elements of array to values in ga. Results are undefined if ga does not have the same size as this array.

Parameters

  __ga | Array slice to get values from.

Definition at line 811 of file valarray.

References size().

## ◆ operator=() [21/26]

template<typename _Tp>

valarray< _Tp > & std::valarray< _Tp >::operator= | ( | const indirect_array< _Tp > & | __ia | ) |
| inline

Assign elements to an array subset.

Assign elements of array to values in ia. Results are undefined if ia does not have the same size as this array.

Parameters

  __ia | Array slice to get values from.

Definition at line 831 of file valarray.

## ◆ operator=() [22/26]

template<typename _Tp>

valarray< _Tp > & std::valarray< _Tp >::operator= | ( | const mask_array< _Tp > & | __ma | ) |
| inline

Assign elements to an array subset.

Assign elements of array to values in ma. Results are undefined if ma does not have the same size as this array.

Parameters

  __ma | Array slice to get values from.

Definition at line 821 of file valarray.

## ◆ operator=() [23/26]

template<typename _Tp>

valarray< _Tp > & std::valarray< _Tp >::operator= | ( | const slice_array< _Tp > & | __sa | ) |
| inline

Assign elements to an array subset.

Assign elements of array to values in sa. Results are undefined if sa does not have the same size as this array.

Parameters

  __sa | Array slice to get values from.

Definition at line 801 of file valarray.

## ◆ operator=() [24/26]

template<typename _Tp>

valarray< _Tp > & std::valarray< _Tp >::operator= | ( | const valarray< _Tp > & | __v | ) |
| inline

Assign elements to an array.

Assign elements of array to values in v.

Parameters

  __v | Valarray to get values from.

Definition at line 729 of file valarray.

References valarray().

## ◆ operator=() [25/26]

template<typename _Tp>

valarray< _Tp > & std::valarray< _Tp >::operator= | ( | initializer_list< _Tp > | __l | ) |
| inline

Assign elements to an initializer_list.

Assign elements of array to values in __l. Results are undefined if __l does not have the same size as this array.

Parameters

  __l | initializer_list to get values from.

Definition at line 769 of file valarray.

## ◆ operator=() [26/26]

template<typename _Tp>

valarray< _Tp > & std::valarray< _Tp >::operator= | ( | valarray< _Tp > && | __v | ) |
| inlinenoexcept

Move assign elements to an array.

Move assign elements of array to values in v.

Parameters

  __v | Valarray to get values from.

Definition at line 753 of file valarray.

References valarray().

## ◆ operator[]() [1/10]

template<typename _Tp>

gslice_array< _Tp > std::valarray< _Tp >::operator[] | ( | const gslice & | __s | ) |
| inline

Return a reference to an array subset.

Returns a new valarray containing the elements of the array indicated by the gslice argument. The new valarray has the same size as the input gslice.

See also
  gslice.

Parameters

  __s | The source gslice.

Returns
  New valarray containing elements in __s.

Definition at line 891 of file valarray.

## ◆ operator[]() [2/10]

template<typename _Tp>

_Expr< _GClos< _ValArray, _Tp >, _Tp > std::valarray< _Tp >::operator[] | ( | const gslice & | __s | ) | const
| inline

Return an array subset.

Returns a slice_array referencing the elements of the array indicated by the slice argument.

See also
  gslice.

Parameters

  __s | The source slice.

Returns
  Slice_array referencing elements indicated by __s.

Definition at line 882 of file valarray.

## ◆ operator[]() [3/10]

template<typename _Tp>

mask_array< _Tp > std::valarray< _Tp >::operator[] | ( | const valarray< bool > & | __m | ) |
| inline

Return a reference to an array subset.

Returns a new mask_array referencing the elements of the array indicated by the argument. The input is a valarray of bool which represents a bitmask indicating which elements are part of the subset. Elements of the array are part of the subset if the corresponding element of the argument is true.

Parameters

  __m | The valarray bitmask.

Returns
  New valarray containing elements indicated by __m.

Definition at line 912 of file valarray.

References valarray(), and size().

## ◆ operator[]() [4/10]

template<typename _Tp>

valarray< _Tp > std::valarray< _Tp >::operator[] | ( | const valarray< bool > & | __m | ) | const
| inline

Return an array subset.

Returns a new valarray containing the elements of the array indicated by the argument. The input is a valarray of bool which represents a bitmask indicating which elements should be copied into the new valarray. Each element of the array is added to the return valarray if the corresponding element of the argument is true.

Parameters

  __m | The valarray bitmask.

Returns
  New valarray containing elements indicated by __m.

Definition at line 899 of file valarray.

References valarray(), and size().

## ◆ operator[]() [5/10]

template<typename _Tp>

indirect_array< _Tp > std::valarray< _Tp >::operator[] | ( | const valarray< size_t > & | __i | ) |
| inline

Return a reference to an array subset.

Returns an indirect_array referencing the elements of the array indicated by the argument. The elements in the argument are interpreted as the indices of elements of this valarray to include in the subset. The returned indirect_array refers to these elements.

Parameters

  __i | The valarray element index list.

Returns
  Indirect_array referencing elements in __i.

Definition at line 932 of file valarray.

References valarray(), and size().

## ◆ operator[]() [6/10]

template<typename _Tp>

_Expr< _IClos< _ValArray, _Tp >, _Tp > std::valarray< _Tp >::operator[] | ( | const valarray< size_t > & | __i | ) | const
| inline

Return an array subset.

Returns a new valarray containing the elements of the array indicated by the argument. The elements in the argument are interpreted as the indices of elements of this valarray to copy to the return valarray.

Parameters

  __i | The valarray element index list.

Returns
  New valarray containing elements in __s.

Definition at line 924 of file valarray.

References valarray().

## ◆ operator[]() [7/10]

template<typename _Tp>

_Tp & std::valarray< _Tp >::operator[] | ( | size_t | __i | ) |
| inlinenoexcept

Return a reference to the i'th array element.

Parameters

  __i | Index of element to return.

Returns
  Reference to the i'th element.

Definition at line 597 of file valarray.

## ◆ operator[]() [8/10]

template<typename _Tp>

const _Tp & std::valarray< _Tp >::operator[] | ( | size_t | __i | ) | const
| inlinenoexcept

Definition at line 589 of file valarray.

## ◆ operator[]() [9/10]

template<typename _Tp>

slice_array< _Tp > std::valarray< _Tp >::operator[] | ( | slice | __s | ) |
| inline

Return a reference to an array subset.

Returns a new valarray containing the elements of the array indicated by the slice argument. The new valarray has the same size as the input slice.

See also
  slice.

Parameters

  __s | The source slice.

Returns
  New valarray containing elements in __s.

Definition at line 877 of file valarray.

## ◆ operator[]() [10/10]

template<typename _Tp>

_Expr< _SClos< _ValArray, _Tp >, _Tp > std::valarray< _Tp >::operator[] | ( | slice | __s | ) | const
| inline

Return an array subset.

Returns a new valarray containing the elements of the array indicated by the slice argument. The new valarray has the same size as the input slice.

See also
  slice.

Parameters

  __s | The source slice.

Returns
  New valarray containing elements in __s.

Definition at line 869 of file valarray.

## ◆ resize()

template<class _Tp>

void std::valarray< _Tp >::resize | ( | size_t | __size,
|  | _Tp | __c = _Tp() )
| inline

Resize array.

Resize this array to size and set all elements to c. All references and iterators are invalidated.

Parameters

  __size | New array size.
  __c | New value for all elements.

Definition at line 1045 of file valarray.

## ◆ shift()

template<class _Tp>

valarray< _Tp > std::valarray< _Tp >::shift | ( | int | __n | ) | const
| inline

Return a shifted array.

A new valarray is constructed as a copy of this array with elements in shifted positions. For an element with index i, the new position is i - n. The new valarray has the same size as the current one. New elements without a value are set to 0. Elements whose new position is outside the bounds of the array are discarded.

Positive arguments shift toward index 0, discarding elements [0, n). Negative arguments discard elements from the top of the array.

Parameters

  __n | Number of element positions to shift.

Returns
  New valarray with elements in shifted positions.

Definition at line 963 of file valarray.

References valarray().

## ◆ size() [1/3]

valarray< size_t > std::gslice::size | ( |  | ) | const
| inline

Return array of sizes of slice dimensions.

Definition at line 141 of file gslice.h.

## ◆ size() [2/3]

size_t std::slice::size | ( |  | ) | const
| inline

Return size of slice.

Definition at line 109 of file slice_array.h.

## ◆ size() [3/3]

template<class _Tp>

size_t std::valarray< _Tp >::size | ( |  | ) | const
| inline

Return the number of elements in array.

Definition at line 950 of file valarray.

Referenced by valarray(), valarray(), std::gslice_array< _Tp >::operator=(), operator=(), operator[](), operator[](), and operator[]().

## ◆ start() [1/2]

size_t std::gslice::start | ( |  | ) | const
| inline

Return array offset of first slice element.

Definition at line 137 of file gslice.h.

## ◆ start() [2/2]

size_t std::slice::start | ( |  | ) | const
| inline

Return array offset of first slice element.

Definition at line 105 of file slice_array.h.

## ◆ stride() [1/2]

valarray< size_t > std::gslice::stride | ( |  | ) | const
| inline

Return array of array strides for each dimension.

Definition at line 145 of file gslice.h.

## ◆ stride() [2/2]

size_t std::slice::stride | ( |  | ) | const
| inline

Return array stride of slice.

Definition at line 113 of file slice_array.h.

## ◆ sum()

template<class _Tp>

_Tp std::valarray< _Tp >::sum | ( |  | ) | const
| inline

Return the sum of all elements in the array.

Accumulates the sum of all elements into a Tp using +=. The order of adding the elements is unspecified.

Definition at line 955 of file valarray.

## ◆ swap()

template<class _Tp>

void std::valarray< _Tp >::swap | ( | valarray< _Tp > & | __v | ) |
| inlinenoexcept

Swap.

Definition at line 941 of file valarray.

References valarray().