gslice Class

A utility class to valarray that is used to define multidimensional subsets of a valarray. If a valarray is regarded as a multidimensional matrix with all elements in an array, then the slice extracts a vector out of the multidimensional array.

Remarks

The class stores the parameters that characterize an object of type gslice_array. The subset of a valarray is indirectly constructed when an object of class gslice appears as an argument for an object of class valarray<Type>. The stored values that specify the subset selected from the parent valarray include:

  • A starting index.

  • A length vector of class valarray<size_t>.

  • A stride vector of class valarray<size_t>.

The two vectors must have the same length.

If the set defined by a gslice is the subset of a constant valarray, then the gslice is a new valarray. If the set defined by a gslice is the subset of a nonconstant valarray, then the gslice has reference semantics to the original valarray. The evaluation mechanism for nonconstant valarrays saves time and memory.

Operations on valarrays are guaranteed only if the source and destination subsets defined by the gslices are distinct and all indices are valid.

Constructors

gslice

Defines a subset of a valarray that consists of multiple slices of the valarray that all start at a specified element.

Member Functions

size

Finds the array values specifying the numbers of elements in a general slice of a valarray.

start

Finds the starting index of a general slice of a valarray.

stride

Finds the distance between elements in a general slice of a valarray.

Requirements

Header: <valarray>

Namespace: std

See Also

Reference

Thread Safety in the Standard C++ Library

Other Resources

gslice Members

<valarray> Members