Standard C++ Library Reference ISO/IEC (VERSION3)
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 mask_array(); // not defined
void mask_array(
const mask_array&); // not defined
gslice_array& operator=(
const mask_array&); // not defined
};
The class describes an object that stores a reference to an object va of class valarray<Ty>, along with an
object ba of class valarray<bool> which describes the sequence of elements to select from the
valarray<Ty> object.
You construct a mask_array<Ty> object only by writing an expression of the form va[ba]. The
member functions of class mask_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 at most ba.size() elements. An element J is included only if ba[J] is true.
Thus, there are as many elements in the sequence as there are true elements in ba. If I is the index of the
lowest true element in ba, then va[I] is element zero in the selected sequence. For example:
const bool vb[] = {false, false, true, true, false, true};
// va[valarray<bool>(vb, 56] selects elements with
// indices 2, 3, 5
operator!=
template<class Ty>
valarray<bool> operator!=(const valarray<Ty>& left,
const valarray<Ty>& right);
template<class Ty>
valarray<bool> operator!=(const valarray<Ty> left,
const Ty& right);
template<class Ty>
valarray<bool> operator!=(const Ty& left,
const valarray<Ty>& right);
The first template operator returns an object of class valarray<bool>, each of whose elements I is
left[I] != right[I]. The second template operator stores in element I left[I] != right. The
third template operator stores in element I left != right[I].