libstdc++: std::valarray< _Tp > Class Template Reference

libstdc++

std::valarray< _Tp > Class Template Reference
Numerics » Numeric Arrays

`#include <valarray>`

## Public Types
typedef const _Tp * | const_iterator
typedef _Tp * | iterator
typedef _Tp | value_type

## Public Member Functions
| valarray () noexcept
template<class _Dom>
| valarray (const _Expr< _Dom, _Tp > &__e)
| valarray (const _Tp &, size_t)
template<typename _Tp>
| valarray (const _Tp *__restrict__ __p, size_t __n)
| valarray (const _Tp *__restrict__, size_t)
| valarray (const gslice_array< _Tp > &)
| valarray (const indirect_array< _Tp > &)
| valarray (const mask_array< _Tp > &)
| valarray (const slice_array< _Tp > &)
| valarray (const valarray &)
| valarray (initializer_list< _Tp >)
| valarray (size_t)
| valarray (valarray &&) noexcept
_Expr< _ValFunClos< _ValArray, _Tp >, _Tp > | apply (_Tp __func(_Tp)) const
_Expr< _RefFunClos< _ValArray, _Tp >, _Tp > | apply (_Tp __func(const _Tp &)) const
const_iterator | begin () const noexcept
iterator | begin () noexcept
valarray< _Tp > | cshift (int __n) const
const_iterator | end () const noexcept
iterator | end () noexcept
_Tp | max () const
_Tp | min () const
_UnaryOp< __logical_not >::_Rt | operator! () const
template<class _Dom>
valarray< _Tp > & | operator%= (const _Expr< _Dom, _Tp > &)
valarray< _Tp > & | operator%= (const _Tp &)
valarray< _Tp > & | operator%= (const valarray< _Tp > &)
template<class _Dom>
valarray< _Tp > & | operator&= (const _Expr< _Dom, _Tp > &)
valarray< _Tp > & | operator&= (const _Tp &)
valarray< _Tp > & | operator&= (const valarray< _Tp > &)
template<class _Dom>
valarray< _Tp > & | operator*= (const _Expr< _Dom, _Tp > &)
valarray< _Tp > & | operator*= (const _Tp &)
valarray< _Tp > & | operator*= (const valarray< _Tp > &)
_UnaryOp< __unary_plus >::_Rt | operator+ () const
template<class _Dom>
valarray< _Tp > & | operator+= (const _Expr< _Dom, _Tp > &)
valarray< _Tp > & | operator+= (const _Tp &)
valarray< _Tp > & | operator+= (const valarray< _Tp > &)
_UnaryOp< __negate >::_Rt | operator- () const
template<class _Dom>
valarray< _Tp > & | operator-= (const _Expr< _Dom, _Tp > &)
valarray< _Tp > & | operator-= (const _Tp &)
valarray< _Tp > & | operator-= (const valarray< _Tp > &)
template<class _Dom>
valarray< _Tp > & | operator/= (const _Expr< _Dom, _Tp > &)
valarray< _Tp > & | operator/= (const _Tp &)
valarray< _Tp > & | operator/= (const valarray< _Tp > &)
template<class _Dom>
valarray< _Tp > & | operator<<= (const _Expr< _Dom, _Tp > &)
valarray< _Tp > & | operator<<= (const _Tp &)
valarray< _Tp > & | operator<<= (const valarray< _Tp > &)
template<class _Dom>
valarray< _Tp > & | operator= (const _Expr< _Dom, _Tp > &)
valarray< _Tp > & | operator= (const _Tp &__t)
valarray< _Tp > & | operator= (const gslice_array< _Tp > &__ga)
valarray< _Tp > & | operator= (const indirect_array< _Tp > &__ia)
valarray< _Tp > & | operator= (const mask_array< _Tp > &__ma)
valarray< _Tp > & | operator= (const slice_array< _Tp > &__sa)
valarray< _Tp > & | operator= (const valarray< _Tp > &__v)
valarray & | operator= (initializer_list< _Tp > __l)
valarray< _Tp > & | operator= (valarray< _Tp > &&__v) noexcept
template<class _Dom>
valarray< _Tp > & | operator>>= (const _Expr< _Dom, _Tp > &)
valarray< _Tp > & | operator>>= (const _Tp &)
valarray< _Tp > & | operator>>= (const valarray< _Tp > &)
gslice_array< _Tp > | operator[] (const gslice &__s)
_Expr< _GClos< _ValArray, _Tp >, _Tp > | operator[] (const gslice &__s) const
mask_array< _Tp > | operator[] (const valarray< bool > &__m)
valarray< _Tp > | operator[] (const valarray< bool > &__m) const
indirect_array< _Tp > | operator[] (const valarray< size_t > &__i)
_Expr< _IClos< _ValArray, _Tp >, _Tp > | operator[] (const valarray< size_t > &__i) const
_Tp & | operator[] (size_t __i) noexcept
const _Tp & | operator[] (size_t) const noexcept
slice_array< _Tp > | operator[] (slice __s)
_Expr< _SClos< _ValArray, _Tp >, _Tp > | operator[] (slice __s) const
template<class _Dom>
valarray< _Tp > & | operator^= (const _Expr< _Dom, _Tp > &)
valarray< _Tp > & | operator^= (const _Tp &)
valarray< _Tp > & | operator^= (const valarray< _Tp > &)
template<class _Dom>
valarray< _Tp > & | operator|= (const _Expr< _Dom, _Tp > &)
valarray< _Tp > & | operator|= (const _Tp &)
valarray< _Tp > & | operator|= (const valarray< _Tp > &)
_UnaryOp< __bitwise_not >::_Rt | operator~ () const
void | resize (size_t __size, _Tp __c=_Tp())
valarray< _Tp > | shift (int __n) const
size_t | size () const
_Tp | sum () const
void | swap (valarray< _Tp > &__v) noexcept

