32 #ifndef _GSLICE_ARRAY_H
33 #define _GSLICE_ARRAY_H 1
35 #pragma GCC system_header
37 namespace std _GLIBCXX_VISIBILITY(default)
39 _GLIBCXX_BEGIN_NAMESPACE_VERSION
59 template<
typename _Tp>
63 typedef _Tp value_type;
101 void operator=(
const _Expr<_Dom, _Tp>&)
const;
103 void operator*=(
const _Expr<_Dom, _Tp>&)
const;
105 void operator/=(
const _Expr<_Dom, _Tp>&)
const;
107 void operator%=(
const _Expr<_Dom, _Tp>&)
const;
109 void operator+=(
const _Expr<_Dom, _Tp>&)
const;
111 void operator-=(
const _Expr<_Dom, _Tp>&)
const;
113 void operator^=(
const _Expr<_Dom, _Tp>&)
const;
115 void operator&=(
const _Expr<_Dom, _Tp>&)
const;
117 void operator|=(
const _Expr<_Dom, _Tp>&)
const;
124 _Array<_Tp> _M_array;
131 #if __cplusplus < 201103L
140 template<
typename _Tp>
144 : _M_array(__a), _M_index(__i) {}
146 template<
typename _Tp>
149 : _M_array(__a._M_array), _M_index(__a._M_index) {}
151 template<
typename _Tp>
155 std::__valarray_copy(_Array<_Tp>(__a._M_array),
156 _Array<size_t>(__a._M_index), _M_index.size(),
157 _M_array, _Array<size_t>(_M_index));
161 template<
typename _Tp>
165 std::__valarray_fill(_M_array, _Array<size_t>(_M_index),
166 _M_index.size(), __t);
169 template<
typename _Tp>
173 std::__valarray_copy(_Array<_Tp>(__v), __v.
size(),
174 _M_array, _Array<size_t>(_M_index));
177 template<
typename _Tp>
182 std::__valarray_copy (__e, _M_index.size(), _M_array,
183 _Array<size_t>(_M_index));
186 #undef _DEFINE_VALARRAY_OPERATOR
187 #define _DEFINE_VALARRAY_OPERATOR(_Op, _Name) \
188 template<typename _Tp> \
190 gslice_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const \
192 _Array_augmented_##_Name(_M_array, _Array<size_t>(_M_index), \
193 _Array<_Tp>(__v), __v.size()); \
196 template<typename _Tp> \
197 template<class _Dom> \
199 gslice_array<_Tp>::operator _Op##= (const _Expr<_Dom, _Tp>& __e) const\
201 _Array_augmented_##_Name(_M_array, _Array<size_t>(_M_index), __e,\
205 _DEFINE_VALARRAY_OPERATOR(*, __multiplies)
206 _DEFINE_VALARRAY_OPERATOR(/, __divides)
207 _DEFINE_VALARRAY_OPERATOR(%, __modulus)
208 _DEFINE_VALARRAY_OPERATOR(+, __plus)
209 _DEFINE_VALARRAY_OPERATOR(-, __minus)
210 _DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor)
211 _DEFINE_VALARRAY_OPERATOR(&, __bitwise_and)
212 _DEFINE_VALARRAY_OPERATOR(|, __bitwise_or)
213 _DEFINE_VALARRAY_OPERATOR(<<, __shift_left)
214 _DEFINE_VALARRAY_OPERATOR(>>, __shift_right)
216 #undef _DEFINE_VALARRAY_OPERATOR
220 _GLIBCXX_END_NAMESPACE_VERSION
void operator<<=(const valarray< _Tp > &) const
Left shift slice elements by corresponding elements of v.
size_t size() const
Return the number of elements in array.
void operator/=(const valarray< _Tp > &) const
Divide slice elements by corresponding elements of v.
void operator%=(const valarray< _Tp > &) const
Modulo slice elements by corresponding elements of v.
void operator>>=(const valarray< _Tp > &) const
Right shift slice elements by corresponding elements of v.
void operator*=(const valarray< _Tp > &) const
Multiply 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
Logical xor slice elements with corresponding elements of v.
void operator-=(const valarray< _Tp > &) const
Subtract corresponding elements of v from slice elements.
void operator+=(const valarray< _Tp > &) const
Add corresponding elements of v to slice elements.
void operator&=(const valarray< _Tp > &) const
Logical and slice elements with corresponding elements of v.
gslice_array & operator=(const gslice_array &)
Assignment operator. Assigns slice elements to corresponding elements of a.
ISO C++ entities toplevel namespace is std.
Smart array designed to support numeric processing.
Reference to multi-dimensional subset of an array.