operator[]

The index operator is specialized for subset access to allow both read and write operations.

  valarray<T> operator[](slice) const;

  slice_array<T> operator[](slice);

  valarray<T> operator[](const gslice&) const;

  gslice_array<T> operator[](const gslice&);

  valarray<T> operator[](const valarray<bool>&) const;

  mask_array<T> operator[](const valarray<bool>&);

  valarray<T> operator[](const valarray<size_t>&) const;

  indirect_array<T> operator[](const valarray<size_t>&);  
Remarks

These operators return subset of the array. Const-qualified operators return the subset as a new valarray object, and non-const operators return a class template object which has reference semantics to the original array.