Standard C++ Library Reference ISO/IEC (VERSION3)
slice::stride
size_t stride() const;
The member function returns the stored stride.
slice_array
template<class Ty>
class slice_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;
private:
void slice_array(); // not defined
void slice_array(
const slice_array&); // not defined
slice_array& operator=(
const slice_array&); // not defined
};
The class describes an object that stores a reference to an object va of class valarray<Ty>, along with an
object sl of class slice which describes the sequence of elements to select from the valarray<Ty>
object.
You construct a slice_array<Ty> object only by writing an expression of the form va[sl]. The
member functions of class slice_array then behave like the corresponding function signatures defined
for valarray<Ty>, except that only the sequence of selected elements is affected.
The sequence consists of sl.size() elements, where element I becomes the index sl.start() + I
* sl.stride() within va. For example:
// va[slice(2, 5, 3)] selects elements with
// indices 2, 5, 8, 11, 14
sqrt
template<class Ty>
valarray<Ty> sqrt(const valarray<Ty>& left);