33 #define _MASK_ARRAY_H 1 35 #pragma GCC system_header 37 namespace std _GLIBCXX_VISIBILITY(default)
39 _GLIBCXX_BEGIN_NAMESPACE_VERSION
65 typedef _Tp value_type;
77 void operator=(
const valarray<_Tp>&)
const;
95 void operator<<=(const valarray<_Tp>&)
const;
104 void operator=(
const _Expr<_Dom,_Tp>&)
const;
106 void operator*=(
const _Expr<_Dom,_Tp>&)
const;
108 void operator/=(
const _Expr<_Dom,_Tp>&)
const;
110 void operator%=(
const _Expr<_Dom,_Tp>&)
const;
112 void operator+=(
const _Expr<_Dom,_Tp>&)
const;
114 void operator-=(
const _Expr<_Dom,_Tp>&)
const;
116 void operator^=(
const _Expr<_Dom,_Tp>&)
const;
118 void operator&=(
const _Expr<_Dom,_Tp>&)
const;
120 void operator|=(
const _Expr<_Dom,_Tp>&)
const;
122 void operator<<=(const _Expr<_Dom,_Tp>&)
const;
127 mask_array(_Array<_Tp>,
size_t, _Array<bool>);
128 friend class valarray<_Tp>;
131 const _Array<bool> _M_mask;
132 const _Array<_Tp> _M_array;
138 template<
typename _Tp>
140 : _M_sz(__a._M_sz), _M_mask(__a._M_mask), _M_array(__a._M_array) {}
142 template<
typename _Tp>
145 : _M_sz(__s), _M_mask(__m), _M_array(__a) {}
147 template<
typename _Tp>
151 std::__valarray_copy(__a._M_array, __a._M_mask,
152 _M_sz, _M_array, _M_mask);
156 template<
typename _Tp>
159 { std::__valarray_fill(_M_array, _M_sz, _M_mask, __t); }
161 template<
typename _Tp>
164 { std::__valarray_copy(_Array<_Tp>(__v), __v.
size(), _M_array, _M_mask); }
166 template<
typename _Tp>
170 { std::__valarray_copy(__e, __e.size(), _M_array, _M_mask); }
172 #undef _DEFINE_VALARRAY_OPERATOR 173 #define _DEFINE_VALARRAY_OPERATOR(_Op, _Name) \ 174 template<typename _Tp> \ 176 mask_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const \ 178 _Array_augmented_##_Name(_M_array, _M_mask, \ 179 _Array<_Tp>(__v), __v.size()); \ 182 template<typename _Tp> \ 183 template<class _Dom> \ 185 mask_array<_Tp>::operator _Op##=(const _Expr<_Dom, _Tp>& __e) const\ 187 _Array_augmented_##_Name(_M_array, _M_mask, __e, __e.size()); \ 190 _DEFINE_VALARRAY_OPERATOR(*, __multiplies)
191 _DEFINE_VALARRAY_OPERATOR(/, __divides)
192 _DEFINE_VALARRAY_OPERATOR(%, __modulus)
193 _DEFINE_VALARRAY_OPERATOR(+, __plus)
194 _DEFINE_VALARRAY_OPERATOR(-, __minus)
195 _DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor)
196 _DEFINE_VALARRAY_OPERATOR(&, __bitwise_and)
197 _DEFINE_VALARRAY_OPERATOR(|, __bitwise_or)
198 _DEFINE_VALARRAY_OPERATOR(<<, __shift_left)
199 _DEFINE_VALARRAY_OPERATOR(>>, __shift_right)
201 #undef _DEFINE_VALARRAY_OPERATOR 205 _GLIBCXX_END_NAMESPACE_VERSION
mask_array(const mask_array &)
Copy constructor. Both slices refer to the same underlying array.
void operator^=(const valarray< _Tp > &) const
Logical xor slice elements with corresponding elements of v.
mask_array & operator=(const mask_array &)
Assignment operator. Assigns elements to corresponding elements of a.
void operator*=(const valarray< _Tp > &) const
Multiply slice elements by corresponding elements of v.
ISO C++ entities toplevel namespace is std.
void operator/=(const valarray< _Tp > &) const
Divide slice elements by corresponding elements of v.
void operator|=(const valarray< _Tp > &) const
Logical or slice elements with corresponding elements of v.
void operator%=(const valarray< _Tp > &) const
Modulo slice elements by corresponding elements of v.
void operator+=(const valarray< _Tp > &) const
Add corresponding elements of v to slice elements.
Smart array designed to support numeric processing.
void operator&=(const valarray< _Tp > &) const
Logical and slice elements with corresponding elements of v.
size_t size() const
Return the number of elements in array.
void operator>>=(const valarray< _Tp > &) const
Right shift slice elements by corresponding elements of v.
void operator-=(const valarray< _Tp > &) const
Subtract corresponding elements of v from slice elements.
Reference to selected subset of an array.