Compartir a través de


slice Class

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

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

Remarks

The class stores the parameters that characterize an object of type slice_array The subset of a valarray is indirectly constructed when an object of class slice 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 in the valarray.

  • A total length, or number of elements in the slice.

  • A stride, or distance between subsequent indices of elements in the valarray.

If the set defined by a slice is the subset of a constant valarray, then the slice is a new valarray. If the set defined by a slice is the subset of a nonconstant valarray, then the slice 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 slices are distinct and all indices are valid.

Requirements

Header: <valarray>

Namespace: std

See Also

Concepts

slice Members

<valarray> Members

Thread Safety in the Standard C++ Library