Partager via


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 vectors out of the multidimensional array.

For a list of all members of this type, see gslice Members.

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.

Requirements

Header: <valarray>

Namespace: std

See Also

Concepts

gslice Members

<valarray> Members

Thread Safety in the Standard C++ Library