Standard C++ Library Reference ISO/IEC (VERSION3)

gslice_array& operator=(
const gslice_array&); // not defined
};
The class describes an object that stores a reference to an object va of class valarray<Ty>, along with an
object gs of class gslice which describes the sequence of elements to select from the valarray<Ty>
object.
You construct a gslice_array<Ty> object only by writing an expression of the form va[gs]. The
member functions of class gslice_array then behave like the corresponding function signatures defined
for valarray<Ty>, except that only the sequence of selected elements is affected.
The sequence is determined as follows. For a length vector gs.size() of length N, construct the index
vector valarray<size_t> idx(0, N). This designates the initial element of the sequence, whose
index K within va is given by the mapping:
K = gs.start();
for (size_t I = 0; I < N; ++I)
K += idx[I] * gs.stride()[I];
The successor to an index vector value is given by:
for (size_t I = N; 0 < I--; )
if (++idx[I] < gs.size()[I])
break;
else
idx[I] = 0;
For example:
const size_t lv[] = {2, 3};
const size_t dv[] = {7, 2};
const valarray<size_t> len(lv, 2), str(dv, 2);
// va[gslice(3, len, str)] selects elements with
// indices 3, 5, 7, 10, 12, 14
indirect_array
template<class Ty>
class indirect_array {
public:
typedef Ty value_type;
void operator=(const valarray<Ty> right) const;
void operator=(const Ty& right) const;
void operator*=(const valarray<Ty> right) const;
void operator/=(const valarray<Ty> right) const;
void operator%=(const valarray<Ty> right) const;
void operator+=(const valarray<Ty> right) const;
void operator-=(const valarray<Ty> right) const;
void operator^=(const valarray<Ty> right) const;
void operator&=(const valarray<Ty> right) const;
void operator|=(const valarray<Ty> right) const;
void operator<<=(const valarray<Ty> right) const;
void operator>>=(const valarray<Ty> right) const;