## Friends
struct | _Array< _Tp >

## Detailed Description

template<class _Tp>
class std::valarray< _Tp >

Smart array designed to support numeric processing.

A valarray is an array that provides constraints intended to allow for effective optimization of numeric array processing by reducing the aliasing that can result from pointer representations. It represents a one-dimensional array from which different multidimensional subsets can be accessed and modified.

Template Parameters

  _Tp | Type of object in the array.

Definition at line 136 of file valarray.

## Member Typedef Documentation

## ◆ const_iterator

template<class _Tp>

typedef const _Tp* std::valarray< _Tp >::const_iterator

Definition at line 148 of file valarray.

## ◆ iterator

template<class _Tp>

typedef _Tp* std::valarray< _Tp >::iterator

Definition at line 147 of file valarray.

## ◆ value_type

template<class _Tp>

typedef _Tp std::valarray< _Tp >::value_type

Definition at line 145 of file valarray.

## Constructor & Destructor Documentation

## ◆ valarray()

template<class _Tp>

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

Construct an array initialized to the first n elements of t.

References valarray().

## Member Function Documentation

## ◆ begin() [1/2]

template<class _Tp>

const_iterator std::valarray< _Tp >::begin | ( |  | ) | const
| inlinenodiscardnoexcept

Definition at line 595 of file valarray.

## ◆ begin() [2/2]

template<class _Tp>

iterator std::valarray< _Tp >::begin | ( |  | ) |
| inlinenodiscardnoexcept

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

Definition at line 590 of file valarray.

## ◆ end() [1/2]

template<class _Tp>

const_iterator std::valarray< _Tp >::end | ( |  | ) | const
| inlinenodiscardnoexcept

Definition at line 609 of file valarray.

## ◆ end() [2/2]

template<class _Tp>

iterator std::valarray< _Tp >::end | ( |  | ) |
| inlinenodiscardnoexcept

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

Definition at line 604 of file valarray.

## ◆ operator!()

template<class _Tp>

_UnaryOp< __logical_not >::_Rt std::valarray< _Tp >::operator! | ( |  | ) | const

Return a new valarray by applying unary ! to each element.

## ◆ operator%=() [1/2]

template<class _Tp>

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

Set each element e of array to e % t.

References valarray().

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

template<class _Tp>

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

Modulo elements of array by corresponding elements of v.

References valarray().

## ◆ operator&=() [1/2]

template<class _Tp>

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

Set each element e of array to e & t.

References valarray().

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

template<class _Tp>

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

Logical and corresponding elements of v with elements of array.

References valarray().

## ◆ operator*=() [1/2]

template<class _Tp>

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

Multiply each element of array by t.

References valarray().

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

template<class _Tp>

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

Multiply elements of array by corresponding elements of v.

References valarray().

## ◆ operator+()

template<class _Tp>

_UnaryOp< __unary_plus >::_Rt std::valarray< _Tp >::operator+ | ( |  | ) | const

Return a new valarray by applying unary + to each element.

## ◆ operator+=() [1/2]

template<class _Tp>

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

Add t to each element of array.

References valarray().

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

template<class _Tp>

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

Add corresponding elements of v to elements of array.

References valarray().

## ◆ operator-()

template<class _Tp>

_UnaryOp< __negate >::_Rt std::valarray< _Tp >::operator- | ( |  | ) | const

Return a new valarray by applying unary - to each element.

## ◆ operator-=() [1/2]

template<class _Tp>

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

Subtract t to each element of array.

References valarray().

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

template<class _Tp>

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

Subtract corresponding elements of v from elements of array.

References valarray().

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

template<class _Tp>

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

Divide each element of array by t.

References valarray().

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

template<class _Tp>

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

Divide elements of array by corresponding elements of v.

References valarray().

## ◆ operator<<=() [1/2]

template<class _Tp>

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

Left shift each element e of array by t bits.

References valarray().

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

template<class _Tp>

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

Left shift elements of array by corresponding elements of v.

## ◆ operator>>=() [1/2]

template<class _Tp>

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

Right shift each element e of array by t bits.

References valarray().

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

template<class _Tp>

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

Right shift elements of array by corresponding elements of v.

References valarray().

## ◆ operator^=() [1/2]

template<class _Tp>

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

Set each element e of array to e ^ t.

References valarray().

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

template<class _Tp>

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

Logical xor corresponding elements of v with elements of array.

References valarray().

## ◆ operator|=() [1/2]

template<class _Tp>

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

Set each element e of array to e | t.

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

template<class _Tp>

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

Logical or corresponding elements of v with elements of array.

References valarray().

## ◆ operator~()

template<class _Tp>

_UnaryOp< __bitwise_not >::_Rt std::valarray< _Tp >::operator~ | ( |  | ) | const

Return a new valarray by applying unary ~ to each element.

## Friends And Related Symbol Documentation

## ◆ _Array< _Tp >

template<class _Tp>

friend struct _Array< _Tp >
| friend

Definition at line 615 of file valarray.

The documentation for this class was generated from the following file:

- valarray