33#define _SLICE_ARRAY_H 1
35#pragma GCC system_header
37namespace std _GLIBCXX_VISIBILITY(default)
39_GLIBCXX_BEGIN_NAMESPACE_VERSION
72 slice(
size_t __o,
size_t __d,
size_t __s);
81#if __cpp_impl_three_way_comparison >= 201907L
96 : _M_off(0), _M_sz(0), _M_st(0) {}
100 : _M_off(__o), _M_sz(__d), _M_st(__s) {}
127 template<
typename _Tp>
131 typedef _Tp value_type;
170 void operator=(
const _Expr<_Dom, _Tp>&)
const;
172 void operator*=(
const _Expr<_Dom, _Tp>&)
const;
174 void operator/=(
const _Expr<_Dom, _Tp>&)
const;
176 void operator%=(
const _Expr<_Dom, _Tp>&)
const;
178 void operator+=(
const _Expr<_Dom, _Tp>&)
const;
180 void operator-=(
const _Expr<_Dom, _Tp>&)
const;
182 void operator^=(
const _Expr<_Dom, _Tp>&)
const;
184 void operator&=(
const _Expr<_Dom, _Tp>&)
const;
186 void operator|=(
const _Expr<_Dom, _Tp>&)
const;
197 const size_t _M_stride;
198 const _Array<_Tp> _M_array;
200#if __cplusplus < 201103L
209 template<
typename _Tp>
212 : _M_sz(__s.
size()), _M_stride(__s.stride()),
213 _M_array(__a.
begin() + __s.start()) {}
215 template<
typename _Tp>
218 : _M_sz(__a._M_sz), _M_stride(__a._M_stride), _M_array(__a._M_array) {}
223 template<
typename _Tp>
227 std::__valarray_copy(__a._M_array, __a._M_sz, __a._M_stride,
228 _M_array, _M_stride);
232 template<
typename _Tp>
235 { std::__valarray_fill(_M_array, _M_sz, _M_stride, __t); }
237 template<
typename _Tp>
240 { std::__valarray_copy(_Array<_Tp>(__v), _M_array, _M_sz, _M_stride); }
242 template<
typename _Tp>
246 { std::__valarray_copy(__e, _M_sz, _M_array, _M_stride); }
249#undef _DEFINE_VALARRAY_OPERATOR
250#define _DEFINE_VALARRAY_OPERATOR(_Op,_Name) \
251 template<typename _Tp> \
253 slice_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const \
255 _Array_augmented_##_Name(_M_array, _M_sz, _M_stride, _Array<_Tp>(__v));\
258 template<typename _Tp> \
259 template<class _Dom> \
261 slice_array<_Tp>::operator _Op##=(const _Expr<_Dom,_Tp>& __e) const\
263 _Array_augmented_##_Name(_M_array, _M_stride, __e, _M_sz); \
267_DEFINE_VALARRAY_OPERATOR(*, __multiplies)
268_DEFINE_VALARRAY_OPERATOR(/, __divides)
269_DEFINE_VALARRAY_OPERATOR(%, __modulus)
270_DEFINE_VALARRAY_OPERATOR(+, __plus)
271_DEFINE_VALARRAY_OPERATOR(-, __minus)
272_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor)
273_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and)
274_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or)
275_DEFINE_VALARRAY_OPERATOR(<<, __shift_left)
276_DEFINE_VALARRAY_OPERATOR(>>, __shift_right)
278#undef _DEFINE_VALARRAY_OPERATOR
283_GLIBCXX_END_NAMESPACE_VERSION
size_t size() const
Return size of slice.
slice_array & operator=(const slice_array &)
Assignment operator. Assigns slice elements to corresponding elements of a.
slice()
Construct an empty slice.
size_t stride() const
Return array stride of slice.
size_t start() const
Return array offset of first slice element.
_Tp * begin(valarray< _Tp > &__va) noexcept
Return an iterator pointing to the first element of the valarray.
ISO C++ entities toplevel namespace is std.
constexpr auto size(const _Container &__cont) noexcept(noexcept(__cont.size())) -> decltype(__cont.size())
Return the size of a container.
Smart array designed to support numeric processing.
Reference to one-dimensional subset of an array.
void operator|=(const valarray< _Tp > &) const
Logical or slice elements with corresponding elements of v.
void operator<<=(const valarray< _Tp > &) const
Left shift slice elements by 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
Multiply 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
Logical and 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
Divide slice elements by corresponding elements of v.
Class defining one-dimensional subset of an array.
friend bool operator==(const slice &, const slice &)=default
Equality comparison.