2 //===-------------------------- valarray ----------------------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 #ifndef _LIBCPP_VALARRAY
12 #define _LIBCPP_VALARRAY
28 explicit valarray(size_t n);
29 valarray(const value_type& x, size_t n);
30 valarray(const value_type* px, size_t n);
31 valarray(const valarray& v);
32 valarray(valarray&& v) noexcept;
33 valarray(const slice_array<value_type>& sa);
34 valarray(const gslice_array<value_type>& ga);
35 valarray(const mask_array<value_type>& ma);
36 valarray(const indirect_array<value_type>& ia);
37 valarray(initializer_list<value_type> il);
41 valarray& operator=(const valarray& v);
42 valarray& operator=(valarray&& v) noexcept;
43 valarray& operator=(initializer_list<value_type> il);
44 valarray& operator=(const value_type& x);
45 valarray& operator=(const slice_array<value_type>& sa);
46 valarray& operator=(const gslice_array<value_type>& ga);
47 valarray& operator=(const mask_array<value_type>& ma);
48 valarray& operator=(const indirect_array<value_type>& ia);
51 const value_type& operator[](size_t i) const;
52 value_type& operator[](size_t i);
55 valarray operator[](slice s) const;
56 slice_array<value_type> operator[](slice s);
57 valarray operator[](const gslice& gs) const;
58 gslice_array<value_type> operator[](const gslice& gs);
59 valarray operator[](const valarray<bool>& vb) const;
60 mask_array<value_type> operator[](const valarray<bool>& vb);
61 valarray operator[](const valarray<size_t>& vs) const;
62 indirect_array<value_type> operator[](const valarray<size_t>& vs);
65 valarray operator+() const;
66 valarray operator-() const;
67 valarray operator~() const;
68 valarray<bool> operator!() const;
70 // computed assignment:
71 valarray& operator*= (const value_type& x);
72 valarray& operator/= (const value_type& x);
73 valarray& operator%= (const value_type& x);
74 valarray& operator+= (const value_type& x);
75 valarray& operator-= (const value_type& x);
76 valarray& operator^= (const value_type& x);
77 valarray& operator&= (const value_type& x);
78 valarray& operator|= (const value_type& x);
79 valarray& operator<<=(const value_type& x);
80 valarray& operator>>=(const value_type& x);
82 valarray& operator*= (const valarray& v);
83 valarray& operator/= (const valarray& v);
84 valarray& operator%= (const valarray& v);
85 valarray& operator+= (const valarray& v);
86 valarray& operator-= (const valarray& v);
87 valarray& operator^= (const valarray& v);
88 valarray& operator|= (const valarray& v);
89 valarray& operator&= (const valarray& v);
90 valarray& operator<<=(const valarray& v);
91 valarray& operator>>=(const valarray& v);
94 void swap(valarray& v) noexcept;
98 value_type sum() const;
99 value_type min() const;
100 value_type max() const;
102 valarray shift (int i) const;
103 valarray cshift(int i) const;
104 valarray apply(value_type f(value_type)) const;
105 valarray apply(value_type f(const value_type&)) const;
106 void resize(size_t n, value_type x = value_type());
113 slice(size_t start, size_t size, size_t stride);
115 size_t start() const;
117 size_t stride() const;
124 typedef T value_type;
126 const slice_array& operator=(const slice_array& sa) const;
127 void operator= (const valarray<value_type>& v) const;
128 void operator*= (const valarray<value_type>& v) const;
129 void operator/= (const valarray<value_type>& v) const;
130 void operator%= (const valarray<value_type>& v) const;
131 void operator+= (const valarray<value_type>& v) const;
132 void operator-= (const valarray<value_type>& v) const;
133 void operator^= (const valarray<value_type>& v) const;
134 void operator&= (const valarray<value_type>& v) const;
135 void operator|= (const valarray<value_type>& v) const;
136 void operator<<=(const valarray<value_type>& v) const;
137 void operator>>=(const valarray<value_type>& v) const;
139 void operator=(const value_type& x) const;
141 slice_array() = delete;
148 gslice(size_t start, const valarray<size_t>& size,
149 const valarray<size_t>& stride);
151 size_t start() const;
152 valarray<size_t> size() const;
153 valarray<size_t> stride() const;
160 typedef T value_type;
162 void operator= (const valarray<value_type>& v) const;
163 void operator*= (const valarray<value_type>& v) const;
164 void operator/= (const valarray<value_type>& v) const;
165 void operator%= (const valarray<value_type>& v) const;
166 void operator+= (const valarray<value_type>& v) const;
167 void operator-= (const valarray<value_type>& v) const;
168 void operator^= (const valarray<value_type>& v) const;
169 void operator&= (const valarray<value_type>& v) const;
170 void operator|= (const valarray<value_type>& v) const;
171 void operator<<=(const valarray<value_type>& v) const;
172 void operator>>=(const valarray<value_type>& v) const;
174 gslice_array(const gslice_array& ga);
176 const gslice_array& operator=(const gslice_array& ga) const;
177 void operator=(const value_type& x) const;
179 gslice_array() = delete;
186 typedef T value_type;
188 void operator= (const valarray<value_type>& v) const;
189 void operator*= (const valarray<value_type>& v) const;
190 void operator/= (const valarray<value_type>& v) const;
191 void operator%= (const valarray<value_type>& v) const;
192 void operator+= (const valarray<value_type>& v) const;
193 void operator-= (const valarray<value_type>& v) const;
194 void operator^= (const valarray<value_type>& v) const;
195 void operator&= (const valarray<value_type>& v) const;
196 void operator|= (const valarray<value_type>& v) const;
197 void operator<<=(const valarray<value_type>& v) const;
198 void operator>>=(const valarray<value_type>& v) const;
200 mask_array(const mask_array& ma);
202 const mask_array& operator=(const mask_array& ma) const;
203 void operator=(const value_type& x) const;
205 mask_array() = delete;
212 typedef T value_type;
214 void operator= (const valarray<value_type>& v) const;
215 void operator*= (const valarray<value_type>& v) const;
216 void operator/= (const valarray<value_type>& v) const;
217 void operator%= (const valarray<value_type>& v) const;
218 void operator+= (const valarray<value_type>& v) const;
219 void operator-= (const valarray<value_type>& v) const;
220 void operator^= (const valarray<value_type>& v) const;
221 void operator&= (const valarray<value_type>& v) const;
222 void operator|= (const valarray<value_type>& v) const;
223 void operator<<=(const valarray<value_type>& v) const;
224 void operator>>=(const valarray<value_type>& v) const;
226 indirect_array(const indirect_array& ia);
228 const indirect_array& operator=(const indirect_array& ia) const;
229 void operator=(const value_type& x) const;
231 indirect_array() = delete;
234 template<class T> void swap(valarray<T>& x, valarray<T>& y) noexcept;
236 template<class T> valarray<T> operator* (const valarray<T>& x, const valarray<T>& y);
237 template<class T> valarray<T> operator* (const valarray<T>& x, const T& y);
238 template<class T> valarray<T> operator* (const T& x, const valarray<T>& y);
240 template<class T> valarray<T> operator/ (const valarray<T>& x, const valarray<T>& y);
241 template<class T> valarray<T> operator/ (const valarray<T>& x, const T& y);
242 template<class T> valarray<T> operator/ (const T& x, const valarray<T>& y);
244 template<class T> valarray<T> operator% (const valarray<T>& x, const valarray<T>& y);
245 template<class T> valarray<T> operator% (const valarray<T>& x, const T& y);
246 template<class T> valarray<T> operator% (const T& x, const valarray<T>& y);
248 template<class T> valarray<T> operator+ (const valarray<T>& x, const valarray<T>& y);
249 template<class T> valarray<T> operator+ (const valarray<T>& x, const T& y);
250 template<class T> valarray<T> operator+ (const T& x, const valarray<T>& y);
252 template<class T> valarray<T> operator- (const valarray<T>& x, const valarray<T>& y);
253 template<class T> valarray<T> operator- (const valarray<T>& x, const T& y);
254 template<class T> valarray<T> operator- (const T& x, const valarray<T>& y);
256 template<class T> valarray<T> operator^ (const valarray<T>& x, const valarray<T>& y);
257 template<class T> valarray<T> operator^ (const valarray<T>& x, const T& y);
258 template<class T> valarray<T> operator^ (const T& x, const valarray<T>& y);
260 template<class T> valarray<T> operator& (const valarray<T>& x, const valarray<T>& y);
261 template<class T> valarray<T> operator& (const valarray<T>& x, const T& y);
262 template<class T> valarray<T> operator& (const T& x, const valarray<T>& y);
264 template<class T> valarray<T> operator| (const valarray<T>& x, const valarray<T>& y);
265 template<class T> valarray<T> operator| (const valarray<T>& x, const T& y);
266 template<class T> valarray<T> operator| (const T& x, const valarray<T>& y);
268 template<class T> valarray<T> operator<<(const valarray<T>& x, const valarray<T>& y);
269 template<class T> valarray<T> operator<<(const valarray<T>& x, const T& y);
270 template<class T> valarray<T> operator<<(const T& x, const valarray<T>& y);
272 template<class T> valarray<T> operator>>(const valarray<T>& x, const valarray<T>& y);
273 template<class T> valarray<T> operator>>(const valarray<T>& x, const T& y);
274 template<class T> valarray<T> operator>>(const T& x, const valarray<T>& y);
276 template<class T> valarray<bool> operator&&(const valarray<T>& x, const valarray<T>& y);
277 template<class T> valarray<bool> operator&&(const valarray<T>& x, const T& y);
278 template<class T> valarray<bool> operator&&(const T& x, const valarray<T>& y);
280 template<class T> valarray<bool> operator||(const valarray<T>& x, const valarray<T>& y);
281 template<class T> valarray<bool> operator||(const valarray<T>& x, const T& y);
282 template<class T> valarray<bool> operator||(const T& x, const valarray<T>& y);
284 template<class T> valarray<bool> operator==(const valarray<T>& x, const valarray<T>& y);
285 template<class T> valarray<bool> operator==(const valarray<T>& x, const T& y);
286 template<class T> valarray<bool> operator==(const T& x, const valarray<T>& y);
288 template<class T> valarray<bool> operator!=(const valarray<T>& x, const valarray<T>& y);
289 template<class T> valarray<bool> operator!=(const valarray<T>& x, const T& y);
290 template<class T> valarray<bool> operator!=(const T& x, const valarray<T>& y);
292 template<class T> valarray<bool> operator< (const valarray<T>& x, const valarray<T>& y);
293 template<class T> valarray<bool> operator< (const valarray<T>& x, const T& y);
294 template<class T> valarray<bool> operator< (const T& x, const valarray<T>& y);
296 template<class T> valarray<bool> operator> (const valarray<T>& x, const valarray<T>& y);
297 template<class T> valarray<bool> operator> (const valarray<T>& x, const T& y);
298 template<class T> valarray<bool> operator> (const T& x, const valarray<T>& y);
300 template<class T> valarray<bool> operator<=(const valarray<T>& x, const valarray<T>& y);
301 template<class T> valarray<bool> operator<=(const valarray<T>& x, const T& y);
302 template<class T> valarray<bool> operator<=(const T& x, const valarray<T>& y);
304 template<class T> valarray<bool> operator>=(const valarray<T>& x, const valarray<T>& y);
305 template<class T> valarray<bool> operator>=(const valarray<T>& x, const T& y);
306 template<class T> valarray<bool> operator>=(const T& x, const valarray<T>& y);
308 template<class T> valarray<T> abs (const valarray<T>& x);
309 template<class T> valarray<T> acos (const valarray<T>& x);
310 template<class T> valarray<T> asin (const valarray<T>& x);
311 template<class T> valarray<T> atan (const valarray<T>& x);
313 template<class T> valarray<T> atan2(const valarray<T>& x, const valarray<T>& y);
314 template<class T> valarray<T> atan2(const valarray<T>& x, const T& y);
315 template<class T> valarray<T> atan2(const T& x, const valarray<T>& y);
317 template<class T> valarray<T> cos (const valarray<T>& x);
318 template<class T> valarray<T> cosh (const valarray<T>& x);
319 template<class T> valarray<T> exp (const valarray<T>& x);
320 template<class T> valarray<T> log (const valarray<T>& x);
321 template<class T> valarray<T> log10(const valarray<T>& x);
323 template<class T> valarray<T> pow(const valarray<T>& x, const valarray<T>& y);
324 template<class T> valarray<T> pow(const valarray<T>& x, const T& y);
325 template<class T> valarray<T> pow(const T& x, const valarray<T>& y);
327 template<class T> valarray<T> sin (const valarray<T>& x);
328 template<class T> valarray<T> sinh (const valarray<T>& x);
329 template<class T> valarray<T> sqrt (const valarray<T>& x);
330 template<class T> valarray<T> tan (const valarray<T>& x);
331 template<class T> valarray<T> tanh (const valarray<T>& x);
333 template <class T> unspecified1 begin(valarray<T>& v);
334 template <class T> unspecified2 begin(const valarray<T>& v);
335 template <class T> unspecified1 end(valarray<T>& v);
336 template <class T> unspecified2 end(const valarray<T>& v);
345 #include <initializer_list>
347 #include <functional>
350 #include <__undef_min_max>
351 #include <__undef___deallocate>
353 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
354 #pragma GCC system_header
357 _LIBCPP_BEGIN_NAMESPACE_STD
359 template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY valarray;
361 class _LIBCPP_TYPE_VIS_ONLY slice
367 _LIBCPP_INLINE_VISIBILITY
374 _LIBCPP_INLINE_VISIBILITY
375 slice(size_t __start, size_t __size, size_t __stride)
381 _LIBCPP_INLINE_VISIBILITY size_t start() const {return __start_;}
382 _LIBCPP_INLINE_VISIBILITY size_t size() const {return __size_;}
383 _LIBCPP_INLINE_VISIBILITY size_t stride() const {return __stride_;}
386 template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY slice_array;
387 class _LIBCPP_TYPE_VIS gslice;
388 template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY gslice_array;
389 template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY mask_array;
390 template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY indirect_array;
393 _LIBCPP_INLINE_VISIBILITY
395 begin(valarray<_Tp>& __v);
398 _LIBCPP_INLINE_VISIBILITY
400 begin(const valarray<_Tp>& __v);
403 _LIBCPP_INLINE_VISIBILITY
405 end(valarray<_Tp>& __v);
408 _LIBCPP_INLINE_VISIBILITY
410 end(const valarray<_Tp>& __v);
412 template <class _Op, class _A0>
415 typedef typename _Op::result_type result_type;
416 typedef typename _A0::value_type value_type;
421 _LIBCPP_INLINE_VISIBILITY
422 _UnaryOp(const _Op& __op, const _A0& __a0) : __op_(__op), __a0_(__a0) {}
424 _LIBCPP_INLINE_VISIBILITY
425 result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
427 _LIBCPP_INLINE_VISIBILITY
428 size_t size() const {return __a0_.size();}
431 template <class _Op, class _A0, class _A1>
434 typedef typename _Op::result_type result_type;
435 typedef typename _A0::value_type value_type;
441 _LIBCPP_INLINE_VISIBILITY
442 _BinaryOp(const _Op& __op, const _A0& __a0, const _A1& __a1)
443 : __op_(__op), __a0_(__a0), __a1_(__a1) {}
445 _LIBCPP_INLINE_VISIBILITY
446 value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
448 _LIBCPP_INLINE_VISIBILITY
449 size_t size() const {return __a0_.size();}
456 typedef _Tp value_type;
457 typedef const _Tp& result_type;
459 const value_type& __t_;
462 _LIBCPP_INLINE_VISIBILITY
463 explicit __scalar_expr(const value_type& __t, size_t __s) : __t_(__t), __s_(__s) {}
465 _LIBCPP_INLINE_VISIBILITY
466 result_type operator[](size_t) const {return __t_;}
468 _LIBCPP_INLINE_VISIBILITY
469 size_t size() const {return __s_;}
473 struct __unary_plus : unary_function<_Tp, _Tp>
475 _LIBCPP_INLINE_VISIBILITY
476 _Tp operator()(const _Tp& __x) const
481 struct __bit_not : unary_function<_Tp, _Tp>
483 _LIBCPP_INLINE_VISIBILITY
484 _Tp operator()(const _Tp& __x) const
489 struct __bit_shift_left : binary_function<_Tp, _Tp, _Tp>
491 _LIBCPP_INLINE_VISIBILITY
492 _Tp operator()(const _Tp& __x, const _Tp& __y) const
497 struct __bit_shift_right : binary_function<_Tp, _Tp, _Tp>
499 _LIBCPP_INLINE_VISIBILITY
500 _Tp operator()(const _Tp& __x, const _Tp& __y) const
504 template <class _Tp, class _Fp>
505 struct __apply_expr : unary_function<_Tp, _Tp>
510 _LIBCPP_INLINE_VISIBILITY
511 explicit __apply_expr(_Fp __f) : __f_(__f) {}
513 _LIBCPP_INLINE_VISIBILITY
514 _Tp operator()(const _Tp& __x) const
519 struct __abs_expr : unary_function<_Tp, _Tp>
521 _LIBCPP_INLINE_VISIBILITY
522 _Tp operator()(const _Tp& __x) const
527 struct __acos_expr : unary_function<_Tp, _Tp>
529 _LIBCPP_INLINE_VISIBILITY
530 _Tp operator()(const _Tp& __x) const
535 struct __asin_expr : unary_function<_Tp, _Tp>
537 _LIBCPP_INLINE_VISIBILITY
538 _Tp operator()(const _Tp& __x) const
543 struct __atan_expr : unary_function<_Tp, _Tp>
545 _LIBCPP_INLINE_VISIBILITY
546 _Tp operator()(const _Tp& __x) const
551 struct __atan2_expr : binary_function<_Tp, _Tp, _Tp>
553 _LIBCPP_INLINE_VISIBILITY
554 _Tp operator()(const _Tp& __x, const _Tp& __y) const
555 {return atan2(__x, __y);}
559 struct __cos_expr : unary_function<_Tp, _Tp>
561 _LIBCPP_INLINE_VISIBILITY
562 _Tp operator()(const _Tp& __x) const
567 struct __cosh_expr : unary_function<_Tp, _Tp>
569 _LIBCPP_INLINE_VISIBILITY
570 _Tp operator()(const _Tp& __x) const
575 struct __exp_expr : unary_function<_Tp, _Tp>
577 _LIBCPP_INLINE_VISIBILITY
578 _Tp operator()(const _Tp& __x) const
583 struct __log_expr : unary_function<_Tp, _Tp>
585 _LIBCPP_INLINE_VISIBILITY
586 _Tp operator()(const _Tp& __x) const
591 struct __log10_expr : unary_function<_Tp, _Tp>
593 _LIBCPP_INLINE_VISIBILITY
594 _Tp operator()(const _Tp& __x) const
599 struct __pow_expr : binary_function<_Tp, _Tp, _Tp>
601 _LIBCPP_INLINE_VISIBILITY
602 _Tp operator()(const _Tp& __x, const _Tp& __y) const
603 {return pow(__x, __y);}
607 struct __sin_expr : unary_function<_Tp, _Tp>
609 _LIBCPP_INLINE_VISIBILITY
610 _Tp operator()(const _Tp& __x) const
615 struct __sinh_expr : unary_function<_Tp, _Tp>
617 _LIBCPP_INLINE_VISIBILITY
618 _Tp operator()(const _Tp& __x) const
623 struct __sqrt_expr : unary_function<_Tp, _Tp>
625 _LIBCPP_INLINE_VISIBILITY
626 _Tp operator()(const _Tp& __x) const
631 struct __tan_expr : unary_function<_Tp, _Tp>
633 _LIBCPP_INLINE_VISIBILITY
634 _Tp operator()(const _Tp& __x) const
639 struct __tanh_expr : unary_function<_Tp, _Tp>
641 _LIBCPP_INLINE_VISIBILITY
642 _Tp operator()(const _Tp& __x) const
646 template <class _ValExpr>
649 typedef typename remove_reference<_ValExpr>::type _RmExpr;
651 typedef typename _RmExpr::value_type value_type;
652 typedef value_type result_type;
660 _LIBCPP_INLINE_VISIBILITY
661 __slice_expr(const slice& __sl, const _RmExpr& __e)
663 __start_(__sl.start()),
664 __size_(__sl.size()),
665 __stride_(__sl.stride())
669 _LIBCPP_INLINE_VISIBILITY
670 result_type operator[](size_t __i) const
671 {return __expr_[__start_ + __i * __stride_];}
673 _LIBCPP_INLINE_VISIBILITY
674 size_t size() const {return __size_;}
676 template <class> friend class _LIBCPP_TYPE_VIS_ONLY valarray;
679 template <class _ValExpr>
682 template <class _ValExpr>
683 class __indirect_expr;
685 template <class _ValExpr>
688 typedef typename remove_reference<_ValExpr>::type _RmExpr;
690 typedef typename _RmExpr::value_type value_type;
691 typedef value_type result_type;
699 static const ptrdiff_t _Np = static_cast<ptrdiff_t>(
700 sizeof(ptrdiff_t) * __CHAR_BIT__ - 1);
702 _LIBCPP_INLINE_VISIBILITY
703 __shift_expr(int __n, const _RmExpr& __e)
708 ptrdiff_t __neg_n = static_cast<ptrdiff_t>(__n_ >> _Np);
709 __sn_ = __neg_n | static_cast<ptrdiff_t>(static_cast<size_t>(-__n_) >> _Np);
710 __ul_ = ((__size_ - __n_) & ~__neg_n) | ((__n_ + 1) & __neg_n);
714 _LIBCPP_INLINE_VISIBILITY
715 result_type operator[](size_t __j) const
717 ptrdiff_t __i = static_cast<ptrdiff_t>(__j);
718 ptrdiff_t __m = (__sn_ * __i - __ul_) >> _Np;
719 return (__expr_[(__i + __n_) & __m] & __m) | (value_type() & ~__m);
722 _LIBCPP_INLINE_VISIBILITY
723 size_t size() const {return __size_;}
725 template <class> friend class __val_expr;
728 template <class _ValExpr>
731 typedef typename remove_reference<_ValExpr>::type _RmExpr;
733 typedef typename _RmExpr::value_type value_type;
734 typedef value_type result_type;
743 _LIBCPP_INLINE_VISIBILITY
744 __cshift_expr(int __n, const _RmExpr& __e)
748 __n %= static_cast<int>(__size_);
751 __m_ = __size_ - __n;
753 __o2_ = __n - __size_;
758 __o1_ = __n + __size_;
764 _LIBCPP_INLINE_VISIBILITY
765 result_type operator[](size_t __i) const
768 return __expr_[__i + __o1_];
769 return __expr_[__i + __o2_];
772 _LIBCPP_INLINE_VISIBILITY
773 size_t size() const {return __size_;}
775 template <class> friend class __val_expr;
778 template<class _ValExpr>
781 template<class _ValExpr>
782 struct __is_val_expr : false_type {};
784 template<class _ValExpr>
785 struct __is_val_expr<__val_expr<_ValExpr> > : true_type {};
788 struct __is_val_expr<valarray<_Tp> > : true_type {};
791 class _LIBCPP_TYPE_VIS_ONLY valarray
794 typedef _Tp value_type;
795 typedef _Tp result_type;
798 value_type* __begin_;
802 // construct/destroy:
803 _LIBCPP_INLINE_VISIBILITY
804 valarray() : __begin_(0), __end_(0) {}
805 explicit valarray(size_t __n);
806 valarray(const value_type& __x, size_t __n);
807 valarray(const value_type* __p, size_t __n);
808 valarray(const valarray& __v);
809 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
810 valarray(valarray&& __v) _NOEXCEPT;
811 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
812 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
813 valarray(initializer_list<value_type> __il);
814 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
815 valarray(const slice_array<value_type>& __sa);
816 valarray(const gslice_array<value_type>& __ga);
817 valarray(const mask_array<value_type>& __ma);
818 valarray(const indirect_array<value_type>& __ia);
822 valarray& operator=(const valarray& __v);
823 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
824 valarray& operator=(valarray&& __v) _NOEXCEPT;
825 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
826 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
827 valarray& operator=(initializer_list<value_type>);
828 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
829 valarray& operator=(const value_type& __x);
830 valarray& operator=(const slice_array<value_type>& __sa);
831 valarray& operator=(const gslice_array<value_type>& __ga);
832 valarray& operator=(const mask_array<value_type>& __ma);
833 valarray& operator=(const indirect_array<value_type>& __ia);
834 template <class _ValExpr>
835 valarray& operator=(const __val_expr<_ValExpr>& __v);
838 _LIBCPP_INLINE_VISIBILITY
839 const value_type& operator[](size_t __i) const {return __begin_[__i];}
841 _LIBCPP_INLINE_VISIBILITY
842 value_type& operator[](size_t __i) {return __begin_[__i];}
844 // subset operations:
845 __val_expr<__slice_expr<const valarray&> > operator[](slice __s) const;
846 slice_array<value_type> operator[](slice __s);
847 __val_expr<__indirect_expr<const valarray&> > operator[](const gslice& __gs) const;
848 gslice_array<value_type> operator[](const gslice& __gs);
849 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
850 __val_expr<__indirect_expr<const valarray&> > operator[](gslice&& __gs) const;
851 gslice_array<value_type> operator[](gslice&& __gs);
852 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
853 __val_expr<__mask_expr<const valarray&> > operator[](const valarray<bool>& __vb) const;
854 mask_array<value_type> operator[](const valarray<bool>& __vb);
855 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
856 __val_expr<__mask_expr<const valarray&> > operator[](valarray<bool>&& __vb) const;
857 mask_array<value_type> operator[](valarray<bool>&& __vb);
858 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
859 __val_expr<__indirect_expr<const valarray&> > operator[](const valarray<size_t>& __vs) const;
860 indirect_array<value_type> operator[](const valarray<size_t>& __vs);
861 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
862 __val_expr<__indirect_expr<const valarray&> > operator[](valarray<size_t>&& __vs) const;
863 indirect_array<value_type> operator[](valarray<size_t>&& __vs);
864 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
867 valarray operator+() const;
868 valarray operator-() const;
869 valarray operator~() const;
870 valarray<bool> operator!() const;
872 // computed assignment:
873 valarray& operator*= (const value_type& __x);
874 valarray& operator/= (const value_type& __x);
875 valarray& operator%= (const value_type& __x);
876 valarray& operator+= (const value_type& __x);
877 valarray& operator-= (const value_type& __x);
878 valarray& operator^= (const value_type& __x);
879 valarray& operator&= (const value_type& __x);
880 valarray& operator|= (const value_type& __x);
881 valarray& operator<<=(const value_type& __x);
882 valarray& operator>>=(const value_type& __x);
884 template <class _Expr>
887 __is_val_expr<_Expr>::value,
890 operator*= (const _Expr& __v);
892 template <class _Expr>
895 __is_val_expr<_Expr>::value,
898 operator/= (const _Expr& __v);
900 template <class _Expr>
903 __is_val_expr<_Expr>::value,
906 operator%= (const _Expr& __v);
908 template <class _Expr>
911 __is_val_expr<_Expr>::value,
914 operator+= (const _Expr& __v);
916 template <class _Expr>
919 __is_val_expr<_Expr>::value,
922 operator-= (const _Expr& __v);
924 template <class _Expr>
927 __is_val_expr<_Expr>::value,
930 operator^= (const _Expr& __v);
932 template <class _Expr>
935 __is_val_expr<_Expr>::value,
938 operator|= (const _Expr& __v);
940 template <class _Expr>
943 __is_val_expr<_Expr>::value,
946 operator&= (const _Expr& __v);
948 template <class _Expr>
951 __is_val_expr<_Expr>::value,
954 operator<<= (const _Expr& __v);
956 template <class _Expr>
959 __is_val_expr<_Expr>::value,
962 operator>>= (const _Expr& __v);
965 void swap(valarray& __v) _NOEXCEPT;
967 _LIBCPP_INLINE_VISIBILITY
968 size_t size() const {return static_cast<size_t>(__end_ - __begin_);}
970 value_type sum() const;
971 value_type min() const;
972 value_type max() const;
974 valarray shift (int __i) const;
975 valarray cshift(int __i) const;
976 valarray apply(value_type __f(value_type)) const;
977 valarray apply(value_type __f(const value_type&)) const;
978 void resize(size_t __n, value_type __x = value_type());
981 template <class> friend class _LIBCPP_TYPE_VIS_ONLY valarray;
982 template <class> friend class _LIBCPP_TYPE_VIS_ONLY slice_array;
983 template <class> friend class _LIBCPP_TYPE_VIS_ONLY gslice_array;
984 template <class> friend class _LIBCPP_TYPE_VIS_ONLY mask_array;
985 template <class> friend class __mask_expr;
986 template <class> friend class _LIBCPP_TYPE_VIS_ONLY indirect_array;
987 template <class> friend class __indirect_expr;
988 template <class> friend class __val_expr;
993 begin(valarray<_Up>& __v);
998 begin(const valarray<_Up>& __v);
1000 template <class _Up>
1003 end(valarray<_Up>& __v);
1005 template <class _Up>
1008 end(const valarray<_Up>& __v);
1011 _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::valarray(size_t))
1012 _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::~valarray())
1013 _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void valarray<size_t>::resize(size_t, size_t))
1015 template <class _Op, class _Tp>
1016 struct _UnaryOp<_Op, valarray<_Tp> >
1018 typedef typename _Op::result_type result_type;
1019 typedef _Tp value_type;
1022 const valarray<_Tp>& __a0_;
1024 _LIBCPP_INLINE_VISIBILITY
1025 _UnaryOp(const _Op& __op, const valarray<_Tp>& __a0) : __op_(__op), __a0_(__a0) {}
1027 _LIBCPP_INLINE_VISIBILITY
1028 result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
1030 _LIBCPP_INLINE_VISIBILITY
1031 size_t size() const {return __a0_.size();}
1034 template <class _Op, class _Tp, class _A1>
1035 struct _BinaryOp<_Op, valarray<_Tp>, _A1>
1037 typedef typename _Op::result_type result_type;
1038 typedef _Tp value_type;
1041 const valarray<_Tp>& __a0_;
1044 _LIBCPP_INLINE_VISIBILITY
1045 _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const _A1& __a1)
1046 : __op_(__op), __a0_(__a0), __a1_(__a1) {}
1048 _LIBCPP_INLINE_VISIBILITY
1049 value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
1051 _LIBCPP_INLINE_VISIBILITY
1052 size_t size() const {return __a0_.size();}
1055 template <class _Op, class _A0, class _Tp>
1056 struct _BinaryOp<_Op, _A0, valarray<_Tp> >
1058 typedef typename _Op::result_type result_type;
1059 typedef _Tp value_type;
1063 const valarray<_Tp>& __a1_;
1065 _LIBCPP_INLINE_VISIBILITY
1066 _BinaryOp(const _Op& __op, const _A0& __a0, const valarray<_Tp>& __a1)
1067 : __op_(__op), __a0_(__a0), __a1_(__a1) {}
1069 _LIBCPP_INLINE_VISIBILITY
1070 value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
1072 _LIBCPP_INLINE_VISIBILITY
1073 size_t size() const {return __a0_.size();}
1076 template <class _Op, class _Tp>
1077 struct _BinaryOp<_Op, valarray<_Tp>, valarray<_Tp> >
1079 typedef typename _Op::result_type result_type;
1080 typedef _Tp value_type;
1083 const valarray<_Tp>& __a0_;
1084 const valarray<_Tp>& __a1_;
1086 _LIBCPP_INLINE_VISIBILITY
1087 _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const valarray<_Tp>& __a1)
1088 : __op_(__op), __a0_(__a0), __a1_(__a1) {}
1090 _LIBCPP_INLINE_VISIBILITY
1091 value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
1093 _LIBCPP_INLINE_VISIBILITY
1094 size_t size() const {return __a0_.size();}
1099 template <class _Tp>
1100 class _LIBCPP_TYPE_VIS_ONLY slice_array
1103 typedef _Tp value_type;
1111 template <class _Expr>
1114 __is_val_expr<_Expr>::value,
1117 operator=(const _Expr& __v) const;
1119 template <class _Expr>
1122 __is_val_expr<_Expr>::value,
1125 operator*=(const _Expr& __v) const;
1127 template <class _Expr>
1130 __is_val_expr<_Expr>::value,
1133 operator/=(const _Expr& __v) const;
1135 template <class _Expr>
1138 __is_val_expr<_Expr>::value,
1141 operator%=(const _Expr& __v) const;
1143 template <class _Expr>
1146 __is_val_expr<_Expr>::value,
1149 operator+=(const _Expr& __v) const;
1151 template <class _Expr>
1154 __is_val_expr<_Expr>::value,
1157 operator-=(const _Expr& __v) const;
1159 template <class _Expr>
1162 __is_val_expr<_Expr>::value,
1165 operator^=(const _Expr& __v) const;
1167 template <class _Expr>
1170 __is_val_expr<_Expr>::value,
1173 operator&=(const _Expr& __v) const;
1175 template <class _Expr>
1178 __is_val_expr<_Expr>::value,
1181 operator|=(const _Expr& __v) const;
1183 template <class _Expr>
1186 __is_val_expr<_Expr>::value,
1189 operator<<=(const _Expr& __v) const;
1191 template <class _Expr>
1194 __is_val_expr<_Expr>::value,
1197 operator>>=(const _Expr& __v) const;
1199 const slice_array& operator=(const slice_array& __sa) const;
1201 void operator=(const value_type& __x) const;
1204 _LIBCPP_INLINE_VISIBILITY
1205 slice_array(const slice& __sl, const valarray<value_type>& __v)
1206 : __vp_(const_cast<value_type*>(__v.__begin_ + __sl.start())),
1207 __size_(__sl.size()),
1208 __stride_(__sl.stride())
1211 template <class> friend class valarray;
1212 template <class> friend class sliceExpr;
1215 template <class _Tp>
1216 inline _LIBCPP_INLINE_VISIBILITY
1217 const slice_array<_Tp>&
1218 slice_array<_Tp>::operator=(const slice_array& __sa) const
1220 value_type* __t = __vp_;
1221 const value_type* __s = __sa.__vp_;
1222 for (size_t __n = __size_; __n; --__n, __t += __stride_, __s += __sa.__stride_)
1227 template <class _Tp>
1228 template <class _Expr>
1229 inline _LIBCPP_INLINE_VISIBILITY
1232 __is_val_expr<_Expr>::value,
1235 slice_array<_Tp>::operator=(const _Expr& __v) const
1237 value_type* __t = __vp_;
1238 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1242 template <class _Tp>
1243 template <class _Expr>
1244 inline _LIBCPP_INLINE_VISIBILITY
1247 __is_val_expr<_Expr>::value,
1250 slice_array<_Tp>::operator*=(const _Expr& __v) const
1252 value_type* __t = __vp_;
1253 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1257 template <class _Tp>
1258 template <class _Expr>
1259 inline _LIBCPP_INLINE_VISIBILITY
1262 __is_val_expr<_Expr>::value,
1265 slice_array<_Tp>::operator/=(const _Expr& __v) const
1267 value_type* __t = __vp_;
1268 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1272 template <class _Tp>
1273 template <class _Expr>
1274 inline _LIBCPP_INLINE_VISIBILITY
1277 __is_val_expr<_Expr>::value,
1280 slice_array<_Tp>::operator%=(const _Expr& __v) const
1282 value_type* __t = __vp_;
1283 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1287 template <class _Tp>
1288 template <class _Expr>
1289 inline _LIBCPP_INLINE_VISIBILITY
1292 __is_val_expr<_Expr>::value,
1295 slice_array<_Tp>::operator+=(const _Expr& __v) const
1297 value_type* __t = __vp_;
1298 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1302 template <class _Tp>
1303 template <class _Expr>
1304 inline _LIBCPP_INLINE_VISIBILITY
1307 __is_val_expr<_Expr>::value,
1310 slice_array<_Tp>::operator-=(const _Expr& __v) const
1312 value_type* __t = __vp_;
1313 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1317 template <class _Tp>
1318 template <class _Expr>
1319 inline _LIBCPP_INLINE_VISIBILITY
1322 __is_val_expr<_Expr>::value,
1325 slice_array<_Tp>::operator^=(const _Expr& __v) const
1327 value_type* __t = __vp_;
1328 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1332 template <class _Tp>
1333 template <class _Expr>
1334 inline _LIBCPP_INLINE_VISIBILITY
1337 __is_val_expr<_Expr>::value,
1340 slice_array<_Tp>::operator&=(const _Expr& __v) const
1342 value_type* __t = __vp_;
1343 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1347 template <class _Tp>
1348 template <class _Expr>
1349 inline _LIBCPP_INLINE_VISIBILITY
1352 __is_val_expr<_Expr>::value,
1355 slice_array<_Tp>::operator|=(const _Expr& __v) const
1357 value_type* __t = __vp_;
1358 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1362 template <class _Tp>
1363 template <class _Expr>
1364 inline _LIBCPP_INLINE_VISIBILITY
1367 __is_val_expr<_Expr>::value,
1370 slice_array<_Tp>::operator<<=(const _Expr& __v) const
1372 value_type* __t = __vp_;
1373 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1377 template <class _Tp>
1378 template <class _Expr>
1379 inline _LIBCPP_INLINE_VISIBILITY
1382 __is_val_expr<_Expr>::value,
1385 slice_array<_Tp>::operator>>=(const _Expr& __v) const
1387 value_type* __t = __vp_;
1388 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1392 template <class _Tp>
1393 inline _LIBCPP_INLINE_VISIBILITY
1395 slice_array<_Tp>::operator=(const value_type& __x) const
1397 value_type* __t = __vp_;
1398 for (size_t __n = __size_; __n; --__n, __t += __stride_)
1404 class _LIBCPP_TYPE_VIS gslice
1406 valarray<size_t> __size_;
1407 valarray<size_t> __stride_;
1408 valarray<size_t> __1d_;
1411 _LIBCPP_INLINE_VISIBILITY
1414 _LIBCPP_INLINE_VISIBILITY
1415 gslice(size_t __start, const valarray<size_t>& __size,
1416 const valarray<size_t>& __stride)
1421 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1423 _LIBCPP_INLINE_VISIBILITY
1424 gslice(size_t __start, const valarray<size_t>& __size,
1425 valarray<size_t>&& __stride)
1427 __stride_(move(__stride))
1430 _LIBCPP_INLINE_VISIBILITY
1431 gslice(size_t __start, valarray<size_t>&& __size,
1432 const valarray<size_t>& __stride)
1433 : __size_(move(__size)),
1437 _LIBCPP_INLINE_VISIBILITY
1438 gslice(size_t __start, valarray<size_t>&& __size,
1439 valarray<size_t>&& __stride)
1440 : __size_(move(__size)),
1441 __stride_(move(__stride))
1444 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1446 // gslice(const gslice&) = default;
1447 // gslice(gslice&&) = default;
1448 // gslice& operator=(const gslice&) = default;
1449 // gslice& operator=(gslice&&) = default;
1451 _LIBCPP_INLINE_VISIBILITY
1452 size_t start() const {return __1d_.size() ? __1d_[0] : 0;}
1454 _LIBCPP_INLINE_VISIBILITY
1455 valarray<size_t> size() const {return __size_;}
1457 _LIBCPP_INLINE_VISIBILITY
1458 valarray<size_t> stride() const {return __stride_;}
1461 void __init(size_t __start);
1463 template <class> friend class gslice_array;
1464 template <class> friend class valarray;
1465 template <class> friend class __val_expr;
1470 template <class _Tp>
1471 class _LIBCPP_TYPE_VIS_ONLY gslice_array
1474 typedef _Tp value_type;
1478 valarray<size_t> __1d_;
1481 template <class _Expr>
1484 __is_val_expr<_Expr>::value,
1487 operator=(const _Expr& __v) const;
1489 template <class _Expr>
1492 __is_val_expr<_Expr>::value,
1495 operator*=(const _Expr& __v) const;
1497 template <class _Expr>
1500 __is_val_expr<_Expr>::value,
1503 operator/=(const _Expr& __v) const;
1505 template <class _Expr>
1508 __is_val_expr<_Expr>::value,
1511 operator%=(const _Expr& __v) const;
1513 template <class _Expr>
1516 __is_val_expr<_Expr>::value,
1519 operator+=(const _Expr& __v) const;
1521 template <class _Expr>
1524 __is_val_expr<_Expr>::value,
1527 operator-=(const _Expr& __v) const;
1529 template <class _Expr>
1532 __is_val_expr<_Expr>::value,
1535 operator^=(const _Expr& __v) const;
1537 template <class _Expr>
1540 __is_val_expr<_Expr>::value,
1543 operator&=(const _Expr& __v) const;
1545 template <class _Expr>
1548 __is_val_expr<_Expr>::value,
1551 operator|=(const _Expr& __v) const;
1553 template <class _Expr>
1556 __is_val_expr<_Expr>::value,
1559 operator<<=(const _Expr& __v) const;
1561 template <class _Expr>
1564 __is_val_expr<_Expr>::value,
1567 operator>>=(const _Expr& __v) const;
1569 const gslice_array& operator=(const gslice_array& __ga) const;
1571 void operator=(const value_type& __x) const;
1573 // gslice_array(const gslice_array&) = default;
1574 // gslice_array(gslice_array&&) = default;
1575 // gslice_array& operator=(const gslice_array&) = default;
1576 // gslice_array& operator=(gslice_array&&) = default;
1579 _LIBCPP_INLINE_VISIBILITY
1580 gslice_array(const gslice& __gs, const valarray<value_type>& __v)
1581 : __vp_(const_cast<value_type*>(__v.__begin_)),
1585 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1587 _LIBCPP_INLINE_VISIBILITY
1588 gslice_array(gslice&& __gs, const valarray<value_type>& __v)
1589 : __vp_(const_cast<value_type*>(__v.__begin_)),
1590 __1d_(move(__gs.__1d_))
1593 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1595 template <class> friend class valarray;
1598 template <class _Tp>
1599 template <class _Expr>
1600 inline _LIBCPP_INLINE_VISIBILITY
1603 __is_val_expr<_Expr>::value,
1606 gslice_array<_Tp>::operator=(const _Expr& __v) const
1608 typedef const size_t* _Ip;
1610 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1611 __vp_[*__i] = __v[__j];
1614 template <class _Tp>
1615 template <class _Expr>
1616 inline _LIBCPP_INLINE_VISIBILITY
1619 __is_val_expr<_Expr>::value,
1622 gslice_array<_Tp>::operator*=(const _Expr& __v) const
1624 typedef const size_t* _Ip;
1626 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1627 __vp_[*__i] *= __v[__j];
1630 template <class _Tp>
1631 template <class _Expr>
1632 inline _LIBCPP_INLINE_VISIBILITY
1635 __is_val_expr<_Expr>::value,
1638 gslice_array<_Tp>::operator/=(const _Expr& __v) const
1640 typedef const size_t* _Ip;
1642 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1643 __vp_[*__i] /= __v[__j];
1646 template <class _Tp>
1647 template <class _Expr>
1648 inline _LIBCPP_INLINE_VISIBILITY
1651 __is_val_expr<_Expr>::value,
1654 gslice_array<_Tp>::operator%=(const _Expr& __v) const
1656 typedef const size_t* _Ip;
1658 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1659 __vp_[*__i] %= __v[__j];
1662 template <class _Tp>
1663 template <class _Expr>
1664 inline _LIBCPP_INLINE_VISIBILITY
1667 __is_val_expr<_Expr>::value,
1670 gslice_array<_Tp>::operator+=(const _Expr& __v) const
1672 typedef const size_t* _Ip;
1674 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1675 __vp_[*__i] += __v[__j];
1678 template <class _Tp>
1679 template <class _Expr>
1680 inline _LIBCPP_INLINE_VISIBILITY
1683 __is_val_expr<_Expr>::value,
1686 gslice_array<_Tp>::operator-=(const _Expr& __v) const
1688 typedef const size_t* _Ip;
1690 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1691 __vp_[*__i] -= __v[__j];
1694 template <class _Tp>
1695 template <class _Expr>
1696 inline _LIBCPP_INLINE_VISIBILITY
1699 __is_val_expr<_Expr>::value,
1702 gslice_array<_Tp>::operator^=(const _Expr& __v) const
1704 typedef const size_t* _Ip;
1706 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1707 __vp_[*__i] ^= __v[__j];
1710 template <class _Tp>
1711 template <class _Expr>
1712 inline _LIBCPP_INLINE_VISIBILITY
1715 __is_val_expr<_Expr>::value,
1718 gslice_array<_Tp>::operator&=(const _Expr& __v) const
1720 typedef const size_t* _Ip;
1722 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1723 __vp_[*__i] &= __v[__j];
1726 template <class _Tp>
1727 template <class _Expr>
1728 inline _LIBCPP_INLINE_VISIBILITY
1731 __is_val_expr<_Expr>::value,
1734 gslice_array<_Tp>::operator|=(const _Expr& __v) const
1736 typedef const size_t* _Ip;
1738 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1739 __vp_[*__i] |= __v[__j];
1742 template <class _Tp>
1743 template <class _Expr>
1744 inline _LIBCPP_INLINE_VISIBILITY
1747 __is_val_expr<_Expr>::value,
1750 gslice_array<_Tp>::operator<<=(const _Expr& __v) const
1752 typedef const size_t* _Ip;
1754 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1755 __vp_[*__i] <<= __v[__j];
1758 template <class _Tp>
1759 template <class _Expr>
1760 inline _LIBCPP_INLINE_VISIBILITY
1763 __is_val_expr<_Expr>::value,
1766 gslice_array<_Tp>::operator>>=(const _Expr& __v) const
1768 typedef const size_t* _Ip;
1770 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1771 __vp_[*__i] >>= __v[__j];
1774 template <class _Tp>
1775 inline _LIBCPP_INLINE_VISIBILITY
1776 const gslice_array<_Tp>&
1777 gslice_array<_Tp>::operator=(const gslice_array& __ga) const
1779 typedef const size_t* _Ip;
1780 const value_type* __s = __ga.__vp_;
1781 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ga.__1d_.__begin_;
1782 __i != __e; ++__i, ++__j)
1783 __vp_[*__i] = __s[*__j];
1787 template <class _Tp>
1788 inline _LIBCPP_INLINE_VISIBILITY
1790 gslice_array<_Tp>::operator=(const value_type& __x) const
1792 typedef const size_t* _Ip;
1793 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
1799 template <class _Tp>
1800 class _LIBCPP_TYPE_VIS_ONLY mask_array
1803 typedef _Tp value_type;
1807 valarray<size_t> __1d_;
1810 template <class _Expr>
1813 __is_val_expr<_Expr>::value,
1816 operator=(const _Expr& __v) const;
1818 template <class _Expr>
1821 __is_val_expr<_Expr>::value,
1824 operator*=(const _Expr& __v) const;
1826 template <class _Expr>
1829 __is_val_expr<_Expr>::value,
1832 operator/=(const _Expr& __v) const;
1834 template <class _Expr>
1837 __is_val_expr<_Expr>::value,
1840 operator%=(const _Expr& __v) const;
1842 template <class _Expr>
1845 __is_val_expr<_Expr>::value,
1848 operator+=(const _Expr& __v) const;
1850 template <class _Expr>
1853 __is_val_expr<_Expr>::value,
1856 operator-=(const _Expr& __v) const;
1858 template <class _Expr>
1861 __is_val_expr<_Expr>::value,
1864 operator^=(const _Expr& __v) const;
1866 template <class _Expr>
1869 __is_val_expr<_Expr>::value,
1872 operator&=(const _Expr& __v) const;
1874 template <class _Expr>
1877 __is_val_expr<_Expr>::value,
1880 operator|=(const _Expr& __v) const;
1882 template <class _Expr>
1885 __is_val_expr<_Expr>::value,
1888 operator<<=(const _Expr& __v) const;
1890 template <class _Expr>
1893 __is_val_expr<_Expr>::value,
1896 operator>>=(const _Expr& __v) const;
1898 const mask_array& operator=(const mask_array& __ma) const;
1900 void operator=(const value_type& __x) const;
1902 // mask_array(const mask_array&) = default;
1903 // mask_array(mask_array&&) = default;
1904 // mask_array& operator=(const mask_array&) = default;
1905 // mask_array& operator=(mask_array&&) = default;
1908 _LIBCPP_INLINE_VISIBILITY
1909 mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v)
1910 : __vp_(const_cast<value_type*>(__v.__begin_)),
1911 __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
1914 for (size_t __i = 0; __i < __vb.size(); ++__i)
1919 template <class> friend class valarray;
1922 template <class _Tp>
1923 template <class _Expr>
1924 inline _LIBCPP_INLINE_VISIBILITY
1927 __is_val_expr<_Expr>::value,
1930 mask_array<_Tp>::operator=(const _Expr& __v) const
1932 size_t __n = __1d_.size();
1933 for (size_t __i = 0; __i < __n; ++__i)
1934 __vp_[__1d_[__i]] = __v[__i];
1937 template <class _Tp>
1938 template <class _Expr>
1939 inline _LIBCPP_INLINE_VISIBILITY
1942 __is_val_expr<_Expr>::value,
1945 mask_array<_Tp>::operator*=(const _Expr& __v) const
1947 size_t __n = __1d_.size();
1948 for (size_t __i = 0; __i < __n; ++__i)
1949 __vp_[__1d_[__i]] *= __v[__i];
1952 template <class _Tp>
1953 template <class _Expr>
1954 inline _LIBCPP_INLINE_VISIBILITY
1957 __is_val_expr<_Expr>::value,
1960 mask_array<_Tp>::operator/=(const _Expr& __v) const
1962 size_t __n = __1d_.size();
1963 for (size_t __i = 0; __i < __n; ++__i)
1964 __vp_[__1d_[__i]] /= __v[__i];
1967 template <class _Tp>
1968 template <class _Expr>
1969 inline _LIBCPP_INLINE_VISIBILITY
1972 __is_val_expr<_Expr>::value,
1975 mask_array<_Tp>::operator%=(const _Expr& __v) const
1977 size_t __n = __1d_.size();
1978 for (size_t __i = 0; __i < __n; ++__i)
1979 __vp_[__1d_[__i]] %= __v[__i];
1982 template <class _Tp>
1983 template <class _Expr>
1984 inline _LIBCPP_INLINE_VISIBILITY
1987 __is_val_expr<_Expr>::value,
1990 mask_array<_Tp>::operator+=(const _Expr& __v) const
1992 size_t __n = __1d_.size();
1993 for (size_t __i = 0; __i < __n; ++__i)
1994 __vp_[__1d_[__i]] += __v[__i];
1997 template <class _Tp>
1998 template <class _Expr>
1999 inline _LIBCPP_INLINE_VISIBILITY
2002 __is_val_expr<_Expr>::value,
2005 mask_array<_Tp>::operator-=(const _Expr& __v) const
2007 size_t __n = __1d_.size();
2008 for (size_t __i = 0; __i < __n; ++__i)
2009 __vp_[__1d_[__i]] -= __v[__i];
2012 template <class _Tp>
2013 template <class _Expr>
2014 inline _LIBCPP_INLINE_VISIBILITY
2017 __is_val_expr<_Expr>::value,
2020 mask_array<_Tp>::operator^=(const _Expr& __v) const
2022 size_t __n = __1d_.size();
2023 for (size_t __i = 0; __i < __n; ++__i)
2024 __vp_[__1d_[__i]] ^= __v[__i];
2027 template <class _Tp>
2028 template <class _Expr>
2029 inline _LIBCPP_INLINE_VISIBILITY
2032 __is_val_expr<_Expr>::value,
2035 mask_array<_Tp>::operator&=(const _Expr& __v) const
2037 size_t __n = __1d_.size();
2038 for (size_t __i = 0; __i < __n; ++__i)
2039 __vp_[__1d_[__i]] &= __v[__i];
2042 template <class _Tp>
2043 template <class _Expr>
2044 inline _LIBCPP_INLINE_VISIBILITY
2047 __is_val_expr<_Expr>::value,
2050 mask_array<_Tp>::operator|=(const _Expr& __v) const
2052 size_t __n = __1d_.size();
2053 for (size_t __i = 0; __i < __n; ++__i)
2054 __vp_[__1d_[__i]] |= __v[__i];
2057 template <class _Tp>
2058 template <class _Expr>
2059 inline _LIBCPP_INLINE_VISIBILITY
2062 __is_val_expr<_Expr>::value,
2065 mask_array<_Tp>::operator<<=(const _Expr& __v) const
2067 size_t __n = __1d_.size();
2068 for (size_t __i = 0; __i < __n; ++__i)
2069 __vp_[__1d_[__i]] <<= __v[__i];
2072 template <class _Tp>
2073 template <class _Expr>
2074 inline _LIBCPP_INLINE_VISIBILITY
2077 __is_val_expr<_Expr>::value,
2080 mask_array<_Tp>::operator>>=(const _Expr& __v) const
2082 size_t __n = __1d_.size();
2083 for (size_t __i = 0; __i < __n; ++__i)
2084 __vp_[__1d_[__i]] >>= __v[__i];
2087 template <class _Tp>
2088 inline _LIBCPP_INLINE_VISIBILITY
2089 const mask_array<_Tp>&
2090 mask_array<_Tp>::operator=(const mask_array& __ma) const
2092 size_t __n = __1d_.size();
2093 for (size_t __i = 0; __i < __n; ++__i)
2094 __vp_[__1d_[__i]] = __ma.__vp_[__1d_[__i]];
2098 template <class _Tp>
2099 inline _LIBCPP_INLINE_VISIBILITY
2101 mask_array<_Tp>::operator=(const value_type& __x) const
2103 size_t __n = __1d_.size();
2104 for (size_t __i = 0; __i < __n; ++__i)
2105 __vp_[__1d_[__i]] = __x;
2108 template <class _ValExpr>
2111 typedef typename remove_reference<_ValExpr>::type _RmExpr;
2113 typedef typename _RmExpr::value_type value_type;
2114 typedef value_type result_type;
2118 valarray<size_t> __1d_;
2120 _LIBCPP_INLINE_VISIBILITY
2121 __mask_expr(const valarray<bool>& __vb, const _RmExpr& __e)
2123 __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
2126 for (size_t __i = 0; __i < __vb.size(); ++__i)
2132 _LIBCPP_INLINE_VISIBILITY
2133 result_type operator[](size_t __i) const
2134 {return __expr_[__1d_[__i]];}
2136 _LIBCPP_INLINE_VISIBILITY
2137 size_t size() const {return __1d_.size();}
2139 template <class> friend class valarray;
2144 template <class _Tp>
2145 class _LIBCPP_TYPE_VIS_ONLY indirect_array
2148 typedef _Tp value_type;
2152 valarray<size_t> __1d_;
2155 template <class _Expr>
2158 __is_val_expr<_Expr>::value,
2161 operator=(const _Expr& __v) const;
2163 template <class _Expr>
2166 __is_val_expr<_Expr>::value,
2169 operator*=(const _Expr& __v) const;
2171 template <class _Expr>
2174 __is_val_expr<_Expr>::value,
2177 operator/=(const _Expr& __v) const;
2179 template <class _Expr>
2182 __is_val_expr<_Expr>::value,
2185 operator%=(const _Expr& __v) const;
2187 template <class _Expr>
2190 __is_val_expr<_Expr>::value,
2193 operator+=(const _Expr& __v) const;
2195 template <class _Expr>
2198 __is_val_expr<_Expr>::value,
2201 operator-=(const _Expr& __v) const;
2203 template <class _Expr>
2206 __is_val_expr<_Expr>::value,
2209 operator^=(const _Expr& __v) const;
2211 template <class _Expr>
2214 __is_val_expr<_Expr>::value,
2217 operator&=(const _Expr& __v) const;
2219 template <class _Expr>
2222 __is_val_expr<_Expr>::value,
2225 operator|=(const _Expr& __v) const;
2227 template <class _Expr>
2230 __is_val_expr<_Expr>::value,
2233 operator<<=(const _Expr& __v) const;
2235 template <class _Expr>
2238 __is_val_expr<_Expr>::value,
2241 operator>>=(const _Expr& __v) const;
2243 const indirect_array& operator=(const indirect_array& __ia) const;
2245 void operator=(const value_type& __x) const;
2247 // indirect_array(const indirect_array&) = default;
2248 // indirect_array(indirect_array&&) = default;
2249 // indirect_array& operator=(const indirect_array&) = default;
2250 // indirect_array& operator=(indirect_array&&) = default;
2253 _LIBCPP_INLINE_VISIBILITY
2254 indirect_array(const valarray<size_t>& __ia, const valarray<value_type>& __v)
2255 : __vp_(const_cast<value_type*>(__v.__begin_)),
2259 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2261 _LIBCPP_INLINE_VISIBILITY
2262 indirect_array(valarray<size_t>&& __ia, const valarray<value_type>& __v)
2263 : __vp_(const_cast<value_type*>(__v.__begin_)),
2267 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2269 template <class> friend class valarray;
2272 template <class _Tp>
2273 template <class _Expr>
2274 inline _LIBCPP_INLINE_VISIBILITY
2277 __is_val_expr<_Expr>::value,
2280 indirect_array<_Tp>::operator=(const _Expr& __v) const
2282 size_t __n = __1d_.size();
2283 for (size_t __i = 0; __i < __n; ++__i)
2284 __vp_[__1d_[__i]] = __v[__i];
2287 template <class _Tp>
2288 template <class _Expr>
2289 inline _LIBCPP_INLINE_VISIBILITY
2292 __is_val_expr<_Expr>::value,
2295 indirect_array<_Tp>::operator*=(const _Expr& __v) const
2297 size_t __n = __1d_.size();
2298 for (size_t __i = 0; __i < __n; ++__i)
2299 __vp_[__1d_[__i]] *= __v[__i];
2302 template <class _Tp>
2303 template <class _Expr>
2304 inline _LIBCPP_INLINE_VISIBILITY
2307 __is_val_expr<_Expr>::value,
2310 indirect_array<_Tp>::operator/=(const _Expr& __v) const
2312 size_t __n = __1d_.size();
2313 for (size_t __i = 0; __i < __n; ++__i)
2314 __vp_[__1d_[__i]] /= __v[__i];
2317 template <class _Tp>
2318 template <class _Expr>
2319 inline _LIBCPP_INLINE_VISIBILITY
2322 __is_val_expr<_Expr>::value,
2325 indirect_array<_Tp>::operator%=(const _Expr& __v) const
2327 size_t __n = __1d_.size();
2328 for (size_t __i = 0; __i < __n; ++__i)
2329 __vp_[__1d_[__i]] %= __v[__i];
2332 template <class _Tp>
2333 template <class _Expr>
2334 inline _LIBCPP_INLINE_VISIBILITY
2337 __is_val_expr<_Expr>::value,
2340 indirect_array<_Tp>::operator+=(const _Expr& __v) const
2342 size_t __n = __1d_.size();
2343 for (size_t __i = 0; __i < __n; ++__i)
2344 __vp_[__1d_[__i]] += __v[__i];
2347 template <class _Tp>
2348 template <class _Expr>
2349 inline _LIBCPP_INLINE_VISIBILITY
2352 __is_val_expr<_Expr>::value,
2355 indirect_array<_Tp>::operator-=(const _Expr& __v) const
2357 size_t __n = __1d_.size();
2358 for (size_t __i = 0; __i < __n; ++__i)
2359 __vp_[__1d_[__i]] -= __v[__i];
2362 template <class _Tp>
2363 template <class _Expr>
2364 inline _LIBCPP_INLINE_VISIBILITY
2367 __is_val_expr<_Expr>::value,
2370 indirect_array<_Tp>::operator^=(const _Expr& __v) const
2372 size_t __n = __1d_.size();
2373 for (size_t __i = 0; __i < __n; ++__i)
2374 __vp_[__1d_[__i]] ^= __v[__i];
2377 template <class _Tp>
2378 template <class _Expr>
2379 inline _LIBCPP_INLINE_VISIBILITY
2382 __is_val_expr<_Expr>::value,
2385 indirect_array<_Tp>::operator&=(const _Expr& __v) const
2387 size_t __n = __1d_.size();
2388 for (size_t __i = 0; __i < __n; ++__i)
2389 __vp_[__1d_[__i]] &= __v[__i];
2392 template <class _Tp>
2393 template <class _Expr>
2394 inline _LIBCPP_INLINE_VISIBILITY
2397 __is_val_expr<_Expr>::value,
2400 indirect_array<_Tp>::operator|=(const _Expr& __v) const
2402 size_t __n = __1d_.size();
2403 for (size_t __i = 0; __i < __n; ++__i)
2404 __vp_[__1d_[__i]] |= __v[__i];
2407 template <class _Tp>
2408 template <class _Expr>
2409 inline _LIBCPP_INLINE_VISIBILITY
2412 __is_val_expr<_Expr>::value,
2415 indirect_array<_Tp>::operator<<=(const _Expr& __v) const
2417 size_t __n = __1d_.size();
2418 for (size_t __i = 0; __i < __n; ++__i)
2419 __vp_[__1d_[__i]] <<= __v[__i];
2422 template <class _Tp>
2423 template <class _Expr>
2424 inline _LIBCPP_INLINE_VISIBILITY
2427 __is_val_expr<_Expr>::value,
2430 indirect_array<_Tp>::operator>>=(const _Expr& __v) const
2432 size_t __n = __1d_.size();
2433 for (size_t __i = 0; __i < __n; ++__i)
2434 __vp_[__1d_[__i]] >>= __v[__i];
2437 template <class _Tp>
2438 inline _LIBCPP_INLINE_VISIBILITY
2439 const indirect_array<_Tp>&
2440 indirect_array<_Tp>::operator=(const indirect_array& __ia) const
2442 typedef const size_t* _Ip;
2443 const value_type* __s = __ia.__vp_;
2444 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ia.__1d_.__begin_;
2445 __i != __e; ++__i, ++__j)
2446 __vp_[*__i] = __s[*__j];
2450 template <class _Tp>
2451 inline _LIBCPP_INLINE_VISIBILITY
2453 indirect_array<_Tp>::operator=(const value_type& __x) const
2455 typedef const size_t* _Ip;
2456 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
2460 template <class _ValExpr>
2461 class __indirect_expr
2463 typedef typename remove_reference<_ValExpr>::type _RmExpr;
2465 typedef typename _RmExpr::value_type value_type;
2466 typedef value_type result_type;
2470 valarray<size_t> __1d_;
2472 _LIBCPP_INLINE_VISIBILITY
2473 __indirect_expr(const valarray<size_t>& __ia, const _RmExpr& __e)
2478 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2480 _LIBCPP_INLINE_VISIBILITY
2481 __indirect_expr(valarray<size_t>&& __ia, const _RmExpr& __e)
2486 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2489 _LIBCPP_INLINE_VISIBILITY
2490 result_type operator[](size_t __i) const
2491 {return __expr_[__1d_[__i]];}
2493 _LIBCPP_INLINE_VISIBILITY
2494 size_t size() const {return __1d_.size();}
2496 template <class> friend class _LIBCPP_TYPE_VIS_ONLY valarray;
2499 template<class _ValExpr>
2502 typedef typename remove_reference<_ValExpr>::type _RmExpr;
2506 typedef typename _RmExpr::value_type value_type;
2507 typedef typename _RmExpr::result_type result_type;
2509 _LIBCPP_INLINE_VISIBILITY
2510 explicit __val_expr(const _RmExpr& __e) : __expr_(__e) {}
2512 _LIBCPP_INLINE_VISIBILITY
2513 result_type operator[](size_t __i) const
2514 {return __expr_[__i];}
2516 _LIBCPP_INLINE_VISIBILITY
2517 __val_expr<__slice_expr<_ValExpr> > operator[](slice __s) const
2518 {return __val_expr<__slice_expr<_ValExpr> >(__expr_, __s);}
2520 _LIBCPP_INLINE_VISIBILITY
2521 __val_expr<__indirect_expr<_ValExpr> > operator[](const gslice& __gs) const
2522 {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __gs.__1d_);}
2524 _LIBCPP_INLINE_VISIBILITY
2525 __val_expr<__mask_expr<_ValExpr> > operator[](const valarray<bool>& __vb) const
2526 {return __val_expr<__mask_expr<_ValExpr> >(__expr_, __vb);}
2528 _LIBCPP_INLINE_VISIBILITY
2529 __val_expr<__indirect_expr<_ValExpr> > operator[](const valarray<size_t>& __vs) const
2530 {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __vs);}
2532 _LIBCPP_INLINE_VISIBILITY
2533 __val_expr<_UnaryOp<__unary_plus<value_type>, _ValExpr> >
2536 typedef _UnaryOp<__unary_plus<value_type>, _ValExpr> _NewExpr;
2537 return __val_expr<_NewExpr>(_NewExpr(__unary_plus<value_type>(), __expr_));
2540 _LIBCPP_INLINE_VISIBILITY
2541 __val_expr<_UnaryOp<negate<value_type>, _ValExpr> >
2544 typedef _UnaryOp<negate<value_type>, _ValExpr> _NewExpr;
2545 return __val_expr<_NewExpr>(_NewExpr(negate<value_type>(), __expr_));
2548 _LIBCPP_INLINE_VISIBILITY
2549 __val_expr<_UnaryOp<__bit_not<value_type>, _ValExpr> >
2552 typedef _UnaryOp<__bit_not<value_type>, _ValExpr> _NewExpr;
2553 return __val_expr<_NewExpr>(_NewExpr(__bit_not<value_type>(), __expr_));
2556 _LIBCPP_INLINE_VISIBILITY
2557 __val_expr<_UnaryOp<logical_not<value_type>, _ValExpr> >
2560 typedef _UnaryOp<logical_not<value_type>, _ValExpr> _NewExpr;
2561 return __val_expr<_NewExpr>(_NewExpr(logical_not<value_type>(), __expr_));
2564 operator valarray<result_type>() const;
2566 _LIBCPP_INLINE_VISIBILITY
2567 size_t size() const {return __expr_.size();}
2569 _LIBCPP_INLINE_VISIBILITY
2570 result_type sum() const
2572 size_t __n = __expr_.size();
2573 result_type __r = __n ? __expr_[0] : result_type();
2574 for (size_t __i = 1; __i < __n; ++__i)
2575 __r += __expr_[__i];
2579 _LIBCPP_INLINE_VISIBILITY
2580 result_type min() const
2582 size_t __n = size();
2583 result_type __r = __n ? (*this)[0] : result_type();
2584 for (size_t __i = 1; __i < __n; ++__i)
2586 result_type __x = __expr_[__i];
2593 _LIBCPP_INLINE_VISIBILITY
2594 result_type max() const
2596 size_t __n = size();
2597 result_type __r = __n ? (*this)[0] : result_type();
2598 for (size_t __i = 1; __i < __n; ++__i)
2600 result_type __x = __expr_[__i];
2607 _LIBCPP_INLINE_VISIBILITY
2608 __val_expr<__shift_expr<_ValExpr> > shift (int __i) const
2609 {return __val_expr<__shift_expr<_ValExpr> >(__shift_expr<_ValExpr>(__i, __expr_));}
2611 _LIBCPP_INLINE_VISIBILITY
2612 __val_expr<__cshift_expr<_ValExpr> > cshift(int __i) const
2613 {return __val_expr<__cshift_expr<_ValExpr> >(__cshift_expr<_ValExpr>(__i, __expr_));}
2615 _LIBCPP_INLINE_VISIBILITY
2616 __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(value_type)>, _ValExpr> >
2617 apply(value_type __f(value_type)) const
2619 typedef __apply_expr<value_type, value_type(*)(value_type)> _Op;
2620 typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
2621 return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
2624 _LIBCPP_INLINE_VISIBILITY
2625 __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(const value_type&)>, _ValExpr> >
2626 apply(value_type __f(const value_type&)) const
2628 typedef __apply_expr<value_type, value_type(*)(const value_type&)> _Op;
2629 typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
2630 return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
2634 template<class _ValExpr>
2635 __val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const
2637 valarray<result_type> __r;
2638 size_t __n = __expr_.size();
2643 static_cast<result_type*>(_VSTD::__allocate(__n * sizeof(result_type)));
2644 for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i)
2645 ::new (__r.__end_) result_type(__expr_[__i]);
2652 template <class _Tp>
2653 inline _LIBCPP_INLINE_VISIBILITY
2654 valarray<_Tp>::valarray(size_t __n)
2661 template <class _Tp>
2662 inline _LIBCPP_INLINE_VISIBILITY
2663 valarray<_Tp>::valarray(const value_type& __x, size_t __n)
2670 template <class _Tp>
2671 valarray<_Tp>::valarray(const value_type* __p, size_t __n)
2677 __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
2678 #ifndef _LIBCPP_NO_EXCEPTIONS
2681 #endif // _LIBCPP_NO_EXCEPTIONS
2682 for (; __n; ++__end_, ++__p, --__n)
2683 ::new (__end_) value_type(*__p);
2684 #ifndef _LIBCPP_NO_EXCEPTIONS
2691 #endif // _LIBCPP_NO_EXCEPTIONS
2695 template <class _Tp>
2696 valarray<_Tp>::valarray(const valarray& __v)
2702 __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__v.size() * sizeof(value_type)));
2703 #ifndef _LIBCPP_NO_EXCEPTIONS
2706 #endif // _LIBCPP_NO_EXCEPTIONS
2707 for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p)
2708 ::new (__end_) value_type(*__p);
2709 #ifndef _LIBCPP_NO_EXCEPTIONS
2716 #endif // _LIBCPP_NO_EXCEPTIONS
2720 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2722 template <class _Tp>
2723 inline _LIBCPP_INLINE_VISIBILITY
2724 valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT
2725 : __begin_(__v.__begin_),
2728 __v.__begin_ = __v.__end_ = nullptr;
2731 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2733 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
2735 template <class _Tp>
2736 valarray<_Tp>::valarray(initializer_list<value_type> __il)
2740 size_t __n = __il.size();
2743 __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
2744 #ifndef _LIBCPP_NO_EXCEPTIONS
2747 #endif // _LIBCPP_NO_EXCEPTIONS
2748 for (const value_type* __p = __il.begin(); __n; ++__end_, ++__p, --__n)
2749 ::new (__end_) value_type(*__p);
2750 #ifndef _LIBCPP_NO_EXCEPTIONS
2757 #endif // _LIBCPP_NO_EXCEPTIONS
2761 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
2763 template <class _Tp>
2764 valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
2768 size_t __n = __sa.__size_;
2771 __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
2772 #ifndef _LIBCPP_NO_EXCEPTIONS
2775 #endif // _LIBCPP_NO_EXCEPTIONS
2776 for (const value_type* __p = __sa.__vp_; __n; ++__end_, __p += __sa.__stride_, --__n)
2777 ::new (__end_) value_type(*__p);
2778 #ifndef _LIBCPP_NO_EXCEPTIONS
2785 #endif // _LIBCPP_NO_EXCEPTIONS
2789 template <class _Tp>
2790 valarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
2794 size_t __n = __ga.__1d_.size();
2797 __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
2798 #ifndef _LIBCPP_NO_EXCEPTIONS
2801 #endif // _LIBCPP_NO_EXCEPTIONS
2802 typedef const size_t* _Ip;
2803 const value_type* __s = __ga.__vp_;
2804 for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
2805 __i != __e; ++__i, ++__end_)
2806 ::new (__end_) value_type(__s[*__i]);
2807 #ifndef _LIBCPP_NO_EXCEPTIONS
2814 #endif // _LIBCPP_NO_EXCEPTIONS
2818 template <class _Tp>
2819 valarray<_Tp>::valarray(const mask_array<value_type>& __ma)
2823 size_t __n = __ma.__1d_.size();
2826 __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
2827 #ifndef _LIBCPP_NO_EXCEPTIONS
2830 #endif // _LIBCPP_NO_EXCEPTIONS
2831 typedef const size_t* _Ip;
2832 const value_type* __s = __ma.__vp_;
2833 for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
2834 __i != __e; ++__i, ++__end_)
2835 ::new (__end_) value_type(__s[*__i]);
2836 #ifndef _LIBCPP_NO_EXCEPTIONS
2843 #endif // _LIBCPP_NO_EXCEPTIONS
2847 template <class _Tp>
2848 valarray<_Tp>::valarray(const indirect_array<value_type>& __ia)
2852 size_t __n = __ia.__1d_.size();
2855 __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
2856 #ifndef _LIBCPP_NO_EXCEPTIONS
2859 #endif // _LIBCPP_NO_EXCEPTIONS
2860 typedef const size_t* _Ip;
2861 const value_type* __s = __ia.__vp_;
2862 for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
2863 __i != __e; ++__i, ++__end_)
2864 ::new (__end_) value_type(__s[*__i]);
2865 #ifndef _LIBCPP_NO_EXCEPTIONS
2872 #endif // _LIBCPP_NO_EXCEPTIONS
2876 template <class _Tp>
2877 inline _LIBCPP_INLINE_VISIBILITY
2878 valarray<_Tp>::~valarray()
2883 template <class _Tp>
2885 valarray<_Tp>::operator=(const valarray& __v)
2889 if (size() != __v.size())
2891 _VSTD::copy(__v.__begin_, __v.__end_, __begin_);
2896 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2898 template <class _Tp>
2899 inline _LIBCPP_INLINE_VISIBILITY
2901 valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT
2904 __begin_ = __v.__begin_;
2905 __end_ = __v.__end_;
2906 __v.__begin_ = nullptr;
2907 __v.__end_ = nullptr;
2911 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2913 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
2915 template <class _Tp>
2916 inline _LIBCPP_INLINE_VISIBILITY
2918 valarray<_Tp>::operator=(initializer_list<value_type> __il)
2920 if (size() != __il.size())
2921 resize(__il.size());
2922 _VSTD::copy(__il.begin(), __il.end(), __begin_);
2926 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
2928 template <class _Tp>
2929 inline _LIBCPP_INLINE_VISIBILITY
2931 valarray<_Tp>::operator=(const value_type& __x)
2933 _VSTD::fill(__begin_, __end_, __x);
2937 template <class _Tp>
2938 inline _LIBCPP_INLINE_VISIBILITY
2940 valarray<_Tp>::operator=(const slice_array<value_type>& __sa)
2942 value_type* __t = __begin_;
2943 const value_type* __s = __sa.__vp_;
2944 for (size_t __n = __sa.__size_; __n; --__n, __s += __sa.__stride_, ++__t)
2949 template <class _Tp>
2950 inline _LIBCPP_INLINE_VISIBILITY
2952 valarray<_Tp>::operator=(const gslice_array<value_type>& __ga)
2954 typedef const size_t* _Ip;
2955 value_type* __t = __begin_;
2956 const value_type* __s = __ga.__vp_;
2957 for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
2958 __i != __e; ++__i, ++__t)
2963 template <class _Tp>
2964 inline _LIBCPP_INLINE_VISIBILITY
2966 valarray<_Tp>::operator=(const mask_array<value_type>& __ma)
2968 typedef const size_t* _Ip;
2969 value_type* __t = __begin_;
2970 const value_type* __s = __ma.__vp_;
2971 for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
2972 __i != __e; ++__i, ++__t)
2977 template <class _Tp>
2978 inline _LIBCPP_INLINE_VISIBILITY
2980 valarray<_Tp>::operator=(const indirect_array<value_type>& __ia)
2982 typedef const size_t* _Ip;
2983 value_type* __t = __begin_;
2984 const value_type* __s = __ia.__vp_;
2985 for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
2986 __i != __e; ++__i, ++__t)
2991 template <class _Tp>
2992 template <class _ValExpr>
2993 inline _LIBCPP_INLINE_VISIBILITY
2995 valarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v)
2997 size_t __n = __v.size();
3000 value_type* __t = __begin_;
3001 for (size_t __i = 0; __i != __n; ++__t, ++__i)
3002 *__t = result_type(__v[__i]);
3006 template <class _Tp>
3007 inline _LIBCPP_INLINE_VISIBILITY
3008 __val_expr<__slice_expr<const valarray<_Tp>&> >
3009 valarray<_Tp>::operator[](slice __s) const
3011 return __val_expr<__slice_expr<const valarray&> >(__slice_expr<const valarray&>(__s, *this));
3014 template <class _Tp>
3015 inline _LIBCPP_INLINE_VISIBILITY
3017 valarray<_Tp>::operator[](slice __s)
3019 return slice_array<value_type>(__s, *this);
3022 template <class _Tp>
3023 inline _LIBCPP_INLINE_VISIBILITY
3024 __val_expr<__indirect_expr<const valarray<_Tp>&> >
3025 valarray<_Tp>::operator[](const gslice& __gs) const
3027 return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__gs.__1d_, *this));
3030 template <class _Tp>
3031 inline _LIBCPP_INLINE_VISIBILITY
3033 valarray<_Tp>::operator[](const gslice& __gs)
3035 return gslice_array<value_type>(__gs, *this);
3038 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3040 template <class _Tp>
3041 inline _LIBCPP_INLINE_VISIBILITY
3042 __val_expr<__indirect_expr<const valarray<_Tp>&> >
3043 valarray<_Tp>::operator[](gslice&& __gs) const
3045 return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__gs.__1d_), *this));
3048 template <class _Tp>
3049 inline _LIBCPP_INLINE_VISIBILITY
3051 valarray<_Tp>::operator[](gslice&& __gs)
3053 return gslice_array<value_type>(move(__gs), *this);
3056 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
3058 template <class _Tp>
3059 inline _LIBCPP_INLINE_VISIBILITY
3060 __val_expr<__mask_expr<const valarray<_Tp>&> >
3061 valarray<_Tp>::operator[](const valarray<bool>& __vb) const
3063 return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(__vb, *this));
3066 template <class _Tp>
3067 inline _LIBCPP_INLINE_VISIBILITY
3069 valarray<_Tp>::operator[](const valarray<bool>& __vb)
3071 return mask_array<value_type>(__vb, *this);
3074 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3076 template <class _Tp>
3077 inline _LIBCPP_INLINE_VISIBILITY
3078 __val_expr<__mask_expr<const valarray<_Tp>&> >
3079 valarray<_Tp>::operator[](valarray<bool>&& __vb) const
3081 return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(move(__vb), *this));
3084 template <class _Tp>
3085 inline _LIBCPP_INLINE_VISIBILITY
3087 valarray<_Tp>::operator[](valarray<bool>&& __vb)
3089 return mask_array<value_type>(move(__vb), *this);
3092 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
3094 template <class _Tp>
3095 inline _LIBCPP_INLINE_VISIBILITY
3096 __val_expr<__indirect_expr<const valarray<_Tp>&> >
3097 valarray<_Tp>::operator[](const valarray<size_t>& __vs) const
3099 return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__vs, *this));
3102 template <class _Tp>
3103 inline _LIBCPP_INLINE_VISIBILITY
3105 valarray<_Tp>::operator[](const valarray<size_t>& __vs)
3107 return indirect_array<value_type>(__vs, *this);
3110 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3112 template <class _Tp>
3113 inline _LIBCPP_INLINE_VISIBILITY
3114 __val_expr<__indirect_expr<const valarray<_Tp>&> >
3115 valarray<_Tp>::operator[](valarray<size_t>&& __vs) const
3117 return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__vs), *this));
3120 template <class _Tp>
3121 inline _LIBCPP_INLINE_VISIBILITY
3123 valarray<_Tp>::operator[](valarray<size_t>&& __vs)
3125 return indirect_array<value_type>(move(__vs), *this);
3128 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
3130 template <class _Tp>
3132 valarray<_Tp>::operator+() const
3134 valarray<value_type> __r;
3135 size_t __n = size();
3140 static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
3141 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3142 ::new (__r.__end_) value_type(+*__p);
3147 template <class _Tp>
3149 valarray<_Tp>::operator-() const
3151 valarray<value_type> __r;
3152 size_t __n = size();
3157 static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
3158 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3159 ::new (__r.__end_) value_type(-*__p);
3164 template <class _Tp>
3166 valarray<_Tp>::operator~() const
3168 valarray<value_type> __r;
3169 size_t __n = size();
3174 static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
3175 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3176 ::new (__r.__end_) value_type(~*__p);
3181 template <class _Tp>
3183 valarray<_Tp>::operator!() const
3186 size_t __n = size();
3191 static_cast<bool*>(_VSTD::__allocate(__n * sizeof(bool)));
3192 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3193 ::new (__r.__end_) bool(!*__p);
3198 template <class _Tp>
3199 inline _LIBCPP_INLINE_VISIBILITY
3201 valarray<_Tp>::operator*=(const value_type& __x)
3203 for (value_type* __p = __begin_; __p != __end_; ++__p)
3208 template <class _Tp>
3209 inline _LIBCPP_INLINE_VISIBILITY
3211 valarray<_Tp>::operator/=(const value_type& __x)
3213 for (value_type* __p = __begin_; __p != __end_; ++__p)
3218 template <class _Tp>
3219 inline _LIBCPP_INLINE_VISIBILITY
3221 valarray<_Tp>::operator%=(const value_type& __x)
3223 for (value_type* __p = __begin_; __p != __end_; ++__p)
3228 template <class _Tp>
3229 inline _LIBCPP_INLINE_VISIBILITY
3231 valarray<_Tp>::operator+=(const value_type& __x)
3233 for (value_type* __p = __begin_; __p != __end_; ++__p)
3238 template <class _Tp>
3239 inline _LIBCPP_INLINE_VISIBILITY
3241 valarray<_Tp>::operator-=(const value_type& __x)
3243 for (value_type* __p = __begin_; __p != __end_; ++__p)
3248 template <class _Tp>
3249 inline _LIBCPP_INLINE_VISIBILITY
3251 valarray<_Tp>::operator^=(const value_type& __x)
3253 for (value_type* __p = __begin_; __p != __end_; ++__p)
3258 template <class _Tp>
3259 inline _LIBCPP_INLINE_VISIBILITY
3261 valarray<_Tp>::operator&=(const value_type& __x)
3263 for (value_type* __p = __begin_; __p != __end_; ++__p)
3268 template <class _Tp>
3269 inline _LIBCPP_INLINE_VISIBILITY
3271 valarray<_Tp>::operator|=(const value_type& __x)
3273 for (value_type* __p = __begin_; __p != __end_; ++__p)
3278 template <class _Tp>
3279 inline _LIBCPP_INLINE_VISIBILITY
3281 valarray<_Tp>::operator<<=(const value_type& __x)
3283 for (value_type* __p = __begin_; __p != __end_; ++__p)
3288 template <class _Tp>
3289 inline _LIBCPP_INLINE_VISIBILITY
3291 valarray<_Tp>::operator>>=(const value_type& __x)
3293 for (value_type* __p = __begin_; __p != __end_; ++__p)
3298 template <class _Tp>
3299 template <class _Expr>
3300 inline _LIBCPP_INLINE_VISIBILITY
3303 __is_val_expr<_Expr>::value,
3306 valarray<_Tp>::operator*=(const _Expr& __v)
3309 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3314 template <class _Tp>
3315 template <class _Expr>
3316 inline _LIBCPP_INLINE_VISIBILITY
3319 __is_val_expr<_Expr>::value,
3322 valarray<_Tp>::operator/=(const _Expr& __v)
3325 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3330 template <class _Tp>
3331 template <class _Expr>
3332 inline _LIBCPP_INLINE_VISIBILITY
3335 __is_val_expr<_Expr>::value,
3338 valarray<_Tp>::operator%=(const _Expr& __v)
3341 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3346 template <class _Tp>
3347 template <class _Expr>
3348 inline _LIBCPP_INLINE_VISIBILITY
3351 __is_val_expr<_Expr>::value,
3354 valarray<_Tp>::operator+=(const _Expr& __v)
3357 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3362 template <class _Tp>
3363 template <class _Expr>
3364 inline _LIBCPP_INLINE_VISIBILITY
3367 __is_val_expr<_Expr>::value,
3370 valarray<_Tp>::operator-=(const _Expr& __v)
3373 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3378 template <class _Tp>
3379 template <class _Expr>
3380 inline _LIBCPP_INLINE_VISIBILITY
3383 __is_val_expr<_Expr>::value,
3386 valarray<_Tp>::operator^=(const _Expr& __v)
3389 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3394 template <class _Tp>
3395 template <class _Expr>
3396 inline _LIBCPP_INLINE_VISIBILITY
3399 __is_val_expr<_Expr>::value,
3402 valarray<_Tp>::operator|=(const _Expr& __v)
3405 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3410 template <class _Tp>
3411 template <class _Expr>
3412 inline _LIBCPP_INLINE_VISIBILITY
3415 __is_val_expr<_Expr>::value,
3418 valarray<_Tp>::operator&=(const _Expr& __v)
3421 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3426 template <class _Tp>
3427 template <class _Expr>
3428 inline _LIBCPP_INLINE_VISIBILITY
3431 __is_val_expr<_Expr>::value,
3434 valarray<_Tp>::operator<<=(const _Expr& __v)
3437 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3442 template <class _Tp>
3443 template <class _Expr>
3444 inline _LIBCPP_INLINE_VISIBILITY
3447 __is_val_expr<_Expr>::value,
3450 valarray<_Tp>::operator>>=(const _Expr& __v)
3453 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3458 template <class _Tp>
3459 inline _LIBCPP_INLINE_VISIBILITY
3461 valarray<_Tp>::swap(valarray& __v) _NOEXCEPT
3463 _VSTD::swap(__begin_, __v.__begin_);
3464 _VSTD::swap(__end_, __v.__end_);
3467 template <class _Tp>
3468 inline _LIBCPP_INLINE_VISIBILITY
3470 valarray<_Tp>::sum() const
3472 if (__begin_ == __end_)
3473 return value_type();
3474 const value_type* __p = __begin_;
3476 for (++__p; __p != __end_; ++__p)
3481 template <class _Tp>
3482 inline _LIBCPP_INLINE_VISIBILITY
3484 valarray<_Tp>::min() const
3486 if (__begin_ == __end_)
3487 return value_type();
3488 return *_VSTD::min_element(__begin_, __end_);
3491 template <class _Tp>
3492 inline _LIBCPP_INLINE_VISIBILITY
3494 valarray<_Tp>::max() const
3496 if (__begin_ == __end_)
3497 return value_type();
3498 return *_VSTD::max_element(__begin_, __end_);
3501 template <class _Tp>
3503 valarray<_Tp>::shift(int __i) const
3505 valarray<value_type> __r;
3506 size_t __n = size();
3511 static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
3512 const value_type* __sb;
3517 __i = _VSTD::min(__i, static_cast<int>(__n));
3518 __sb = __begin_ + __i;
3519 __tb = __r.__begin_;
3520 __te = __r.__begin_ + (__n - __i);
3524 __i = _VSTD::min(-__i, static_cast<int>(__n));
3526 __tb = __r.__begin_ + __i;
3527 __te = __r.__begin_ + __n;
3529 for (; __r.__end_ != __tb; ++__r.__end_)
3530 ::new (__r.__end_) value_type();
3531 for (; __r.__end_ != __te; ++__r.__end_, ++__sb)
3532 ::new (__r.__end_) value_type(*__sb);
3533 for (__te = __r.__begin_ + __n; __r.__end_ != __te; ++__r.__end_)
3534 ::new (__r.__end_) value_type();
3539 template <class _Tp>
3541 valarray<_Tp>::cshift(int __i) const
3543 valarray<value_type> __r;
3544 size_t __n = size();
3549 static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
3550 __i %= static_cast<int>(__n);
3551 const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i;
3552 for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s)
3553 ::new (__r.__end_) value_type(*__s);
3554 for (const value_type* __s = __begin_; __s != __m; ++__r.__end_, ++__s)
3555 ::new (__r.__end_) value_type(*__s);
3560 template <class _Tp>
3562 valarray<_Tp>::apply(value_type __f(value_type)) const
3564 valarray<value_type> __r;
3565 size_t __n = size();
3570 static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
3571 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3572 ::new (__r.__end_) value_type(__f(*__p));
3577 template <class _Tp>
3579 valarray<_Tp>::apply(value_type __f(const value_type&)) const
3581 valarray<value_type> __r;
3582 size_t __n = size();
3587 static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
3588 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3589 ::new (__r.__end_) value_type(__f(*__p));
3594 template <class _Tp>
3596 valarray<_Tp>::resize(size_t __n, value_type __x)
3598 if (__begin_ != nullptr)
3600 while (__end_ != __begin_)
3601 (--__end_)->~value_type();
3602 _VSTD::__deallocate(__begin_);
3603 __begin_ = __end_ = nullptr;
3607 __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
3608 #ifndef _LIBCPP_NO_EXCEPTIONS
3611 #endif // _LIBCPP_NO_EXCEPTIONS
3612 for (; __n; --__n, ++__end_)
3613 ::new (__end_) value_type(__x);
3614 #ifndef _LIBCPP_NO_EXCEPTIONS
3621 #endif // _LIBCPP_NO_EXCEPTIONS
3626 inline _LIBCPP_INLINE_VISIBILITY
3628 swap(valarray<_Tp>& __x, valarray<_Tp>& __y) _NOEXCEPT
3633 template<class _Expr1, class _Expr2>
3634 inline _LIBCPP_INLINE_VISIBILITY
3637 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3638 __val_expr<_BinaryOp<multiplies<typename _Expr1::value_type>, _Expr1, _Expr2> >
3640 operator*(const _Expr1& __x, const _Expr2& __y)
3642 typedef typename _Expr1::value_type value_type;
3643 typedef _BinaryOp<multiplies<value_type>, _Expr1, _Expr2> _Op;
3644 return __val_expr<_Op>(_Op(multiplies<value_type>(), __x, __y));
3647 template<class _Expr>
3648 inline _LIBCPP_INLINE_VISIBILITY
3651 __is_val_expr<_Expr>::value,
3652 __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
3653 _Expr, __scalar_expr<typename _Expr::value_type> > >
3655 operator*(const _Expr& __x, const typename _Expr::value_type& __y)
3657 typedef typename _Expr::value_type value_type;
3658 typedef _BinaryOp<multiplies<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3659 return __val_expr<_Op>(_Op(multiplies<value_type>(),
3660 __x, __scalar_expr<value_type>(__y, __x.size())));
3663 template<class _Expr>
3664 inline _LIBCPP_INLINE_VISIBILITY
3667 __is_val_expr<_Expr>::value,
3668 __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
3669 __scalar_expr<typename _Expr::value_type>, _Expr> >
3671 operator*(const typename _Expr::value_type& __x, const _Expr& __y)
3673 typedef typename _Expr::value_type value_type;
3674 typedef _BinaryOp<multiplies<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3675 return __val_expr<_Op>(_Op(multiplies<value_type>(),
3676 __scalar_expr<value_type>(__x, __y.size()), __y));
3679 template<class _Expr1, class _Expr2>
3680 inline _LIBCPP_INLINE_VISIBILITY
3683 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3684 __val_expr<_BinaryOp<divides<typename _Expr1::value_type>, _Expr1, _Expr2> >
3686 operator/(const _Expr1& __x, const _Expr2& __y)
3688 typedef typename _Expr1::value_type value_type;
3689 typedef _BinaryOp<divides<value_type>, _Expr1, _Expr2> _Op;
3690 return __val_expr<_Op>(_Op(divides<value_type>(), __x, __y));
3693 template<class _Expr>
3694 inline _LIBCPP_INLINE_VISIBILITY
3697 __is_val_expr<_Expr>::value,
3698 __val_expr<_BinaryOp<divides<typename _Expr::value_type>,
3699 _Expr, __scalar_expr<typename _Expr::value_type> > >
3701 operator/(const _Expr& __x, const typename _Expr::value_type& __y)
3703 typedef typename _Expr::value_type value_type;
3704 typedef _BinaryOp<divides<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3705 return __val_expr<_Op>(_Op(divides<value_type>(),
3706 __x, __scalar_expr<value_type>(__y, __x.size())));
3709 template<class _Expr>
3710 inline _LIBCPP_INLINE_VISIBILITY
3713 __is_val_expr<_Expr>::value,
3714 __val_expr<_BinaryOp<divides<typename _Expr::value_type>,
3715 __scalar_expr<typename _Expr::value_type>, _Expr> >
3717 operator/(const typename _Expr::value_type& __x, const _Expr& __y)
3719 typedef typename _Expr::value_type value_type;
3720 typedef _BinaryOp<divides<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3721 return __val_expr<_Op>(_Op(divides<value_type>(),
3722 __scalar_expr<value_type>(__x, __y.size()), __y));
3725 template<class _Expr1, class _Expr2>
3726 inline _LIBCPP_INLINE_VISIBILITY
3729 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3730 __val_expr<_BinaryOp<modulus<typename _Expr1::value_type>, _Expr1, _Expr2> >
3732 operator%(const _Expr1& __x, const _Expr2& __y)
3734 typedef typename _Expr1::value_type value_type;
3735 typedef _BinaryOp<modulus<value_type>, _Expr1, _Expr2> _Op;
3736 return __val_expr<_Op>(_Op(modulus<value_type>(), __x, __y));
3739 template<class _Expr>
3740 inline _LIBCPP_INLINE_VISIBILITY
3743 __is_val_expr<_Expr>::value,
3744 __val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
3745 _Expr, __scalar_expr<typename _Expr::value_type> > >
3747 operator%(const _Expr& __x, const typename _Expr::value_type& __y)
3749 typedef typename _Expr::value_type value_type;
3750 typedef _BinaryOp<modulus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3751 return __val_expr<_Op>(_Op(modulus<value_type>(),
3752 __x, __scalar_expr<value_type>(__y, __x.size())));
3755 template<class _Expr>
3756 inline _LIBCPP_INLINE_VISIBILITY
3759 __is_val_expr<_Expr>::value,
3760 __val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
3761 __scalar_expr<typename _Expr::value_type>, _Expr> >
3763 operator%(const typename _Expr::value_type& __x, const _Expr& __y)
3765 typedef typename _Expr::value_type value_type;
3766 typedef _BinaryOp<modulus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3767 return __val_expr<_Op>(_Op(modulus<value_type>(),
3768 __scalar_expr<value_type>(__x, __y.size()), __y));
3771 template<class _Expr1, class _Expr2>
3772 inline _LIBCPP_INLINE_VISIBILITY
3775 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3776 __val_expr<_BinaryOp<plus<typename _Expr1::value_type>, _Expr1, _Expr2> >
3778 operator+(const _Expr1& __x, const _Expr2& __y)
3780 typedef typename _Expr1::value_type value_type;
3781 typedef _BinaryOp<plus<value_type>, _Expr1, _Expr2> _Op;
3782 return __val_expr<_Op>(_Op(plus<value_type>(), __x, __y));
3785 template<class _Expr>
3786 inline _LIBCPP_INLINE_VISIBILITY
3789 __is_val_expr<_Expr>::value,
3790 __val_expr<_BinaryOp<plus<typename _Expr::value_type>,
3791 _Expr, __scalar_expr<typename _Expr::value_type> > >
3793 operator+(const _Expr& __x, const typename _Expr::value_type& __y)
3795 typedef typename _Expr::value_type value_type;
3796 typedef _BinaryOp<plus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3797 return __val_expr<_Op>(_Op(plus<value_type>(),
3798 __x, __scalar_expr<value_type>(__y, __x.size())));
3801 template<class _Expr>
3802 inline _LIBCPP_INLINE_VISIBILITY
3805 __is_val_expr<_Expr>::value,
3806 __val_expr<_BinaryOp<plus<typename _Expr::value_type>,
3807 __scalar_expr<typename _Expr::value_type>, _Expr> >
3809 operator+(const typename _Expr::value_type& __x, const _Expr& __y)
3811 typedef typename _Expr::value_type value_type;
3812 typedef _BinaryOp<plus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3813 return __val_expr<_Op>(_Op(plus<value_type>(),
3814 __scalar_expr<value_type>(__x, __y.size()), __y));
3817 template<class _Expr1, class _Expr2>
3818 inline _LIBCPP_INLINE_VISIBILITY
3821 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3822 __val_expr<_BinaryOp<minus<typename _Expr1::value_type>, _Expr1, _Expr2> >
3824 operator-(const _Expr1& __x, const _Expr2& __y)
3826 typedef typename _Expr1::value_type value_type;
3827 typedef _BinaryOp<minus<value_type>, _Expr1, _Expr2> _Op;
3828 return __val_expr<_Op>(_Op(minus<value_type>(), __x, __y));
3831 template<class _Expr>
3832 inline _LIBCPP_INLINE_VISIBILITY
3835 __is_val_expr<_Expr>::value,
3836 __val_expr<_BinaryOp<minus<typename _Expr::value_type>,
3837 _Expr, __scalar_expr<typename _Expr::value_type> > >
3839 operator-(const _Expr& __x, const typename _Expr::value_type& __y)
3841 typedef typename _Expr::value_type value_type;
3842 typedef _BinaryOp<minus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3843 return __val_expr<_Op>(_Op(minus<value_type>(),
3844 __x, __scalar_expr<value_type>(__y, __x.size())));
3847 template<class _Expr>
3848 inline _LIBCPP_INLINE_VISIBILITY
3851 __is_val_expr<_Expr>::value,
3852 __val_expr<_BinaryOp<minus<typename _Expr::value_type>,
3853 __scalar_expr<typename _Expr::value_type>, _Expr> >
3855 operator-(const typename _Expr::value_type& __x, const _Expr& __y)
3857 typedef typename _Expr::value_type value_type;
3858 typedef _BinaryOp<minus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3859 return __val_expr<_Op>(_Op(minus<value_type>(),
3860 __scalar_expr<value_type>(__x, __y.size()), __y));
3863 template<class _Expr1, class _Expr2>
3864 inline _LIBCPP_INLINE_VISIBILITY
3867 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3868 __val_expr<_BinaryOp<bit_xor<typename _Expr1::value_type>, _Expr1, _Expr2> >
3870 operator^(const _Expr1& __x, const _Expr2& __y)
3872 typedef typename _Expr1::value_type value_type;
3873 typedef _BinaryOp<bit_xor<value_type>, _Expr1, _Expr2> _Op;
3874 return __val_expr<_Op>(_Op(bit_xor<value_type>(), __x, __y));
3877 template<class _Expr>
3878 inline _LIBCPP_INLINE_VISIBILITY
3881 __is_val_expr<_Expr>::value,
3882 __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
3883 _Expr, __scalar_expr<typename _Expr::value_type> > >
3885 operator^(const _Expr& __x, const typename _Expr::value_type& __y)
3887 typedef typename _Expr::value_type value_type;
3888 typedef _BinaryOp<bit_xor<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3889 return __val_expr<_Op>(_Op(bit_xor<value_type>(),
3890 __x, __scalar_expr<value_type>(__y, __x.size())));
3893 template<class _Expr>
3894 inline _LIBCPP_INLINE_VISIBILITY
3897 __is_val_expr<_Expr>::value,
3898 __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
3899 __scalar_expr<typename _Expr::value_type>, _Expr> >
3901 operator^(const typename _Expr::value_type& __x, const _Expr& __y)
3903 typedef typename _Expr::value_type value_type;
3904 typedef _BinaryOp<bit_xor<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3905 return __val_expr<_Op>(_Op(bit_xor<value_type>(),
3906 __scalar_expr<value_type>(__x, __y.size()), __y));
3909 template<class _Expr1, class _Expr2>
3910 inline _LIBCPP_INLINE_VISIBILITY
3913 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3914 __val_expr<_BinaryOp<bit_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
3916 operator&(const _Expr1& __x, const _Expr2& __y)
3918 typedef typename _Expr1::value_type value_type;
3919 typedef _BinaryOp<bit_and<value_type>, _Expr1, _Expr2> _Op;
3920 return __val_expr<_Op>(_Op(bit_and<value_type>(), __x, __y));
3923 template<class _Expr>
3924 inline _LIBCPP_INLINE_VISIBILITY
3927 __is_val_expr<_Expr>::value,
3928 __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
3929 _Expr, __scalar_expr<typename _Expr::value_type> > >
3931 operator&(const _Expr& __x, const typename _Expr::value_type& __y)
3933 typedef typename _Expr::value_type value_type;
3934 typedef _BinaryOp<bit_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3935 return __val_expr<_Op>(_Op(bit_and<value_type>(),
3936 __x, __scalar_expr<value_type>(__y, __x.size())));
3939 template<class _Expr>
3940 inline _LIBCPP_INLINE_VISIBILITY
3943 __is_val_expr<_Expr>::value,
3944 __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
3945 __scalar_expr<typename _Expr::value_type>, _Expr> >
3947 operator&(const typename _Expr::value_type& __x, const _Expr& __y)
3949 typedef typename _Expr::value_type value_type;
3950 typedef _BinaryOp<bit_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3951 return __val_expr<_Op>(_Op(bit_and<value_type>(),
3952 __scalar_expr<value_type>(__x, __y.size()), __y));
3955 template<class _Expr1, class _Expr2>
3956 inline _LIBCPP_INLINE_VISIBILITY
3959 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3960 __val_expr<_BinaryOp<bit_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
3962 operator|(const _Expr1& __x, const _Expr2& __y)
3964 typedef typename _Expr1::value_type value_type;
3965 typedef _BinaryOp<bit_or<value_type>, _Expr1, _Expr2> _Op;
3966 return __val_expr<_Op>(_Op(bit_or<value_type>(), __x, __y));
3969 template<class _Expr>
3970 inline _LIBCPP_INLINE_VISIBILITY
3973 __is_val_expr<_Expr>::value,
3974 __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
3975 _Expr, __scalar_expr<typename _Expr::value_type> > >
3977 operator|(const _Expr& __x, const typename _Expr::value_type& __y)
3979 typedef typename _Expr::value_type value_type;
3980 typedef _BinaryOp<bit_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3981 return __val_expr<_Op>(_Op(bit_or<value_type>(),
3982 __x, __scalar_expr<value_type>(__y, __x.size())));
3985 template<class _Expr>
3986 inline _LIBCPP_INLINE_VISIBILITY
3989 __is_val_expr<_Expr>::value,
3990 __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
3991 __scalar_expr<typename _Expr::value_type>, _Expr> >
3993 operator|(const typename _Expr::value_type& __x, const _Expr& __y)
3995 typedef typename _Expr::value_type value_type;
3996 typedef _BinaryOp<bit_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3997 return __val_expr<_Op>(_Op(bit_or<value_type>(),
3998 __scalar_expr<value_type>(__x, __y.size()), __y));
4001 template<class _Expr1, class _Expr2>
4002 inline _LIBCPP_INLINE_VISIBILITY
4005 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4006 __val_expr<_BinaryOp<__bit_shift_left<typename _Expr1::value_type>, _Expr1, _Expr2> >
4008 operator<<(const _Expr1& __x, const _Expr2& __y)
4010 typedef typename _Expr1::value_type value_type;
4011 typedef _BinaryOp<__bit_shift_left<value_type>, _Expr1, _Expr2> _Op;
4012 return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), __x, __y));
4015 template<class _Expr>
4016 inline _LIBCPP_INLINE_VISIBILITY
4019 __is_val_expr<_Expr>::value,
4020 __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
4021 _Expr, __scalar_expr<typename _Expr::value_type> > >
4023 operator<<(const _Expr& __x, const typename _Expr::value_type& __y)
4025 typedef typename _Expr::value_type value_type;
4026 typedef _BinaryOp<__bit_shift_left<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4027 return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
4028 __x, __scalar_expr<value_type>(__y, __x.size())));
4031 template<class _Expr>
4032 inline _LIBCPP_INLINE_VISIBILITY
4035 __is_val_expr<_Expr>::value,
4036 __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
4037 __scalar_expr<typename _Expr::value_type>, _Expr> >
4039 operator<<(const typename _Expr::value_type& __x, const _Expr& __y)
4041 typedef typename _Expr::value_type value_type;
4042 typedef _BinaryOp<__bit_shift_left<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4043 return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
4044 __scalar_expr<value_type>(__x, __y.size()), __y));
4047 template<class _Expr1, class _Expr2>
4048 inline _LIBCPP_INLINE_VISIBILITY
4051 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4052 __val_expr<_BinaryOp<__bit_shift_right<typename _Expr1::value_type>, _Expr1, _Expr2> >
4054 operator>>(const _Expr1& __x, const _Expr2& __y)
4056 typedef typename _Expr1::value_type value_type;
4057 typedef _BinaryOp<__bit_shift_right<value_type>, _Expr1, _Expr2> _Op;
4058 return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), __x, __y));
4061 template<class _Expr>
4062 inline _LIBCPP_INLINE_VISIBILITY
4065 __is_val_expr<_Expr>::value,
4066 __val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
4067 _Expr, __scalar_expr<typename _Expr::value_type> > >
4069 operator>>(const _Expr& __x, const typename _Expr::value_type& __y)
4071 typedef typename _Expr::value_type value_type;
4072 typedef _BinaryOp<__bit_shift_right<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4073 return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
4074 __x, __scalar_expr<value_type>(__y, __x.size())));
4077 template<class _Expr>
4078 inline _LIBCPP_INLINE_VISIBILITY
4081 __is_val_expr<_Expr>::value,
4082 __val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
4083 __scalar_expr<typename _Expr::value_type>, _Expr> >
4085 operator>>(const typename _Expr::value_type& __x, const _Expr& __y)
4087 typedef typename _Expr::value_type value_type;
4088 typedef _BinaryOp<__bit_shift_right<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4089 return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
4090 __scalar_expr<value_type>(__x, __y.size()), __y));
4093 template<class _Expr1, class _Expr2>
4094 inline _LIBCPP_INLINE_VISIBILITY
4097 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4098 __val_expr<_BinaryOp<logical_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
4100 operator&&(const _Expr1& __x, const _Expr2& __y)
4102 typedef typename _Expr1::value_type value_type;
4103 typedef _BinaryOp<logical_and<value_type>, _Expr1, _Expr2> _Op;
4104 return __val_expr<_Op>(_Op(logical_and<value_type>(), __x, __y));
4107 template<class _Expr>
4108 inline _LIBCPP_INLINE_VISIBILITY
4111 __is_val_expr<_Expr>::value,
4112 __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
4113 _Expr, __scalar_expr<typename _Expr::value_type> > >
4115 operator&&(const _Expr& __x, const typename _Expr::value_type& __y)
4117 typedef typename _Expr::value_type value_type;
4118 typedef _BinaryOp<logical_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4119 return __val_expr<_Op>(_Op(logical_and<value_type>(),
4120 __x, __scalar_expr<value_type>(__y, __x.size())));
4123 template<class _Expr>
4124 inline _LIBCPP_INLINE_VISIBILITY
4127 __is_val_expr<_Expr>::value,
4128 __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
4129 __scalar_expr<typename _Expr::value_type>, _Expr> >
4131 operator&&(const typename _Expr::value_type& __x, const _Expr& __y)
4133 typedef typename _Expr::value_type value_type;
4134 typedef _BinaryOp<logical_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4135 return __val_expr<_Op>(_Op(logical_and<value_type>(),
4136 __scalar_expr<value_type>(__x, __y.size()), __y));
4139 template<class _Expr1, class _Expr2>
4140 inline _LIBCPP_INLINE_VISIBILITY
4143 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4144 __val_expr<_BinaryOp<logical_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
4146 operator||(const _Expr1& __x, const _Expr2& __y)
4148 typedef typename _Expr1::value_type value_type;
4149 typedef _BinaryOp<logical_or<value_type>, _Expr1, _Expr2> _Op;
4150 return __val_expr<_Op>(_Op(logical_or<value_type>(), __x, __y));
4153 template<class _Expr>
4154 inline _LIBCPP_INLINE_VISIBILITY
4157 __is_val_expr<_Expr>::value,
4158 __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
4159 _Expr, __scalar_expr<typename _Expr::value_type> > >
4161 operator||(const _Expr& __x, const typename _Expr::value_type& __y)
4163 typedef typename _Expr::value_type value_type;
4164 typedef _BinaryOp<logical_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4165 return __val_expr<_Op>(_Op(logical_or<value_type>(),
4166 __x, __scalar_expr<value_type>(__y, __x.size())));
4169 template<class _Expr>
4170 inline _LIBCPP_INLINE_VISIBILITY
4173 __is_val_expr<_Expr>::value,
4174 __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
4175 __scalar_expr<typename _Expr::value_type>, _Expr> >
4177 operator||(const typename _Expr::value_type& __x, const _Expr& __y)
4179 typedef typename _Expr::value_type value_type;
4180 typedef _BinaryOp<logical_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4181 return __val_expr<_Op>(_Op(logical_or<value_type>(),
4182 __scalar_expr<value_type>(__x, __y.size()), __y));
4185 template<class _Expr1, class _Expr2>
4186 inline _LIBCPP_INLINE_VISIBILITY
4189 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4190 __val_expr<_BinaryOp<equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
4192 operator==(const _Expr1& __x, const _Expr2& __y)
4194 typedef typename _Expr1::value_type value_type;
4195 typedef _BinaryOp<equal_to<value_type>, _Expr1, _Expr2> _Op;
4196 return __val_expr<_Op>(_Op(equal_to<value_type>(), __x, __y));
4199 template<class _Expr>
4200 inline _LIBCPP_INLINE_VISIBILITY
4203 __is_val_expr<_Expr>::value,
4204 __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
4205 _Expr, __scalar_expr<typename _Expr::value_type> > >
4207 operator==(const _Expr& __x, const typename _Expr::value_type& __y)
4209 typedef typename _Expr::value_type value_type;
4210 typedef _BinaryOp<equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4211 return __val_expr<_Op>(_Op(equal_to<value_type>(),
4212 __x, __scalar_expr<value_type>(__y, __x.size())));
4215 template<class _Expr>
4216 inline _LIBCPP_INLINE_VISIBILITY
4219 __is_val_expr<_Expr>::value,
4220 __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
4221 __scalar_expr<typename _Expr::value_type>, _Expr> >
4223 operator==(const typename _Expr::value_type& __x, const _Expr& __y)
4225 typedef typename _Expr::value_type value_type;
4226 typedef _BinaryOp<equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4227 return __val_expr<_Op>(_Op(equal_to<value_type>(),
4228 __scalar_expr<value_type>(__x, __y.size()), __y));
4231 template<class _Expr1, class _Expr2>
4232 inline _LIBCPP_INLINE_VISIBILITY
4235 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4236 __val_expr<_BinaryOp<not_equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
4238 operator!=(const _Expr1& __x, const _Expr2& __y)
4240 typedef typename _Expr1::value_type value_type;
4241 typedef _BinaryOp<not_equal_to<value_type>, _Expr1, _Expr2> _Op;
4242 return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __x, __y));
4245 template<class _Expr>
4246 inline _LIBCPP_INLINE_VISIBILITY
4249 __is_val_expr<_Expr>::value,
4250 __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
4251 _Expr, __scalar_expr<typename _Expr::value_type> > >
4253 operator!=(const _Expr& __x, const typename _Expr::value_type& __y)
4255 typedef typename _Expr::value_type value_type;
4256 typedef _BinaryOp<not_equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4257 return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
4258 __x, __scalar_expr<value_type>(__y, __x.size())));
4261 template<class _Expr>
4262 inline _LIBCPP_INLINE_VISIBILITY
4265 __is_val_expr<_Expr>::value,
4266 __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
4267 __scalar_expr<typename _Expr::value_type>, _Expr> >
4269 operator!=(const typename _Expr::value_type& __x, const _Expr& __y)
4271 typedef typename _Expr::value_type value_type;
4272 typedef _BinaryOp<not_equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4273 return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
4274 __scalar_expr<value_type>(__x, __y.size()), __y));
4277 template<class _Expr1, class _Expr2>
4278 inline _LIBCPP_INLINE_VISIBILITY
4281 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4282 __val_expr<_BinaryOp<less<typename _Expr1::value_type>, _Expr1, _Expr2> >
4284 operator<(const _Expr1& __x, const _Expr2& __y)
4286 typedef typename _Expr1::value_type value_type;
4287 typedef _BinaryOp<less<value_type>, _Expr1, _Expr2> _Op;
4288 return __val_expr<_Op>(_Op(less<value_type>(), __x, __y));
4291 template<class _Expr>
4292 inline _LIBCPP_INLINE_VISIBILITY
4295 __is_val_expr<_Expr>::value,
4296 __val_expr<_BinaryOp<less<typename _Expr::value_type>,
4297 _Expr, __scalar_expr<typename _Expr::value_type> > >
4299 operator<(const _Expr& __x, const typename _Expr::value_type& __y)
4301 typedef typename _Expr::value_type value_type;
4302 typedef _BinaryOp<less<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4303 return __val_expr<_Op>(_Op(less<value_type>(),
4304 __x, __scalar_expr<value_type>(__y, __x.size())));
4307 template<class _Expr>
4308 inline _LIBCPP_INLINE_VISIBILITY
4311 __is_val_expr<_Expr>::value,
4312 __val_expr<_BinaryOp<less<typename _Expr::value_type>,
4313 __scalar_expr<typename _Expr::value_type>, _Expr> >
4315 operator<(const typename _Expr::value_type& __x, const _Expr& __y)
4317 typedef typename _Expr::value_type value_type;
4318 typedef _BinaryOp<less<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4319 return __val_expr<_Op>(_Op(less<value_type>(),
4320 __scalar_expr<value_type>(__x, __y.size()), __y));
4323 template<class _Expr1, class _Expr2>
4324 inline _LIBCPP_INLINE_VISIBILITY
4327 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4328 __val_expr<_BinaryOp<greater<typename _Expr1::value_type>, _Expr1, _Expr2> >
4330 operator>(const _Expr1& __x, const _Expr2& __y)
4332 typedef typename _Expr1::value_type value_type;
4333 typedef _BinaryOp<greater<value_type>, _Expr1, _Expr2> _Op;
4334 return __val_expr<_Op>(_Op(greater<value_type>(), __x, __y));
4337 template<class _Expr>
4338 inline _LIBCPP_INLINE_VISIBILITY
4341 __is_val_expr<_Expr>::value,
4342 __val_expr<_BinaryOp<greater<typename _Expr::value_type>,
4343 _Expr, __scalar_expr<typename _Expr::value_type> > >
4345 operator>(const _Expr& __x, const typename _Expr::value_type& __y)
4347 typedef typename _Expr::value_type value_type;
4348 typedef _BinaryOp<greater<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4349 return __val_expr<_Op>(_Op(greater<value_type>(),
4350 __x, __scalar_expr<value_type>(__y, __x.size())));
4353 template<class _Expr>
4354 inline _LIBCPP_INLINE_VISIBILITY
4357 __is_val_expr<_Expr>::value,
4358 __val_expr<_BinaryOp<greater<typename _Expr::value_type>,
4359 __scalar_expr<typename _Expr::value_type>, _Expr> >
4361 operator>(const typename _Expr::value_type& __x, const _Expr& __y)
4363 typedef typename _Expr::value_type value_type;
4364 typedef _BinaryOp<greater<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4365 return __val_expr<_Op>(_Op(greater<value_type>(),
4366 __scalar_expr<value_type>(__x, __y.size()), __y));
4369 template<class _Expr1, class _Expr2>
4370 inline _LIBCPP_INLINE_VISIBILITY
4373 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4374 __val_expr<_BinaryOp<less_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
4376 operator<=(const _Expr1& __x, const _Expr2& __y)
4378 typedef typename _Expr1::value_type value_type;
4379 typedef _BinaryOp<less_equal<value_type>, _Expr1, _Expr2> _Op;
4380 return __val_expr<_Op>(_Op(less_equal<value_type>(), __x, __y));
4383 template<class _Expr>
4384 inline _LIBCPP_INLINE_VISIBILITY
4387 __is_val_expr<_Expr>::value,
4388 __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
4389 _Expr, __scalar_expr<typename _Expr::value_type> > >
4391 operator<=(const _Expr& __x, const typename _Expr::value_type& __y)
4393 typedef typename _Expr::value_type value_type;
4394 typedef _BinaryOp<less_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4395 return __val_expr<_Op>(_Op(less_equal<value_type>(),
4396 __x, __scalar_expr<value_type>(__y, __x.size())));
4399 template<class _Expr>
4400 inline _LIBCPP_INLINE_VISIBILITY
4403 __is_val_expr<_Expr>::value,
4404 __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
4405 __scalar_expr<typename _Expr::value_type>, _Expr> >
4407 operator<=(const typename _Expr::value_type& __x, const _Expr& __y)
4409 typedef typename _Expr::value_type value_type;
4410 typedef _BinaryOp<less_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4411 return __val_expr<_Op>(_Op(less_equal<value_type>(),
4412 __scalar_expr<value_type>(__x, __y.size()), __y));
4415 template<class _Expr1, class _Expr2>
4416 inline _LIBCPP_INLINE_VISIBILITY
4419 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4420 __val_expr<_BinaryOp<greater_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
4422 operator>=(const _Expr1& __x, const _Expr2& __y)
4424 typedef typename _Expr1::value_type value_type;
4425 typedef _BinaryOp<greater_equal<value_type>, _Expr1, _Expr2> _Op;
4426 return __val_expr<_Op>(_Op(greater_equal<value_type>(), __x, __y));
4429 template<class _Expr>
4430 inline _LIBCPP_INLINE_VISIBILITY
4433 __is_val_expr<_Expr>::value,
4434 __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
4435 _Expr, __scalar_expr<typename _Expr::value_type> > >
4437 operator>=(const _Expr& __x, const typename _Expr::value_type& __y)
4439 typedef typename _Expr::value_type value_type;
4440 typedef _BinaryOp<greater_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4441 return __val_expr<_Op>(_Op(greater_equal<value_type>(),
4442 __x, __scalar_expr<value_type>(__y, __x.size())));
4445 template<class _Expr>
4446 inline _LIBCPP_INLINE_VISIBILITY
4449 __is_val_expr<_Expr>::value,
4450 __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
4451 __scalar_expr<typename _Expr::value_type>, _Expr> >
4453 operator>=(const typename _Expr::value_type& __x, const _Expr& __y)
4455 typedef typename _Expr::value_type value_type;
4456 typedef _BinaryOp<greater_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4457 return __val_expr<_Op>(_Op(greater_equal<value_type>(),
4458 __scalar_expr<value_type>(__x, __y.size()), __y));
4461 template<class _Expr>
4462 inline _LIBCPP_INLINE_VISIBILITY
4465 __is_val_expr<_Expr>::value,
4466 __val_expr<_UnaryOp<__abs_expr<typename _Expr::value_type>, _Expr> >
4468 abs(const _Expr& __x)
4470 typedef typename _Expr::value_type value_type;
4471 typedef _UnaryOp<__abs_expr<value_type>, _Expr> _Op;
4472 return __val_expr<_Op>(_Op(__abs_expr<value_type>(), __x));
4475 template<class _Expr>
4476 inline _LIBCPP_INLINE_VISIBILITY
4479 __is_val_expr<_Expr>::value,
4480 __val_expr<_UnaryOp<__acos_expr<typename _Expr::value_type>, _Expr> >
4482 acos(const _Expr& __x)
4484 typedef typename _Expr::value_type value_type;
4485 typedef _UnaryOp<__acos_expr<value_type>, _Expr> _Op;
4486 return __val_expr<_Op>(_Op(__acos_expr<value_type>(), __x));
4489 template<class _Expr>
4490 inline _LIBCPP_INLINE_VISIBILITY
4493 __is_val_expr<_Expr>::value,
4494 __val_expr<_UnaryOp<__asin_expr<typename _Expr::value_type>, _Expr> >
4496 asin(const _Expr& __x)
4498 typedef typename _Expr::value_type value_type;
4499 typedef _UnaryOp<__asin_expr<value_type>, _Expr> _Op;
4500 return __val_expr<_Op>(_Op(__asin_expr<value_type>(), __x));
4503 template<class _Expr>
4504 inline _LIBCPP_INLINE_VISIBILITY
4507 __is_val_expr<_Expr>::value,
4508 __val_expr<_UnaryOp<__atan_expr<typename _Expr::value_type>, _Expr> >
4510 atan(const _Expr& __x)
4512 typedef typename _Expr::value_type value_type;
4513 typedef _UnaryOp<__atan_expr<value_type>, _Expr> _Op;
4514 return __val_expr<_Op>(_Op(__atan_expr<value_type>(), __x));
4517 template<class _Expr1, class _Expr2>
4518 inline _LIBCPP_INLINE_VISIBILITY
4521 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4522 __val_expr<_BinaryOp<__atan2_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
4524 atan2(const _Expr1& __x, const _Expr2& __y)
4526 typedef typename _Expr1::value_type value_type;
4527 typedef _BinaryOp<__atan2_expr<value_type>, _Expr1, _Expr2> _Op;
4528 return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __x, __y));
4531 template<class _Expr>
4532 inline _LIBCPP_INLINE_VISIBILITY
4535 __is_val_expr<_Expr>::value,
4536 __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
4537 _Expr, __scalar_expr<typename _Expr::value_type> > >
4539 atan2(const _Expr& __x, const typename _Expr::value_type& __y)
4541 typedef typename _Expr::value_type value_type;
4542 typedef _BinaryOp<__atan2_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4543 return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
4544 __x, __scalar_expr<value_type>(__y, __x.size())));
4547 template<class _Expr>
4548 inline _LIBCPP_INLINE_VISIBILITY
4551 __is_val_expr<_Expr>::value,
4552 __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
4553 __scalar_expr<typename _Expr::value_type>, _Expr> >
4555 atan2(const typename _Expr::value_type& __x, const _Expr& __y)
4557 typedef typename _Expr::value_type value_type;
4558 typedef _BinaryOp<__atan2_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4559 return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
4560 __scalar_expr<value_type>(__x, __y.size()), __y));
4563 template<class _Expr>
4564 inline _LIBCPP_INLINE_VISIBILITY
4567 __is_val_expr<_Expr>::value,
4568 __val_expr<_UnaryOp<__cos_expr<typename _Expr::value_type>, _Expr> >
4570 cos(const _Expr& __x)
4572 typedef typename _Expr::value_type value_type;
4573 typedef _UnaryOp<__cos_expr<value_type>, _Expr> _Op;
4574 return __val_expr<_Op>(_Op(__cos_expr<value_type>(), __x));
4577 template<class _Expr>
4578 inline _LIBCPP_INLINE_VISIBILITY
4581 __is_val_expr<_Expr>::value,
4582 __val_expr<_UnaryOp<__cosh_expr<typename _Expr::value_type>, _Expr> >
4584 cosh(const _Expr& __x)
4586 typedef typename _Expr::value_type value_type;
4587 typedef _UnaryOp<__cosh_expr<value_type>, _Expr> _Op;
4588 return __val_expr<_Op>(_Op(__cosh_expr<value_type>(), __x));
4591 template<class _Expr>
4592 inline _LIBCPP_INLINE_VISIBILITY
4595 __is_val_expr<_Expr>::value,
4596 __val_expr<_UnaryOp<__exp_expr<typename _Expr::value_type>, _Expr> >
4598 exp(const _Expr& __x)
4600 typedef typename _Expr::value_type value_type;
4601 typedef _UnaryOp<__exp_expr<value_type>, _Expr> _Op;
4602 return __val_expr<_Op>(_Op(__exp_expr<value_type>(), __x));
4605 template<class _Expr>
4606 inline _LIBCPP_INLINE_VISIBILITY
4609 __is_val_expr<_Expr>::value,
4610 __val_expr<_UnaryOp<__log_expr<typename _Expr::value_type>, _Expr> >
4612 log(const _Expr& __x)
4614 typedef typename _Expr::value_type value_type;
4615 typedef _UnaryOp<__log_expr<value_type>, _Expr> _Op;
4616 return __val_expr<_Op>(_Op(__log_expr<value_type>(), __x));
4619 template<class _Expr>
4620 inline _LIBCPP_INLINE_VISIBILITY
4623 __is_val_expr<_Expr>::value,
4624 __val_expr<_UnaryOp<__log10_expr<typename _Expr::value_type>, _Expr> >
4626 log10(const _Expr& __x)
4628 typedef typename _Expr::value_type value_type;
4629 typedef _UnaryOp<__log10_expr<value_type>, _Expr> _Op;
4630 return __val_expr<_Op>(_Op(__log10_expr<value_type>(), __x));
4633 template<class _Expr1, class _Expr2>
4634 inline _LIBCPP_INLINE_VISIBILITY
4637 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4638 __val_expr<_BinaryOp<__pow_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
4640 pow(const _Expr1& __x, const _Expr2& __y)
4642 typedef typename _Expr1::value_type value_type;
4643 typedef _BinaryOp<__pow_expr<value_type>, _Expr1, _Expr2> _Op;
4644 return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __x, __y));
4647 template<class _Expr>
4648 inline _LIBCPP_INLINE_VISIBILITY
4651 __is_val_expr<_Expr>::value,
4652 __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
4653 _Expr, __scalar_expr<typename _Expr::value_type> > >
4655 pow(const _Expr& __x, const typename _Expr::value_type& __y)
4657 typedef typename _Expr::value_type value_type;
4658 typedef _BinaryOp<__pow_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4659 return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
4660 __x, __scalar_expr<value_type>(__y, __x.size())));
4663 template<class _Expr>
4664 inline _LIBCPP_INLINE_VISIBILITY
4667 __is_val_expr<_Expr>::value,
4668 __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
4669 __scalar_expr<typename _Expr::value_type>, _Expr> >
4671 pow(const typename _Expr::value_type& __x, const _Expr& __y)
4673 typedef typename _Expr::value_type value_type;
4674 typedef _BinaryOp<__pow_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4675 return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
4676 __scalar_expr<value_type>(__x, __y.size()), __y));
4679 template<class _Expr>
4680 inline _LIBCPP_INLINE_VISIBILITY
4683 __is_val_expr<_Expr>::value,
4684 __val_expr<_UnaryOp<__sin_expr<typename _Expr::value_type>, _Expr> >
4686 sin(const _Expr& __x)
4688 typedef typename _Expr::value_type value_type;
4689 typedef _UnaryOp<__sin_expr<value_type>, _Expr> _Op;
4690 return __val_expr<_Op>(_Op(__sin_expr<value_type>(), __x));
4693 template<class _Expr>
4694 inline _LIBCPP_INLINE_VISIBILITY
4697 __is_val_expr<_Expr>::value,
4698 __val_expr<_UnaryOp<__sinh_expr<typename _Expr::value_type>, _Expr> >
4700 sinh(const _Expr& __x)
4702 typedef typename _Expr::value_type value_type;
4703 typedef _UnaryOp<__sinh_expr<value_type>, _Expr> _Op;
4704 return __val_expr<_Op>(_Op(__sinh_expr<value_type>(), __x));
4707 template<class _Expr>
4708 inline _LIBCPP_INLINE_VISIBILITY
4711 __is_val_expr<_Expr>::value,
4712 __val_expr<_UnaryOp<__sqrt_expr<typename _Expr::value_type>, _Expr> >
4714 sqrt(const _Expr& __x)
4716 typedef typename _Expr::value_type value_type;
4717 typedef _UnaryOp<__sqrt_expr<value_type>, _Expr> _Op;
4718 return __val_expr<_Op>(_Op(__sqrt_expr<value_type>(), __x));
4721 template<class _Expr>
4722 inline _LIBCPP_INLINE_VISIBILITY
4725 __is_val_expr<_Expr>::value,
4726 __val_expr<_UnaryOp<__tan_expr<typename _Expr::value_type>, _Expr> >
4728 tan(const _Expr& __x)
4730 typedef typename _Expr::value_type value_type;
4731 typedef _UnaryOp<__tan_expr<value_type>, _Expr> _Op;
4732 return __val_expr<_Op>(_Op(__tan_expr<value_type>(), __x));
4735 template<class _Expr>
4736 inline _LIBCPP_INLINE_VISIBILITY
4739 __is_val_expr<_Expr>::value,
4740 __val_expr<_UnaryOp<__tanh_expr<typename _Expr::value_type>, _Expr> >
4742 tanh(const _Expr& __x)
4744 typedef typename _Expr::value_type value_type;
4745 typedef _UnaryOp<__tanh_expr<value_type>, _Expr> _Op;
4746 return __val_expr<_Op>(_Op(__tanh_expr<value_type>(), __x));
4749 template <class _Tp>
4750 inline _LIBCPP_INLINE_VISIBILITY
4752 begin(valarray<_Tp>& __v)
4754 return __v.__begin_;
4757 template <class _Tp>
4758 inline _LIBCPP_INLINE_VISIBILITY
4760 begin(const valarray<_Tp>& __v)
4762 return __v.__begin_;
4765 template <class _Tp>
4766 inline _LIBCPP_INLINE_VISIBILITY
4768 end(valarray<_Tp>& __v)
4773 template <class _Tp>
4774 inline _LIBCPP_INLINE_VISIBILITY
4776 end(const valarray<_Tp>& __v)
4781 _LIBCPP_END_NAMESPACE_STD
4783 #endif // _LIBCPP_VALARRAY