cpp/numeric/valarray/gslice

is the selector class that identifies a subset of std indices defined by a multi-level set of strides and sizes. Objects of type can be used as indices with valarray's  to select, for example, columns of a multidimensional array represented as a.

Given the starting value $s$, a list of strides $i j$ and a list of sizes $d j$, a constructed from these values selects the set of indices $k j=s+Σ j(i jd j)$.

For example, a gslice with starting index, strides and lengths  generates the following set of  indices:

It is possible to construct objects that select some indices more than once: if the above example used the strides, the indices would have been. Such gslices may only be used as arguments to the const version of, otherwise the behavior is undefined.

Member functions
{{member|{{small|std::gslice::}}gslice| {{dcl begin}} {{dcl|num=1| gslice }} {{dcl|num=2| gslice( std::size_t start, const std::valarray& sizes,                          const std::valarray& strides ); }} {{dcl|num=3| gslice( const gslice& other ); }} {{dcl end}}

Constructs a new generic slice.

@1@ Default constructor. Equivalent to {{c|gslice(0, std::valarray, std::valarray)}}. This constructor exists only to allow construction of arrays of slices.

@2@ Constructs a new slice with parameters {{c|start}}, {{c|sizes}}, {{c|strides}}.

@3@ Constructs a copy of {{c|other}}.

Parameters
}}

{{member|{{small|std::slice::}}start, size, stride| {{dcl begin}} {{dcl|num=1| std::size_t start const; }} {{dcl|num=2| std::valarray size const; }} {{dcl|num=3| std::valarray stride const; }} {{dcl end}}

Returns the parameters passed to the slice on construction - start, sizes and strides respectively.

Parameters
(none)

Return value
The parameters of the slice -- start, sizes and strides respectively.

Complexity
Constant. }}