std::valarray::shift

valarray<T> shift( int count ) const; Returns a new valarray of the same size with elements whose positions are shifted by count elements. The new position of each element is i−count where i is the previous position. The value of shifted in elements is T(). Parameters count - number of positions to shift the elements by Return value The resulting valarray with shifted elements. Notes The function can be implemented with the return type different from std::valarray

std::valarray::resize

void resize( std::size_t count, T value = T() ); Resizes the valarray to contain count elements and assigns value to each element. This functions invalidates all pointers and references to elements in the array. Parameters count - new size of the container value - the value to initialize the new elements with Return value (none). Example #include <valarray> #include <iostream> int main() { std::valarray<int> v{1,2,3}; v.resize(10);

std::valarray::operator[]

(1) T operator[]( std::size_t pos ) const; (until C++11) const T& operator[]( std::size_t pos ) const; (since C++11) T& operator[]( std::size_t pos ); (2) std::valarray<T> operator[]( std::slice slicearr ) const; (3) std::slice_array<T> operator[]( std::slice slicearr ); (4) std::valarray<T> operator[]( const std::gslice& gslicearr ) const; (5) std::gslice_arr

std::valarray::operators

valarray<T> operator+=( const valarray<T>& v ); valarray<T> operator-=( const valarray<T>& v ); valarray<T> operator*=( const valarray<T>& v ); valarray<T> operator/=( const valarray<T>& v ); valarray<T> operator%=( const valarray<T>& v ); valarray<T> operator&=( const valarray<T>& v ); valarray<T> operator|=( const valarray<T>& v ); valarray<T> operator^=( const valarray&l

std::valarray::operators

valarray<T> operator+() const; (1) valarray<T> operator-() const; (2) valarray<T> operator~() const; (3) valarray<bool> operator!() const; (4) Applies unary operators to each element in the numeric array. Parameters (none). Return value A numeric array containing elements with values obtained by applying corresponding operator to the values in *this. Exceptions (none). Notes Each of the operators can only be instantiated if the follo

std::valarray::min

T min() const; Computes the minimum value of the elements. If there are no elements, the behavior is undefined. The function can be used only if operator< is defined for type T. Parameters (none). Return value The minimum of the elements. Example See also max returns the largest element (public member function)

std::valarray::max

T max() const; Computes the maximum value of the elements. If there are no elements, the behavior is undefined. The function can be used only if operator< is defined for type T. Parameters (none). Return value The maximum of the elements. Example See also min returns the smallest element (public member function)

std::valarray::cshift

valarray<T> cshift( int count ) const; Returns a new valarray of the same size with elements whose positions are shifted circularly by count elements. The new position of each element is (i−count) mod s where i is the previous position and s is size(). Parameters count - number of positions to shift the elements by Return value The resulting valarray with circularly shifted elements. Notes The function can be implemented with the return type different from std::va

std::valarray::apply

valarray<T> apply( T func(T) ) const; valarray<T> apply( T func(const T&) ) const; Returns a new valarray of the same size with values which are acquired by applying function func to the previous values of the elements. Parameters func - function to apply to the values Return value The resulting valarray with values acquired by applying function func. Notes The function can be implemented with the return type different from std::valarray. In this c

std::valarray

Defined in header <valarray> template< class T > class valarray; std::valarray is the class for representing and manipulating arrays of values. It supports element-wise mathematical operations and various forms of generalized subscript operators, slicing and indirect access. Notes std::valarray and helper classes are defined to be free of certain forms of aliasing, thus allowing operations on these classes to be optimized similar to the effect of the keyword restri