Files
2025-10-25 03:02:53 +03:00

3.8 KiB

[template.mask.array]

29 Numerics library [numerics]

29.6 Numeric arrays [numarray]

29.6.8 Class template mask_array [template.mask.array]

29.6.8.1 Overview [template.mask.array.overview]

🔗

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

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

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

1

#

This template is a helper template used by the mask subscript operator:

🔗

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

2

#

It has reference semantics to a subset of an array specified by a boolean mask.

Thus, the expression a[mask] = b; has the effect of assigning the elements ofb to the masked elements in a (those for which the corresponding element inmask is true).

29.6.8.2 Assignment [mask.array.assign]

🔗

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

1

#

These assignment operators have reference semantics, assigning the values of the argument array elements to selected elements of thevalarray object to which the mask_array object refers.

29.6.8.3 Compound assignment [mask.array.comp.assign]

🔗

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

#

These compound assignments have reference semantics, applying the indicated operation to the elements of the argument array and selected elements of thevalarray object to which the mask_array object refers.

29.6.8.4 Fill function [mask.array.fill]

🔗

void operator=(const T&) const;

1

#

This function has reference semantics, assigning the value of its argument to the elements of thevalarray object to which themask_array object refers.