Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library Reference Guide


Library:  Numerics

Does not inherit

Local Index



A numeric array class used to represent a generalized slice from an array


#include <valarray>

namespace std {
 class gslice;


gslice represents a generalized slice from an array. A generalized slice contains a starting index, a set of lengths, and a set of strides. The number of lengths and strides must be equal. Together the lengths and strides allow a slice from a multiple dimension array (with the dimension equal to the number of strides) to be represented on a one-dimensional valarray. The gslice maps a set of n indices (ij), where n is equal to the number of strides, to a single index k.

When applied to a valarray using the gslice subscript operator (see valarray), a gslice produces a gslice_array. The gslice_array class creates a view into the original valarray that is tailored to match parameters of the gslice. The elements in a gslice_array are references to the elements in the original array.



gslice(size_t start, const valarray<size_t>& length,
       const valarray<size_t>& stride);
gslice(const gslice&)


size_t start() const;
valarray<size_t> size() const;
valarray<size_t> stride() const;


See Also

valarray, slice_array, slice, gslice_array, mask_array, indirect_array

Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 26.3.6

Previous fileTop of DocumentContentsIndex pageNext file