[template.gslice.array]

# 29 Numerics library [[numerics]](./#numerics)

## 29.6 Numeric arrays [[numarray]](numarray#template.gslice.array)

### 29.6.7 Class template gslice_array [template.gslice.array]

#### [29.6.7.1](#overview) Overview [[template.gslice.array.overview]](template.gslice.array.overview)

[ð](#lib:gslice_array)

namespace std {template<class T> class gslice_array {public:using value_type = T; void operator= (const valarray<T>&) const; void operator*= (const valarray<T>&) const; void operator/= (const valarray<T>&) const; void operator%= (const valarray<T>&) const; void operator+= (const valarray<T>&) const; void operator-= (const valarray<T>&) const; void operator^= (const valarray<T>&) const; void operator&= (const valarray<T>&) const; void operator|= (const valarray<T>&) const; void operator<<=(const valarray<T>&) const; void operator>>=(const valarray<T>&) const;

 gslice_array(const gslice_array&); ~gslice_array(); const gslice_array& operator=(const gslice_array&) const; void operator=(const T&) const;

 gslice_array() = delete; // as implied by declaring copy constructor above};}

[1](#overview-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L8786)

This template is a helper template used by thegslice subscript operator

[ð](#lib:gslice_array_)

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

[2](#overview-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L8796)

It has reference semantics to a subset of an array specified by agslice object[.](#overview-2.sentence-1)

Thus, the expressiona[gslice(1, length, stride)] = b has the effect of assigning the elements ofb to a
generalized slice of the elements ina[.](#overview-2.sentence-2)

#### [29.6.7.2](#gslice.array.assign) Assignment [[gslice.array.assign]](gslice.array.assign)

[ð](#lib:operator=,gslice_array)

`void operator=(const valarray<T>&) const;
const gslice_array& operator=(const gslice_array&) const;
`

[1](#gslice.array.assign-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L8817)

These assignment operators have reference semantics, assigning the values
of the argument array elements to selected elements of thevalarray<T> object to which thegslice_array refers[.](#gslice.array.assign-1.sentence-1)

#### [29.6.7.3](#gslice.array.comp.assign) Compound assignment [[gslice.array.comp.assign]](gslice.array.comp.assign)

[ð](#lib:operator*=,gslice_array)

`void operator*= (const valarray<T>&) const;
void operator/= (const valarray<T>&) const;
void operator%= (const valarray<T>&) const;
void operator+= (const valarray<T>&) const;
void operator-= (const valarray<T>&) const;
void operator^= (const valarray<T>&) const;
void operator&= (const valarray<T>&) const;
void operator|= (const valarray<T>&) const;
void operator<<=(const valarray<T>&) const;
void operator>>=(const valarray<T>&) const;
`

[1](#gslice.array.comp.assign-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L8852)

These compound assignments have reference semantics, applying the
indicated operation to the elements of the argument array and selected
elements of thevalarray<T> object to which thegslice_array object refers[.](#gslice.array.comp.assign-1.sentence-1)

#### [29.6.7.4](#gslice.array.fill) Fill function [[gslice.array.fill]](gslice.array.fill)

[ð](#lib:operator=,gslice_array_)

`void operator=(const T&) const;
`

[1](#gslice.array.fill-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L8870)

This function has reference semantics, assigning the value of its argument
to the elements of thevalarray<T> object to which thegslice_array object refers[.](#gslice.array.fill-1.sentence-1)
