32#ifndef _GSLICE_ARRAY_H
33#define _GSLICE_ARRAY_H 1
36#pragma GCC system_header
39namespace std _GLIBCXX_VISIBILITY(default)
41_GLIBCXX_BEGIN_NAMESPACE_VERSION
61 template<
typename _Tp>
65 typedef _Tp value_type;
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;
119 void operator|=(
const _Expr<_Dom, _Tp>&)
const;
126 _Array<_Tp> _M_array;
133#if __cplusplus < 201103L
142 template<
typename _Tp>
146 : _M_array(__a), _M_index(__i) {}
148 template<
typename _Tp>
151 : _M_array(__a._M_array), _M_index(__a._M_index) {}
153 template<
typename _Tp>
157 std::__valarray_copy(_Array<_Tp>(__a._M_array),
158 _Array<size_t>(__a._M_index), _M_index.size(),
159 _M_array, _Array<size_t>(_M_index));
163 template<
typename _Tp>
167 std::__valarray_fill(_M_array, _Array<size_t>(_M_index),
168 _M_index.size(), __t);
171 template<
typename _Tp>
175 std::__valarray_copy(_Array<_Tp>(__v), __v.
size(),
176 _M_array, _Array<size_t>(_M_index));
179 template<
typename _Tp>
184 std::__valarray_copy (__e, _M_index.size(), _M_array,
185 _Array<size_t>(_M_index));
189#undef _DEFINE_VALARRAY_OPERATOR
190#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name) \
191 template<typename _Tp> \
193 gslice_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const \
195 _Array_augmented_##_Name(_M_array, _Array<size_t>(_M_index), \
196 _Array<_Tp>(__v), __v.size()); \
199 template<typename _Tp> \
200 template<class _Dom> \
202 gslice_array<_Tp>::operator _Op##= (const _Expr<_Dom, _Tp>& __e) const\
204 _Array_augmented_##_Name(_M_array, _Array<size_t>(_M_index), __e,\
208_DEFINE_VALARRAY_OPERATOR(*, __multiplies)
209_DEFINE_VALARRAY_OPERATOR(/, __divides)
210_DEFINE_VALARRAY_OPERATOR(%, __modulus)
211_DEFINE_VALARRAY_OPERATOR(+, __plus)
212_DEFINE_VALARRAY_OPERATOR(-, __minus)
213_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor)
214_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and)
215_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or)
216_DEFINE_VALARRAY_OPERATOR(<<, __shift_left)
217_DEFINE_VALARRAY_OPERATOR(>>, __shift_right)
219#undef _DEFINE_VALARRAY_OPERATOR
224_GLIBCXX_END_NAMESPACE_VERSION
size_t size() const
Return the number of elements in array.
gslice_array(const gslice_array &)
Copy constructor. Both slices refer to the same underlying array.
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.
void operator<<=(const valarray< _Tp > &) const
Left shift slice elements by corresponding elements of v.
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.