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>
352 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
353 #pragma GCC system_header
356 _LIBCPP_BEGIN_NAMESPACE_STD
358 template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY valarray;
360 class _LIBCPP_TYPE_VIS_ONLY slice
366 _LIBCPP_INLINE_VISIBILITY
373 _LIBCPP_INLINE_VISIBILITY
374 slice(size_t __start, size_t __size, size_t __stride)
380 _LIBCPP_INLINE_VISIBILITY size_t start() const {return __start_;}
381 _LIBCPP_INLINE_VISIBILITY size_t size() const {return __size_;}
382 _LIBCPP_INLINE_VISIBILITY size_t stride() const {return __stride_;}
385 template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY slice_array;
386 class _LIBCPP_TYPE_VIS gslice;
387 template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY gslice_array;
388 template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY mask_array;
389 template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY indirect_array;
392 _LIBCPP_INLINE_VISIBILITY
394 begin(valarray<_Tp>& __v);
397 _LIBCPP_INLINE_VISIBILITY
399 begin(const valarray<_Tp>& __v);
402 _LIBCPP_INLINE_VISIBILITY
404 end(valarray<_Tp>& __v);
407 _LIBCPP_INLINE_VISIBILITY
409 end(const valarray<_Tp>& __v);
411 template <class _Op, class _A0>
414 typedef typename _Op::result_type result_type;
415 typedef typename _A0::value_type value_type;
420 _LIBCPP_INLINE_VISIBILITY
421 _UnaryOp(const _Op& __op, const _A0& __a0) : __op_(__op), __a0_(__a0) {}
423 _LIBCPP_INLINE_VISIBILITY
424 result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
426 _LIBCPP_INLINE_VISIBILITY
427 size_t size() const {return __a0_.size();}
430 template <class _Op, class _A0, class _A1>
433 typedef typename _Op::result_type result_type;
434 typedef typename _A0::value_type value_type;
440 _LIBCPP_INLINE_VISIBILITY
441 _BinaryOp(const _Op& __op, const _A0& __a0, const _A1& __a1)
442 : __op_(__op), __a0_(__a0), __a1_(__a1) {}
444 _LIBCPP_INLINE_VISIBILITY
445 value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
447 _LIBCPP_INLINE_VISIBILITY
448 size_t size() const {return __a0_.size();}
455 typedef _Tp value_type;
456 typedef const _Tp& result_type;
458 const value_type& __t_;
461 _LIBCPP_INLINE_VISIBILITY
462 explicit __scalar_expr(const value_type& __t, size_t __s) : __t_(__t), __s_(__s) {}
464 _LIBCPP_INLINE_VISIBILITY
465 result_type operator[](size_t) const {return __t_;}
467 _LIBCPP_INLINE_VISIBILITY
468 size_t size() const {return __s_;}
472 struct __unary_plus : unary_function<_Tp, _Tp>
474 _LIBCPP_INLINE_VISIBILITY
475 _Tp operator()(const _Tp& __x) const
480 struct __bit_not : unary_function<_Tp, _Tp>
482 _LIBCPP_INLINE_VISIBILITY
483 _Tp operator()(const _Tp& __x) const
488 struct __bit_shift_left : binary_function<_Tp, _Tp, _Tp>
490 _LIBCPP_INLINE_VISIBILITY
491 _Tp operator()(const _Tp& __x, const _Tp& __y) const
496 struct __bit_shift_right : binary_function<_Tp, _Tp, _Tp>
498 _LIBCPP_INLINE_VISIBILITY
499 _Tp operator()(const _Tp& __x, const _Tp& __y) const
503 template <class _Tp, class _Fp>
504 struct __apply_expr : unary_function<_Tp, _Tp>
509 _LIBCPP_INLINE_VISIBILITY
510 explicit __apply_expr(_Fp __f) : __f_(__f) {}
512 _LIBCPP_INLINE_VISIBILITY
513 _Tp operator()(const _Tp& __x) const
518 struct __abs_expr : unary_function<_Tp, _Tp>
520 _LIBCPP_INLINE_VISIBILITY
521 _Tp operator()(const _Tp& __x) const
526 struct __acos_expr : unary_function<_Tp, _Tp>
528 _LIBCPP_INLINE_VISIBILITY
529 _Tp operator()(const _Tp& __x) const
534 struct __asin_expr : unary_function<_Tp, _Tp>
536 _LIBCPP_INLINE_VISIBILITY
537 _Tp operator()(const _Tp& __x) const
542 struct __atan_expr : unary_function<_Tp, _Tp>
544 _LIBCPP_INLINE_VISIBILITY
545 _Tp operator()(const _Tp& __x) const
550 struct __atan2_expr : binary_function<_Tp, _Tp, _Tp>
552 _LIBCPP_INLINE_VISIBILITY
553 _Tp operator()(const _Tp& __x, const _Tp& __y) const
554 {return atan2(__x, __y);}
558 struct __cos_expr : unary_function<_Tp, _Tp>
560 _LIBCPP_INLINE_VISIBILITY
561 _Tp operator()(const _Tp& __x) const
566 struct __cosh_expr : unary_function<_Tp, _Tp>
568 _LIBCPP_INLINE_VISIBILITY
569 _Tp operator()(const _Tp& __x) const
574 struct __exp_expr : unary_function<_Tp, _Tp>
576 _LIBCPP_INLINE_VISIBILITY
577 _Tp operator()(const _Tp& __x) const
582 struct __log_expr : unary_function<_Tp, _Tp>
584 _LIBCPP_INLINE_VISIBILITY
585 _Tp operator()(const _Tp& __x) const
590 struct __log10_expr : unary_function<_Tp, _Tp>
592 _LIBCPP_INLINE_VISIBILITY
593 _Tp operator()(const _Tp& __x) const
598 struct __pow_expr : binary_function<_Tp, _Tp, _Tp>
600 _LIBCPP_INLINE_VISIBILITY
601 _Tp operator()(const _Tp& __x, const _Tp& __y) const
602 {return pow(__x, __y);}
606 struct __sin_expr : unary_function<_Tp, _Tp>
608 _LIBCPP_INLINE_VISIBILITY
609 _Tp operator()(const _Tp& __x) const
614 struct __sinh_expr : unary_function<_Tp, _Tp>
616 _LIBCPP_INLINE_VISIBILITY
617 _Tp operator()(const _Tp& __x) const
622 struct __sqrt_expr : unary_function<_Tp, _Tp>
624 _LIBCPP_INLINE_VISIBILITY
625 _Tp operator()(const _Tp& __x) const
630 struct __tan_expr : unary_function<_Tp, _Tp>
632 _LIBCPP_INLINE_VISIBILITY
633 _Tp operator()(const _Tp& __x) const
638 struct __tanh_expr : unary_function<_Tp, _Tp>
640 _LIBCPP_INLINE_VISIBILITY
641 _Tp operator()(const _Tp& __x) const
645 template <class _ValExpr>
648 typedef typename remove_reference<_ValExpr>::type _RmExpr;
650 typedef typename _RmExpr::value_type value_type;
651 typedef value_type result_type;
659 _LIBCPP_INLINE_VISIBILITY
660 __slice_expr(const slice& __sl, const _RmExpr& __e)
662 __start_(__sl.start()),
663 __size_(__sl.size()),
664 __stride_(__sl.stride())
668 _LIBCPP_INLINE_VISIBILITY
669 result_type operator[](size_t __i) const
670 {return __expr_[__start_ + __i * __stride_];}
672 _LIBCPP_INLINE_VISIBILITY
673 size_t size() const {return __size_;}
675 template <class> friend class _LIBCPP_TYPE_VIS_ONLY valarray;
678 template <class _ValExpr>
681 template <class _ValExpr>
682 class __indirect_expr;
684 template <class _ValExpr>
687 typedef typename remove_reference<_ValExpr>::type _RmExpr;
689 typedef typename _RmExpr::value_type value_type;
690 typedef value_type result_type;
698 static const ptrdiff_t _Np = static_cast<ptrdiff_t>(
699 sizeof(ptrdiff_t) * __CHAR_BIT__ - 1);
701 _LIBCPP_INLINE_VISIBILITY
702 __shift_expr(int __n, const _RmExpr& __e)
707 ptrdiff_t __neg_n = static_cast<ptrdiff_t>(__n_ >> _Np);
708 __sn_ = __neg_n | static_cast<ptrdiff_t>(static_cast<size_t>(-__n_) >> _Np);
709 __ul_ = ((__size_ - __n_) & ~__neg_n) | ((__n_ + 1) & __neg_n);
713 _LIBCPP_INLINE_VISIBILITY
714 result_type operator[](size_t __j) const
716 ptrdiff_t __i = static_cast<ptrdiff_t>(__j);
717 ptrdiff_t __m = (__sn_ * __i - __ul_) >> _Np;
718 return (__expr_[(__i + __n_) & __m] & __m) | (value_type() & ~__m);
721 _LIBCPP_INLINE_VISIBILITY
722 size_t size() const {return __size_;}
724 template <class> friend class __val_expr;
727 template <class _ValExpr>
730 typedef typename remove_reference<_ValExpr>::type _RmExpr;
732 typedef typename _RmExpr::value_type value_type;
733 typedef value_type result_type;
742 _LIBCPP_INLINE_VISIBILITY
743 __cshift_expr(int __n, const _RmExpr& __e)
747 __n %= static_cast<int>(__size_);
750 __m_ = __size_ - __n;
752 __o2_ = __n - __size_;
757 __o1_ = __n + __size_;
763 _LIBCPP_INLINE_VISIBILITY
764 result_type operator[](size_t __i) const
767 return __expr_[__i + __o1_];
768 return __expr_[__i + __o2_];
771 _LIBCPP_INLINE_VISIBILITY
772 size_t size() const {return __size_;}
774 template <class> friend class __val_expr;
777 template<class _ValExpr>
780 template<class _ValExpr>
781 struct __is_val_expr : false_type {};
783 template<class _ValExpr>
784 struct __is_val_expr<__val_expr<_ValExpr> > : true_type {};
787 struct __is_val_expr<valarray<_Tp> > : true_type {};
790 class _LIBCPP_TYPE_VIS_ONLY valarray
793 typedef _Tp value_type;
794 typedef _Tp result_type;
797 value_type* __begin_;
801 // construct/destroy:
802 _LIBCPP_INLINE_VISIBILITY
803 valarray() : __begin_(0), __end_(0) {}
804 explicit valarray(size_t __n);
805 valarray(const value_type& __x, size_t __n);
806 valarray(const value_type* __p, size_t __n);
807 valarray(const valarray& __v);
808 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
809 valarray(valarray&& __v) _NOEXCEPT;
810 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
811 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
812 valarray(initializer_list<value_type> __il);
813 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
814 valarray(const slice_array<value_type>& __sa);
815 valarray(const gslice_array<value_type>& __ga);
816 valarray(const mask_array<value_type>& __ma);
817 valarray(const indirect_array<value_type>& __ia);
821 valarray& operator=(const valarray& __v);
822 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
823 valarray& operator=(valarray&& __v) _NOEXCEPT;
824 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
825 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
826 valarray& operator=(initializer_list<value_type>);
827 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
828 valarray& operator=(const value_type& __x);
829 valarray& operator=(const slice_array<value_type>& __sa);
830 valarray& operator=(const gslice_array<value_type>& __ga);
831 valarray& operator=(const mask_array<value_type>& __ma);
832 valarray& operator=(const indirect_array<value_type>& __ia);
833 template <class _ValExpr>
834 valarray& operator=(const __val_expr<_ValExpr>& __v);
837 _LIBCPP_INLINE_VISIBILITY
838 const value_type& operator[](size_t __i) const {return __begin_[__i];}
840 _LIBCPP_INLINE_VISIBILITY
841 value_type& operator[](size_t __i) {return __begin_[__i];}
843 // subset operations:
844 __val_expr<__slice_expr<const valarray&> > operator[](slice __s) const;
845 slice_array<value_type> operator[](slice __s);
846 __val_expr<__indirect_expr<const valarray&> > operator[](const gslice& __gs) const;
847 gslice_array<value_type> operator[](const gslice& __gs);
848 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
849 __val_expr<__indirect_expr<const valarray&> > operator[](gslice&& __gs) const;
850 gslice_array<value_type> operator[](gslice&& __gs);
851 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
852 __val_expr<__mask_expr<const valarray&> > operator[](const valarray<bool>& __vb) const;
853 mask_array<value_type> operator[](const valarray<bool>& __vb);
854 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
855 __val_expr<__mask_expr<const valarray&> > operator[](valarray<bool>&& __vb) const;
856 mask_array<value_type> operator[](valarray<bool>&& __vb);
857 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
858 __val_expr<__indirect_expr<const valarray&> > operator[](const valarray<size_t>& __vs) const;
859 indirect_array<value_type> operator[](const valarray<size_t>& __vs);
860 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
861 __val_expr<__indirect_expr<const valarray&> > operator[](valarray<size_t>&& __vs) const;
862 indirect_array<value_type> operator[](valarray<size_t>&& __vs);
863 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
866 valarray operator+() const;
867 valarray operator-() const;
868 valarray operator~() const;
869 valarray<bool> operator!() const;
871 // computed assignment:
872 valarray& operator*= (const value_type& __x);
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);
883 template <class _Expr>
886 __is_val_expr<_Expr>::value,
889 operator*= (const _Expr& __v);
891 template <class _Expr>
894 __is_val_expr<_Expr>::value,
897 operator/= (const _Expr& __v);
899 template <class _Expr>
902 __is_val_expr<_Expr>::value,
905 operator%= (const _Expr& __v);
907 template <class _Expr>
910 __is_val_expr<_Expr>::value,
913 operator+= (const _Expr& __v);
915 template <class _Expr>
918 __is_val_expr<_Expr>::value,
921 operator-= (const _Expr& __v);
923 template <class _Expr>
926 __is_val_expr<_Expr>::value,
929 operator^= (const _Expr& __v);
931 template <class _Expr>
934 __is_val_expr<_Expr>::value,
937 operator|= (const _Expr& __v);
939 template <class _Expr>
942 __is_val_expr<_Expr>::value,
945 operator&= (const _Expr& __v);
947 template <class _Expr>
950 __is_val_expr<_Expr>::value,
953 operator<<= (const _Expr& __v);
955 template <class _Expr>
958 __is_val_expr<_Expr>::value,
961 operator>>= (const _Expr& __v);
964 void swap(valarray& __v) _NOEXCEPT;
966 _LIBCPP_INLINE_VISIBILITY
967 size_t size() const {return static_cast<size_t>(__end_ - __begin_);}
969 value_type sum() const;
970 value_type min() const;
971 value_type max() const;
973 valarray shift (int __i) const;
974 valarray cshift(int __i) const;
975 valarray apply(value_type __f(value_type)) const;
976 valarray apply(value_type __f(const value_type&)) const;
977 void resize(size_t __n, value_type __x = value_type());
980 template <class> friend class _LIBCPP_TYPE_VIS_ONLY valarray;
981 template <class> friend class _LIBCPP_TYPE_VIS_ONLY slice_array;
982 template <class> friend class _LIBCPP_TYPE_VIS_ONLY gslice_array;
983 template <class> friend class _LIBCPP_TYPE_VIS_ONLY mask_array;
984 template <class> friend class __mask_expr;
985 template <class> friend class _LIBCPP_TYPE_VIS_ONLY indirect_array;
986 template <class> friend class __indirect_expr;
987 template <class> friend class __val_expr;
992 begin(valarray<_Up>& __v);
997 begin(const valarray<_Up>& __v);
1002 end(valarray<_Up>& __v);
1004 template <class _Up>
1007 end(const valarray<_Up>& __v);
1010 _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::valarray(size_t))
1011 _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::~valarray())
1012 _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void valarray<size_t>::resize(size_t, size_t))
1014 template <class _Op, class _Tp>
1015 struct _UnaryOp<_Op, valarray<_Tp> >
1017 typedef typename _Op::result_type result_type;
1018 typedef _Tp value_type;
1021 const valarray<_Tp>& __a0_;
1023 _LIBCPP_INLINE_VISIBILITY
1024 _UnaryOp(const _Op& __op, const valarray<_Tp>& __a0) : __op_(__op), __a0_(__a0) {}
1026 _LIBCPP_INLINE_VISIBILITY
1027 result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
1029 _LIBCPP_INLINE_VISIBILITY
1030 size_t size() const {return __a0_.size();}
1033 template <class _Op, class _Tp, class _A1>
1034 struct _BinaryOp<_Op, valarray<_Tp>, _A1>
1036 typedef typename _Op::result_type result_type;
1037 typedef _Tp value_type;
1040 const valarray<_Tp>& __a0_;
1043 _LIBCPP_INLINE_VISIBILITY
1044 _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const _A1& __a1)
1045 : __op_(__op), __a0_(__a0), __a1_(__a1) {}
1047 _LIBCPP_INLINE_VISIBILITY
1048 value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
1050 _LIBCPP_INLINE_VISIBILITY
1051 size_t size() const {return __a0_.size();}
1054 template <class _Op, class _A0, class _Tp>
1055 struct _BinaryOp<_Op, _A0, valarray<_Tp> >
1057 typedef typename _Op::result_type result_type;
1058 typedef _Tp value_type;
1062 const valarray<_Tp>& __a1_;
1064 _LIBCPP_INLINE_VISIBILITY
1065 _BinaryOp(const _Op& __op, const _A0& __a0, const valarray<_Tp>& __a1)
1066 : __op_(__op), __a0_(__a0), __a1_(__a1) {}
1068 _LIBCPP_INLINE_VISIBILITY
1069 value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
1071 _LIBCPP_INLINE_VISIBILITY
1072 size_t size() const {return __a0_.size();}
1075 template <class _Op, class _Tp>
1076 struct _BinaryOp<_Op, valarray<_Tp>, valarray<_Tp> >
1078 typedef typename _Op::result_type result_type;
1079 typedef _Tp value_type;
1082 const valarray<_Tp>& __a0_;
1083 const valarray<_Tp>& __a1_;
1085 _LIBCPP_INLINE_VISIBILITY
1086 _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const valarray<_Tp>& __a1)
1087 : __op_(__op), __a0_(__a0), __a1_(__a1) {}
1089 _LIBCPP_INLINE_VISIBILITY
1090 value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
1092 _LIBCPP_INLINE_VISIBILITY
1093 size_t size() const {return __a0_.size();}
1098 template <class _Tp>
1099 class _LIBCPP_TYPE_VIS_ONLY slice_array
1102 typedef _Tp value_type;
1110 template <class _Expr>
1113 __is_val_expr<_Expr>::value,
1116 operator=(const _Expr& __v) const;
1118 template <class _Expr>
1121 __is_val_expr<_Expr>::value,
1124 operator*=(const _Expr& __v) const;
1126 template <class _Expr>
1129 __is_val_expr<_Expr>::value,
1132 operator/=(const _Expr& __v) const;
1134 template <class _Expr>
1137 __is_val_expr<_Expr>::value,
1140 operator%=(const _Expr& __v) const;
1142 template <class _Expr>
1145 __is_val_expr<_Expr>::value,
1148 operator+=(const _Expr& __v) const;
1150 template <class _Expr>
1153 __is_val_expr<_Expr>::value,
1156 operator-=(const _Expr& __v) const;
1158 template <class _Expr>
1161 __is_val_expr<_Expr>::value,
1164 operator^=(const _Expr& __v) const;
1166 template <class _Expr>
1169 __is_val_expr<_Expr>::value,
1172 operator&=(const _Expr& __v) const;
1174 template <class _Expr>
1177 __is_val_expr<_Expr>::value,
1180 operator|=(const _Expr& __v) const;
1182 template <class _Expr>
1185 __is_val_expr<_Expr>::value,
1188 operator<<=(const _Expr& __v) const;
1190 template <class _Expr>
1193 __is_val_expr<_Expr>::value,
1196 operator>>=(const _Expr& __v) const;
1198 const slice_array& operator=(const slice_array& __sa) const;
1200 void operator=(const value_type& __x) const;
1203 _LIBCPP_INLINE_VISIBILITY
1204 slice_array(const slice& __sl, const valarray<value_type>& __v)
1205 : __vp_(const_cast<value_type*>(__v.__begin_ + __sl.start())),
1206 __size_(__sl.size()),
1207 __stride_(__sl.stride())
1210 template <class> friend class valarray;
1211 template <class> friend class sliceExpr;
1214 template <class _Tp>
1215 inline _LIBCPP_INLINE_VISIBILITY
1216 const slice_array<_Tp>&
1217 slice_array<_Tp>::operator=(const slice_array& __sa) const
1219 value_type* __t = __vp_;
1220 const value_type* __s = __sa.__vp_;
1221 for (size_t __n = __size_; __n; --__n, __t += __stride_, __s += __sa.__stride_)
1226 template <class _Tp>
1227 template <class _Expr>
1228 inline _LIBCPP_INLINE_VISIBILITY
1231 __is_val_expr<_Expr>::value,
1234 slice_array<_Tp>::operator=(const _Expr& __v) const
1236 value_type* __t = __vp_;
1237 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1241 template <class _Tp>
1242 template <class _Expr>
1243 inline _LIBCPP_INLINE_VISIBILITY
1246 __is_val_expr<_Expr>::value,
1249 slice_array<_Tp>::operator*=(const _Expr& __v) const
1251 value_type* __t = __vp_;
1252 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1256 template <class _Tp>
1257 template <class _Expr>
1258 inline _LIBCPP_INLINE_VISIBILITY
1261 __is_val_expr<_Expr>::value,
1264 slice_array<_Tp>::operator/=(const _Expr& __v) const
1266 value_type* __t = __vp_;
1267 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1271 template <class _Tp>
1272 template <class _Expr>
1273 inline _LIBCPP_INLINE_VISIBILITY
1276 __is_val_expr<_Expr>::value,
1279 slice_array<_Tp>::operator%=(const _Expr& __v) const
1281 value_type* __t = __vp_;
1282 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1286 template <class _Tp>
1287 template <class _Expr>
1288 inline _LIBCPP_INLINE_VISIBILITY
1291 __is_val_expr<_Expr>::value,
1294 slice_array<_Tp>::operator+=(const _Expr& __v) const
1296 value_type* __t = __vp_;
1297 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1301 template <class _Tp>
1302 template <class _Expr>
1303 inline _LIBCPP_INLINE_VISIBILITY
1306 __is_val_expr<_Expr>::value,
1309 slice_array<_Tp>::operator-=(const _Expr& __v) const
1311 value_type* __t = __vp_;
1312 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1316 template <class _Tp>
1317 template <class _Expr>
1318 inline _LIBCPP_INLINE_VISIBILITY
1321 __is_val_expr<_Expr>::value,
1324 slice_array<_Tp>::operator^=(const _Expr& __v) const
1326 value_type* __t = __vp_;
1327 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1331 template <class _Tp>
1332 template <class _Expr>
1333 inline _LIBCPP_INLINE_VISIBILITY
1336 __is_val_expr<_Expr>::value,
1339 slice_array<_Tp>::operator&=(const _Expr& __v) const
1341 value_type* __t = __vp_;
1342 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1346 template <class _Tp>
1347 template <class _Expr>
1348 inline _LIBCPP_INLINE_VISIBILITY
1351 __is_val_expr<_Expr>::value,
1354 slice_array<_Tp>::operator|=(const _Expr& __v) const
1356 value_type* __t = __vp_;
1357 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1361 template <class _Tp>
1362 template <class _Expr>
1363 inline _LIBCPP_INLINE_VISIBILITY
1366 __is_val_expr<_Expr>::value,
1369 slice_array<_Tp>::operator<<=(const _Expr& __v) const
1371 value_type* __t = __vp_;
1372 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1376 template <class _Tp>
1377 template <class _Expr>
1378 inline _LIBCPP_INLINE_VISIBILITY
1381 __is_val_expr<_Expr>::value,
1384 slice_array<_Tp>::operator>>=(const _Expr& __v) const
1386 value_type* __t = __vp_;
1387 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1391 template <class _Tp>
1392 inline _LIBCPP_INLINE_VISIBILITY
1394 slice_array<_Tp>::operator=(const value_type& __x) const
1396 value_type* __t = __vp_;
1397 for (size_t __n = __size_; __n; --__n, __t += __stride_)
1403 class _LIBCPP_TYPE_VIS gslice
1405 valarray<size_t> __size_;
1406 valarray<size_t> __stride_;
1407 valarray<size_t> __1d_;
1410 _LIBCPP_INLINE_VISIBILITY
1413 _LIBCPP_INLINE_VISIBILITY
1414 gslice(size_t __start, const valarray<size_t>& __size,
1415 const valarray<size_t>& __stride)
1420 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1422 _LIBCPP_INLINE_VISIBILITY
1423 gslice(size_t __start, const valarray<size_t>& __size,
1424 valarray<size_t>&& __stride)
1426 __stride_(move(__stride))
1429 _LIBCPP_INLINE_VISIBILITY
1430 gslice(size_t __start, valarray<size_t>&& __size,
1431 const valarray<size_t>& __stride)
1432 : __size_(move(__size)),
1436 _LIBCPP_INLINE_VISIBILITY
1437 gslice(size_t __start, valarray<size_t>&& __size,
1438 valarray<size_t>&& __stride)
1439 : __size_(move(__size)),
1440 __stride_(move(__stride))
1443 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1445 // gslice(const gslice&) = default;
1446 // gslice(gslice&&) = default;
1447 // gslice& operator=(const gslice&) = default;
1448 // gslice& operator=(gslice&&) = default;
1450 _LIBCPP_INLINE_VISIBILITY
1451 size_t start() const {return __1d_.size() ? __1d_[0] : 0;}
1453 _LIBCPP_INLINE_VISIBILITY
1454 valarray<size_t> size() const {return __size_;}
1456 _LIBCPP_INLINE_VISIBILITY
1457 valarray<size_t> stride() const {return __stride_;}
1460 void __init(size_t __start);
1462 template <class> friend class gslice_array;
1463 template <class> friend class valarray;
1464 template <class> friend class __val_expr;
1469 template <class _Tp>
1470 class _LIBCPP_TYPE_VIS_ONLY gslice_array
1473 typedef _Tp value_type;
1477 valarray<size_t> __1d_;
1480 template <class _Expr>
1483 __is_val_expr<_Expr>::value,
1486 operator=(const _Expr& __v) const;
1488 template <class _Expr>
1491 __is_val_expr<_Expr>::value,
1494 operator*=(const _Expr& __v) const;
1496 template <class _Expr>
1499 __is_val_expr<_Expr>::value,
1502 operator/=(const _Expr& __v) const;
1504 template <class _Expr>
1507 __is_val_expr<_Expr>::value,
1510 operator%=(const _Expr& __v) const;
1512 template <class _Expr>
1515 __is_val_expr<_Expr>::value,
1518 operator+=(const _Expr& __v) const;
1520 template <class _Expr>
1523 __is_val_expr<_Expr>::value,
1526 operator-=(const _Expr& __v) const;
1528 template <class _Expr>
1531 __is_val_expr<_Expr>::value,
1534 operator^=(const _Expr& __v) const;
1536 template <class _Expr>
1539 __is_val_expr<_Expr>::value,
1542 operator&=(const _Expr& __v) const;
1544 template <class _Expr>
1547 __is_val_expr<_Expr>::value,
1550 operator|=(const _Expr& __v) const;
1552 template <class _Expr>
1555 __is_val_expr<_Expr>::value,
1558 operator<<=(const _Expr& __v) const;
1560 template <class _Expr>
1563 __is_val_expr<_Expr>::value,
1566 operator>>=(const _Expr& __v) const;
1568 const gslice_array& operator=(const gslice_array& __ga) const;
1570 void operator=(const value_type& __x) const;
1572 // gslice_array(const gslice_array&) = default;
1573 // gslice_array(gslice_array&&) = default;
1574 // gslice_array& operator=(const gslice_array&) = default;
1575 // gslice_array& operator=(gslice_array&&) = default;
1578 _LIBCPP_INLINE_VISIBILITY
1579 gslice_array(const gslice& __gs, const valarray<value_type>& __v)
1580 : __vp_(const_cast<value_type*>(__v.__begin_)),
1584 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1586 _LIBCPP_INLINE_VISIBILITY
1587 gslice_array(gslice&& __gs, const valarray<value_type>& __v)
1588 : __vp_(const_cast<value_type*>(__v.__begin_)),
1589 __1d_(move(__gs.__1d_))
1592 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1594 template <class> friend class valarray;
1597 template <class _Tp>
1598 template <class _Expr>
1599 inline _LIBCPP_INLINE_VISIBILITY
1602 __is_val_expr<_Expr>::value,
1605 gslice_array<_Tp>::operator=(const _Expr& __v) const
1607 typedef const size_t* _Ip;
1609 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1610 __vp_[*__i] = __v[__j];
1613 template <class _Tp>
1614 template <class _Expr>
1615 inline _LIBCPP_INLINE_VISIBILITY
1618 __is_val_expr<_Expr>::value,
1621 gslice_array<_Tp>::operator*=(const _Expr& __v) const
1623 typedef const size_t* _Ip;
1625 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1626 __vp_[*__i] *= __v[__j];
1629 template <class _Tp>
1630 template <class _Expr>
1631 inline _LIBCPP_INLINE_VISIBILITY
1634 __is_val_expr<_Expr>::value,
1637 gslice_array<_Tp>::operator/=(const _Expr& __v) const
1639 typedef const size_t* _Ip;
1641 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1642 __vp_[*__i] /= __v[__j];
1645 template <class _Tp>
1646 template <class _Expr>
1647 inline _LIBCPP_INLINE_VISIBILITY
1650 __is_val_expr<_Expr>::value,
1653 gslice_array<_Tp>::operator%=(const _Expr& __v) const
1655 typedef const size_t* _Ip;
1657 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1658 __vp_[*__i] %= __v[__j];
1661 template <class _Tp>
1662 template <class _Expr>
1663 inline _LIBCPP_INLINE_VISIBILITY
1666 __is_val_expr<_Expr>::value,
1669 gslice_array<_Tp>::operator+=(const _Expr& __v) const
1671 typedef const size_t* _Ip;
1673 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1674 __vp_[*__i] += __v[__j];
1677 template <class _Tp>
1678 template <class _Expr>
1679 inline _LIBCPP_INLINE_VISIBILITY
1682 __is_val_expr<_Expr>::value,
1685 gslice_array<_Tp>::operator-=(const _Expr& __v) const
1687 typedef const size_t* _Ip;
1689 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1690 __vp_[*__i] -= __v[__j];
1693 template <class _Tp>
1694 template <class _Expr>
1695 inline _LIBCPP_INLINE_VISIBILITY
1698 __is_val_expr<_Expr>::value,
1701 gslice_array<_Tp>::operator^=(const _Expr& __v) const
1703 typedef const size_t* _Ip;
1705 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1706 __vp_[*__i] ^= __v[__j];
1709 template <class _Tp>
1710 template <class _Expr>
1711 inline _LIBCPP_INLINE_VISIBILITY
1714 __is_val_expr<_Expr>::value,
1717 gslice_array<_Tp>::operator&=(const _Expr& __v) const
1719 typedef const size_t* _Ip;
1721 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1722 __vp_[*__i] &= __v[__j];
1725 template <class _Tp>
1726 template <class _Expr>
1727 inline _LIBCPP_INLINE_VISIBILITY
1730 __is_val_expr<_Expr>::value,
1733 gslice_array<_Tp>::operator|=(const _Expr& __v) const
1735 typedef const size_t* _Ip;
1737 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1738 __vp_[*__i] |= __v[__j];
1741 template <class _Tp>
1742 template <class _Expr>
1743 inline _LIBCPP_INLINE_VISIBILITY
1746 __is_val_expr<_Expr>::value,
1749 gslice_array<_Tp>::operator<<=(const _Expr& __v) const
1751 typedef const size_t* _Ip;
1753 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1754 __vp_[*__i] <<= __v[__j];
1757 template <class _Tp>
1758 template <class _Expr>
1759 inline _LIBCPP_INLINE_VISIBILITY
1762 __is_val_expr<_Expr>::value,
1765 gslice_array<_Tp>::operator>>=(const _Expr& __v) const
1767 typedef const size_t* _Ip;
1769 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1770 __vp_[*__i] >>= __v[__j];
1773 template <class _Tp>
1774 inline _LIBCPP_INLINE_VISIBILITY
1775 const gslice_array<_Tp>&
1776 gslice_array<_Tp>::operator=(const gslice_array& __ga) const
1778 typedef const size_t* _Ip;
1779 const value_type* __s = __ga.__vp_;
1780 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ga.__1d_.__begin_;
1781 __i != __e; ++__i, ++__j)
1782 __vp_[*__i] = __s[*__j];
1786 template <class _Tp>
1787 inline _LIBCPP_INLINE_VISIBILITY
1789 gslice_array<_Tp>::operator=(const value_type& __x) const
1791 typedef const size_t* _Ip;
1792 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
1798 template <class _Tp>
1799 class _LIBCPP_TYPE_VIS_ONLY mask_array
1802 typedef _Tp value_type;
1806 valarray<size_t> __1d_;
1809 template <class _Expr>
1812 __is_val_expr<_Expr>::value,
1815 operator=(const _Expr& __v) const;
1817 template <class _Expr>
1820 __is_val_expr<_Expr>::value,
1823 operator*=(const _Expr& __v) const;
1825 template <class _Expr>
1828 __is_val_expr<_Expr>::value,
1831 operator/=(const _Expr& __v) const;
1833 template <class _Expr>
1836 __is_val_expr<_Expr>::value,
1839 operator%=(const _Expr& __v) const;
1841 template <class _Expr>
1844 __is_val_expr<_Expr>::value,
1847 operator+=(const _Expr& __v) const;
1849 template <class _Expr>
1852 __is_val_expr<_Expr>::value,
1855 operator-=(const _Expr& __v) const;
1857 template <class _Expr>
1860 __is_val_expr<_Expr>::value,
1863 operator^=(const _Expr& __v) const;
1865 template <class _Expr>
1868 __is_val_expr<_Expr>::value,
1871 operator&=(const _Expr& __v) const;
1873 template <class _Expr>
1876 __is_val_expr<_Expr>::value,
1879 operator|=(const _Expr& __v) const;
1881 template <class _Expr>
1884 __is_val_expr<_Expr>::value,
1887 operator<<=(const _Expr& __v) const;
1889 template <class _Expr>
1892 __is_val_expr<_Expr>::value,
1895 operator>>=(const _Expr& __v) const;
1897 const mask_array& operator=(const mask_array& __ma) const;
1899 void operator=(const value_type& __x) const;
1901 // mask_array(const mask_array&) = default;
1902 // mask_array(mask_array&&) = default;
1903 // mask_array& operator=(const mask_array&) = default;
1904 // mask_array& operator=(mask_array&&) = default;
1907 _LIBCPP_INLINE_VISIBILITY
1908 mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v)
1909 : __vp_(const_cast<value_type*>(__v.__begin_)),
1910 __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
1913 for (size_t __i = 0; __i < __vb.size(); ++__i)
1918 template <class> friend class valarray;
1921 template <class _Tp>
1922 template <class _Expr>
1923 inline _LIBCPP_INLINE_VISIBILITY
1926 __is_val_expr<_Expr>::value,
1929 mask_array<_Tp>::operator=(const _Expr& __v) const
1931 size_t __n = __1d_.size();
1932 for (size_t __i = 0; __i < __n; ++__i)
1933 __vp_[__1d_[__i]] = __v[__i];
1936 template <class _Tp>
1937 template <class _Expr>
1938 inline _LIBCPP_INLINE_VISIBILITY
1941 __is_val_expr<_Expr>::value,
1944 mask_array<_Tp>::operator*=(const _Expr& __v) const
1946 size_t __n = __1d_.size();
1947 for (size_t __i = 0; __i < __n; ++__i)
1948 __vp_[__1d_[__i]] *= __v[__i];
1951 template <class _Tp>
1952 template <class _Expr>
1953 inline _LIBCPP_INLINE_VISIBILITY
1956 __is_val_expr<_Expr>::value,
1959 mask_array<_Tp>::operator/=(const _Expr& __v) const
1961 size_t __n = __1d_.size();
1962 for (size_t __i = 0; __i < __n; ++__i)
1963 __vp_[__1d_[__i]] /= __v[__i];
1966 template <class _Tp>
1967 template <class _Expr>
1968 inline _LIBCPP_INLINE_VISIBILITY
1971 __is_val_expr<_Expr>::value,
1974 mask_array<_Tp>::operator%=(const _Expr& __v) const
1976 size_t __n = __1d_.size();
1977 for (size_t __i = 0; __i < __n; ++__i)
1978 __vp_[__1d_[__i]] %= __v[__i];
1981 template <class _Tp>
1982 template <class _Expr>
1983 inline _LIBCPP_INLINE_VISIBILITY
1986 __is_val_expr<_Expr>::value,
1989 mask_array<_Tp>::operator+=(const _Expr& __v) const
1991 size_t __n = __1d_.size();
1992 for (size_t __i = 0; __i < __n; ++__i)
1993 __vp_[__1d_[__i]] += __v[__i];
1996 template <class _Tp>
1997 template <class _Expr>
1998 inline _LIBCPP_INLINE_VISIBILITY
2001 __is_val_expr<_Expr>::value,
2004 mask_array<_Tp>::operator-=(const _Expr& __v) const
2006 size_t __n = __1d_.size();
2007 for (size_t __i = 0; __i < __n; ++__i)
2008 __vp_[__1d_[__i]] -= __v[__i];
2011 template <class _Tp>
2012 template <class _Expr>
2013 inline _LIBCPP_INLINE_VISIBILITY
2016 __is_val_expr<_Expr>::value,
2019 mask_array<_Tp>::operator^=(const _Expr& __v) const
2021 size_t __n = __1d_.size();
2022 for (size_t __i = 0; __i < __n; ++__i)
2023 __vp_[__1d_[__i]] ^= __v[__i];
2026 template <class _Tp>
2027 template <class _Expr>
2028 inline _LIBCPP_INLINE_VISIBILITY
2031 __is_val_expr<_Expr>::value,
2034 mask_array<_Tp>::operator&=(const _Expr& __v) const
2036 size_t __n = __1d_.size();
2037 for (size_t __i = 0; __i < __n; ++__i)
2038 __vp_[__1d_[__i]] &= __v[__i];
2041 template <class _Tp>
2042 template <class _Expr>
2043 inline _LIBCPP_INLINE_VISIBILITY
2046 __is_val_expr<_Expr>::value,
2049 mask_array<_Tp>::operator|=(const _Expr& __v) const
2051 size_t __n = __1d_.size();
2052 for (size_t __i = 0; __i < __n; ++__i)
2053 __vp_[__1d_[__i]] |= __v[__i];
2056 template <class _Tp>
2057 template <class _Expr>
2058 inline _LIBCPP_INLINE_VISIBILITY
2061 __is_val_expr<_Expr>::value,
2064 mask_array<_Tp>::operator<<=(const _Expr& __v) const
2066 size_t __n = __1d_.size();
2067 for (size_t __i = 0; __i < __n; ++__i)
2068 __vp_[__1d_[__i]] <<= __v[__i];
2071 template <class _Tp>
2072 template <class _Expr>
2073 inline _LIBCPP_INLINE_VISIBILITY
2076 __is_val_expr<_Expr>::value,
2079 mask_array<_Tp>::operator>>=(const _Expr& __v) const
2081 size_t __n = __1d_.size();
2082 for (size_t __i = 0; __i < __n; ++__i)
2083 __vp_[__1d_[__i]] >>= __v[__i];
2086 template <class _Tp>
2087 inline _LIBCPP_INLINE_VISIBILITY
2088 const mask_array<_Tp>&
2089 mask_array<_Tp>::operator=(const mask_array& __ma) const
2091 size_t __n = __1d_.size();
2092 for (size_t __i = 0; __i < __n; ++__i)
2093 __vp_[__1d_[__i]] = __ma.__vp_[__1d_[__i]];
2097 template <class _Tp>
2098 inline _LIBCPP_INLINE_VISIBILITY
2100 mask_array<_Tp>::operator=(const value_type& __x) const
2102 size_t __n = __1d_.size();
2103 for (size_t __i = 0; __i < __n; ++__i)
2104 __vp_[__1d_[__i]] = __x;
2107 template <class _ValExpr>
2110 typedef typename remove_reference<_ValExpr>::type _RmExpr;
2112 typedef typename _RmExpr::value_type value_type;
2113 typedef value_type result_type;
2117 valarray<size_t> __1d_;
2119 _LIBCPP_INLINE_VISIBILITY
2120 __mask_expr(const valarray<bool>& __vb, const _RmExpr& __e)
2122 __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
2125 for (size_t __i = 0; __i < __vb.size(); ++__i)
2131 _LIBCPP_INLINE_VISIBILITY
2132 result_type operator[](size_t __i) const
2133 {return __expr_[__1d_[__i]];}
2135 _LIBCPP_INLINE_VISIBILITY
2136 size_t size() const {return __1d_.size();}
2138 template <class> friend class valarray;
2143 template <class _Tp>
2144 class _LIBCPP_TYPE_VIS_ONLY indirect_array
2147 typedef _Tp value_type;
2151 valarray<size_t> __1d_;
2154 template <class _Expr>
2157 __is_val_expr<_Expr>::value,
2160 operator=(const _Expr& __v) const;
2162 template <class _Expr>
2165 __is_val_expr<_Expr>::value,
2168 operator*=(const _Expr& __v) const;
2170 template <class _Expr>
2173 __is_val_expr<_Expr>::value,
2176 operator/=(const _Expr& __v) const;
2178 template <class _Expr>
2181 __is_val_expr<_Expr>::value,
2184 operator%=(const _Expr& __v) const;
2186 template <class _Expr>
2189 __is_val_expr<_Expr>::value,
2192 operator+=(const _Expr& __v) const;
2194 template <class _Expr>
2197 __is_val_expr<_Expr>::value,
2200 operator-=(const _Expr& __v) const;
2202 template <class _Expr>
2205 __is_val_expr<_Expr>::value,
2208 operator^=(const _Expr& __v) const;
2210 template <class _Expr>
2213 __is_val_expr<_Expr>::value,
2216 operator&=(const _Expr& __v) const;
2218 template <class _Expr>
2221 __is_val_expr<_Expr>::value,
2224 operator|=(const _Expr& __v) const;
2226 template <class _Expr>
2229 __is_val_expr<_Expr>::value,
2232 operator<<=(const _Expr& __v) const;
2234 template <class _Expr>
2237 __is_val_expr<_Expr>::value,
2240 operator>>=(const _Expr& __v) const;
2242 const indirect_array& operator=(const indirect_array& __ia) const;
2244 void operator=(const value_type& __x) const;
2246 // indirect_array(const indirect_array&) = default;
2247 // indirect_array(indirect_array&&) = default;
2248 // indirect_array& operator=(const indirect_array&) = default;
2249 // indirect_array& operator=(indirect_array&&) = default;
2252 _LIBCPP_INLINE_VISIBILITY
2253 indirect_array(const valarray<size_t>& __ia, const valarray<value_type>& __v)
2254 : __vp_(const_cast<value_type*>(__v.__begin_)),
2258 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2260 _LIBCPP_INLINE_VISIBILITY
2261 indirect_array(valarray<size_t>&& __ia, const valarray<value_type>& __v)
2262 : __vp_(const_cast<value_type*>(__v.__begin_)),
2266 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2268 template <class> friend class valarray;
2271 template <class _Tp>
2272 template <class _Expr>
2273 inline _LIBCPP_INLINE_VISIBILITY
2276 __is_val_expr<_Expr>::value,
2279 indirect_array<_Tp>::operator=(const _Expr& __v) const
2281 size_t __n = __1d_.size();
2282 for (size_t __i = 0; __i < __n; ++__i)
2283 __vp_[__1d_[__i]] = __v[__i];
2286 template <class _Tp>
2287 template <class _Expr>
2288 inline _LIBCPP_INLINE_VISIBILITY
2291 __is_val_expr<_Expr>::value,
2294 indirect_array<_Tp>::operator*=(const _Expr& __v) const
2296 size_t __n = __1d_.size();
2297 for (size_t __i = 0; __i < __n; ++__i)
2298 __vp_[__1d_[__i]] *= __v[__i];
2301 template <class _Tp>
2302 template <class _Expr>
2303 inline _LIBCPP_INLINE_VISIBILITY
2306 __is_val_expr<_Expr>::value,
2309 indirect_array<_Tp>::operator/=(const _Expr& __v) const
2311 size_t __n = __1d_.size();
2312 for (size_t __i = 0; __i < __n; ++__i)
2313 __vp_[__1d_[__i]] /= __v[__i];
2316 template <class _Tp>
2317 template <class _Expr>
2318 inline _LIBCPP_INLINE_VISIBILITY
2321 __is_val_expr<_Expr>::value,
2324 indirect_array<_Tp>::operator%=(const _Expr& __v) const
2326 size_t __n = __1d_.size();
2327 for (size_t __i = 0; __i < __n; ++__i)
2328 __vp_[__1d_[__i]] %= __v[__i];
2331 template <class _Tp>
2332 template <class _Expr>
2333 inline _LIBCPP_INLINE_VISIBILITY
2336 __is_val_expr<_Expr>::value,
2339 indirect_array<_Tp>::operator+=(const _Expr& __v) const
2341 size_t __n = __1d_.size();
2342 for (size_t __i = 0; __i < __n; ++__i)
2343 __vp_[__1d_[__i]] += __v[__i];
2346 template <class _Tp>
2347 template <class _Expr>
2348 inline _LIBCPP_INLINE_VISIBILITY
2351 __is_val_expr<_Expr>::value,
2354 indirect_array<_Tp>::operator-=(const _Expr& __v) const
2356 size_t __n = __1d_.size();
2357 for (size_t __i = 0; __i < __n; ++__i)
2358 __vp_[__1d_[__i]] -= __v[__i];
2361 template <class _Tp>
2362 template <class _Expr>
2363 inline _LIBCPP_INLINE_VISIBILITY
2366 __is_val_expr<_Expr>::value,
2369 indirect_array<_Tp>::operator^=(const _Expr& __v) const
2371 size_t __n = __1d_.size();
2372 for (size_t __i = 0; __i < __n; ++__i)
2373 __vp_[__1d_[__i]] ^= __v[__i];
2376 template <class _Tp>
2377 template <class _Expr>
2378 inline _LIBCPP_INLINE_VISIBILITY
2381 __is_val_expr<_Expr>::value,
2384 indirect_array<_Tp>::operator&=(const _Expr& __v) const
2386 size_t __n = __1d_.size();
2387 for (size_t __i = 0; __i < __n; ++__i)
2388 __vp_[__1d_[__i]] &= __v[__i];
2391 template <class _Tp>
2392 template <class _Expr>
2393 inline _LIBCPP_INLINE_VISIBILITY
2396 __is_val_expr<_Expr>::value,
2399 indirect_array<_Tp>::operator|=(const _Expr& __v) const
2401 size_t __n = __1d_.size();
2402 for (size_t __i = 0; __i < __n; ++__i)
2403 __vp_[__1d_[__i]] |= __v[__i];
2406 template <class _Tp>
2407 template <class _Expr>
2408 inline _LIBCPP_INLINE_VISIBILITY
2411 __is_val_expr<_Expr>::value,
2414 indirect_array<_Tp>::operator<<=(const _Expr& __v) const
2416 size_t __n = __1d_.size();
2417 for (size_t __i = 0; __i < __n; ++__i)
2418 __vp_[__1d_[__i]] <<= __v[__i];
2421 template <class _Tp>
2422 template <class _Expr>
2423 inline _LIBCPP_INLINE_VISIBILITY
2426 __is_val_expr<_Expr>::value,
2429 indirect_array<_Tp>::operator>>=(const _Expr& __v) const
2431 size_t __n = __1d_.size();
2432 for (size_t __i = 0; __i < __n; ++__i)
2433 __vp_[__1d_[__i]] >>= __v[__i];
2436 template <class _Tp>
2437 inline _LIBCPP_INLINE_VISIBILITY
2438 const indirect_array<_Tp>&
2439 indirect_array<_Tp>::operator=(const indirect_array& __ia) const
2441 typedef const size_t* _Ip;
2442 const value_type* __s = __ia.__vp_;
2443 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ia.__1d_.__begin_;
2444 __i != __e; ++__i, ++__j)
2445 __vp_[*__i] = __s[*__j];
2449 template <class _Tp>
2450 inline _LIBCPP_INLINE_VISIBILITY
2452 indirect_array<_Tp>::operator=(const value_type& __x) const
2454 typedef const size_t* _Ip;
2455 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
2459 template <class _ValExpr>
2460 class __indirect_expr
2462 typedef typename remove_reference<_ValExpr>::type _RmExpr;
2464 typedef typename _RmExpr::value_type value_type;
2465 typedef value_type result_type;
2469 valarray<size_t> __1d_;
2471 _LIBCPP_INLINE_VISIBILITY
2472 __indirect_expr(const valarray<size_t>& __ia, const _RmExpr& __e)
2477 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2479 _LIBCPP_INLINE_VISIBILITY
2480 __indirect_expr(valarray<size_t>&& __ia, const _RmExpr& __e)
2485 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2488 _LIBCPP_INLINE_VISIBILITY
2489 result_type operator[](size_t __i) const
2490 {return __expr_[__1d_[__i]];}
2492 _LIBCPP_INLINE_VISIBILITY
2493 size_t size() const {return __1d_.size();}
2495 template <class> friend class _LIBCPP_TYPE_VIS_ONLY valarray;
2498 template<class _ValExpr>
2501 typedef typename remove_reference<_ValExpr>::type _RmExpr;
2505 typedef typename _RmExpr::value_type value_type;
2506 typedef typename _RmExpr::result_type result_type;
2508 _LIBCPP_INLINE_VISIBILITY
2509 explicit __val_expr(const _RmExpr& __e) : __expr_(__e) {}
2511 _LIBCPP_INLINE_VISIBILITY
2512 result_type operator[](size_t __i) const
2513 {return __expr_[__i];}
2515 _LIBCPP_INLINE_VISIBILITY
2516 __val_expr<__slice_expr<_ValExpr> > operator[](slice __s) const
2517 {return __val_expr<__slice_expr<_ValExpr> >(__expr_, __s);}
2519 _LIBCPP_INLINE_VISIBILITY
2520 __val_expr<__indirect_expr<_ValExpr> > operator[](const gslice& __gs) const
2521 {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __gs.__1d_);}
2523 _LIBCPP_INLINE_VISIBILITY
2524 __val_expr<__mask_expr<_ValExpr> > operator[](const valarray<bool>& __vb) const
2525 {return __val_expr<__mask_expr<_ValExpr> >(__expr_, __vb);}
2527 _LIBCPP_INLINE_VISIBILITY
2528 __val_expr<__indirect_expr<_ValExpr> > operator[](const valarray<size_t>& __vs) const
2529 {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __vs);}
2531 _LIBCPP_INLINE_VISIBILITY
2532 __val_expr<_UnaryOp<__unary_plus<value_type>, _ValExpr> >
2535 typedef _UnaryOp<__unary_plus<value_type>, _ValExpr> _NewExpr;
2536 return __val_expr<_NewExpr>(_NewExpr(__unary_plus<value_type>(), __expr_));
2539 _LIBCPP_INLINE_VISIBILITY
2540 __val_expr<_UnaryOp<negate<value_type>, _ValExpr> >
2543 typedef _UnaryOp<negate<value_type>, _ValExpr> _NewExpr;
2544 return __val_expr<_NewExpr>(_NewExpr(negate<value_type>(), __expr_));
2547 _LIBCPP_INLINE_VISIBILITY
2548 __val_expr<_UnaryOp<__bit_not<value_type>, _ValExpr> >
2551 typedef _UnaryOp<__bit_not<value_type>, _ValExpr> _NewExpr;
2552 return __val_expr<_NewExpr>(_NewExpr(__bit_not<value_type>(), __expr_));
2555 _LIBCPP_INLINE_VISIBILITY
2556 __val_expr<_UnaryOp<logical_not<value_type>, _ValExpr> >
2559 typedef _UnaryOp<logical_not<value_type>, _ValExpr> _NewExpr;
2560 return __val_expr<_NewExpr>(_NewExpr(logical_not<value_type>(), __expr_));
2563 operator valarray<result_type>() const;
2565 _LIBCPP_INLINE_VISIBILITY
2566 size_t size() const {return __expr_.size();}
2568 _LIBCPP_INLINE_VISIBILITY
2569 result_type sum() const
2571 size_t __n = __expr_.size();
2572 result_type __r = __n ? __expr_[0] : result_type();
2573 for (size_t __i = 1; __i < __n; ++__i)
2574 __r += __expr_[__i];
2578 _LIBCPP_INLINE_VISIBILITY
2579 result_type min() const
2581 size_t __n = size();
2582 result_type __r = __n ? (*this)[0] : result_type();
2583 for (size_t __i = 1; __i < __n; ++__i)
2585 result_type __x = __expr_[__i];
2592 _LIBCPP_INLINE_VISIBILITY
2593 result_type max() const
2595 size_t __n = size();
2596 result_type __r = __n ? (*this)[0] : result_type();
2597 for (size_t __i = 1; __i < __n; ++__i)
2599 result_type __x = __expr_[__i];
2606 _LIBCPP_INLINE_VISIBILITY
2607 __val_expr<__shift_expr<_ValExpr> > shift (int __i) const
2608 {return __val_expr<__shift_expr<_ValExpr> >(__shift_expr<_ValExpr>(__i, __expr_));}
2610 _LIBCPP_INLINE_VISIBILITY
2611 __val_expr<__cshift_expr<_ValExpr> > cshift(int __i) const
2612 {return __val_expr<__cshift_expr<_ValExpr> >(__cshift_expr<_ValExpr>(__i, __expr_));}
2614 _LIBCPP_INLINE_VISIBILITY
2615 __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(value_type)>, _ValExpr> >
2616 apply(value_type __f(value_type)) const
2618 typedef __apply_expr<value_type, value_type(*)(value_type)> _Op;
2619 typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
2620 return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
2623 _LIBCPP_INLINE_VISIBILITY
2624 __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(const value_type&)>, _ValExpr> >
2625 apply(value_type __f(const value_type&)) const
2627 typedef __apply_expr<value_type, value_type(*)(const value_type&)> _Op;
2628 typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
2629 return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
2633 template<class _ValExpr>
2634 __val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const
2636 valarray<result_type> __r;
2637 size_t __n = __expr_.size();
2642 static_cast<result_type*>(_VSTD::__allocate(__n * sizeof(result_type)));
2643 for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i)
2644 ::new (__r.__end_) result_type(__expr_[__i]);
2651 template <class _Tp>
2652 inline _LIBCPP_INLINE_VISIBILITY
2653 valarray<_Tp>::valarray(size_t __n)
2660 template <class _Tp>
2661 inline _LIBCPP_INLINE_VISIBILITY
2662 valarray<_Tp>::valarray(const value_type& __x, size_t __n)
2669 template <class _Tp>
2670 valarray<_Tp>::valarray(const value_type* __p, size_t __n)
2676 __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
2677 #ifndef _LIBCPP_NO_EXCEPTIONS
2680 #endif // _LIBCPP_NO_EXCEPTIONS
2681 for (; __n; ++__end_, ++__p, --__n)
2682 ::new (__end_) value_type(*__p);
2683 #ifndef _LIBCPP_NO_EXCEPTIONS
2690 #endif // _LIBCPP_NO_EXCEPTIONS
2694 template <class _Tp>
2695 valarray<_Tp>::valarray(const valarray& __v)
2701 __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__v.size() * sizeof(value_type)));
2702 #ifndef _LIBCPP_NO_EXCEPTIONS
2705 #endif // _LIBCPP_NO_EXCEPTIONS
2706 for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p)
2707 ::new (__end_) value_type(*__p);
2708 #ifndef _LIBCPP_NO_EXCEPTIONS
2715 #endif // _LIBCPP_NO_EXCEPTIONS
2719 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2721 template <class _Tp>
2722 inline _LIBCPP_INLINE_VISIBILITY
2723 valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT
2724 : __begin_(__v.__begin_),
2727 __v.__begin_ = __v.__end_ = nullptr;
2730 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2732 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
2734 template <class _Tp>
2735 valarray<_Tp>::valarray(initializer_list<value_type> __il)
2739 size_t __n = __il.size();
2742 __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
2743 #ifndef _LIBCPP_NO_EXCEPTIONS
2746 #endif // _LIBCPP_NO_EXCEPTIONS
2747 for (const value_type* __p = __il.begin(); __n; ++__end_, ++__p, --__n)
2748 ::new (__end_) value_type(*__p);
2749 #ifndef _LIBCPP_NO_EXCEPTIONS
2756 #endif // _LIBCPP_NO_EXCEPTIONS
2760 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
2762 template <class _Tp>
2763 valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
2767 size_t __n = __sa.__size_;
2770 __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
2771 #ifndef _LIBCPP_NO_EXCEPTIONS
2774 #endif // _LIBCPP_NO_EXCEPTIONS
2775 for (const value_type* __p = __sa.__vp_; __n; ++__end_, __p += __sa.__stride_, --__n)
2776 ::new (__end_) value_type(*__p);
2777 #ifndef _LIBCPP_NO_EXCEPTIONS
2784 #endif // _LIBCPP_NO_EXCEPTIONS
2788 template <class _Tp>
2789 valarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
2793 size_t __n = __ga.__1d_.size();
2796 __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
2797 #ifndef _LIBCPP_NO_EXCEPTIONS
2800 #endif // _LIBCPP_NO_EXCEPTIONS
2801 typedef const size_t* _Ip;
2802 const value_type* __s = __ga.__vp_;
2803 for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
2804 __i != __e; ++__i, ++__end_)
2805 ::new (__end_) value_type(__s[*__i]);
2806 #ifndef _LIBCPP_NO_EXCEPTIONS
2813 #endif // _LIBCPP_NO_EXCEPTIONS
2817 template <class _Tp>
2818 valarray<_Tp>::valarray(const mask_array<value_type>& __ma)
2822 size_t __n = __ma.__1d_.size();
2825 __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
2826 #ifndef _LIBCPP_NO_EXCEPTIONS
2829 #endif // _LIBCPP_NO_EXCEPTIONS
2830 typedef const size_t* _Ip;
2831 const value_type* __s = __ma.__vp_;
2832 for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
2833 __i != __e; ++__i, ++__end_)
2834 ::new (__end_) value_type(__s[*__i]);
2835 #ifndef _LIBCPP_NO_EXCEPTIONS
2842 #endif // _LIBCPP_NO_EXCEPTIONS
2846 template <class _Tp>
2847 valarray<_Tp>::valarray(const indirect_array<value_type>& __ia)
2851 size_t __n = __ia.__1d_.size();
2854 __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
2855 #ifndef _LIBCPP_NO_EXCEPTIONS
2858 #endif // _LIBCPP_NO_EXCEPTIONS
2859 typedef const size_t* _Ip;
2860 const value_type* __s = __ia.__vp_;
2861 for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
2862 __i != __e; ++__i, ++__end_)
2863 ::new (__end_) value_type(__s[*__i]);
2864 #ifndef _LIBCPP_NO_EXCEPTIONS
2871 #endif // _LIBCPP_NO_EXCEPTIONS
2875 template <class _Tp>
2876 inline _LIBCPP_INLINE_VISIBILITY
2877 valarray<_Tp>::~valarray()
2882 template <class _Tp>
2884 valarray<_Tp>::operator=(const valarray& __v)
2888 if (size() != __v.size())
2890 _VSTD::copy(__v.__begin_, __v.__end_, __begin_);
2895 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2897 template <class _Tp>
2898 inline _LIBCPP_INLINE_VISIBILITY
2900 valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT
2903 __begin_ = __v.__begin_;
2904 __end_ = __v.__end_;
2905 __v.__begin_ = nullptr;
2906 __v.__end_ = nullptr;
2910 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2912 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
2914 template <class _Tp>
2915 inline _LIBCPP_INLINE_VISIBILITY
2917 valarray<_Tp>::operator=(initializer_list<value_type> __il)
2919 if (size() != __il.size())
2920 resize(__il.size());
2921 _VSTD::copy(__il.begin(), __il.end(), __begin_);
2925 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
2927 template <class _Tp>
2928 inline _LIBCPP_INLINE_VISIBILITY
2930 valarray<_Tp>::operator=(const value_type& __x)
2932 _VSTD::fill(__begin_, __end_, __x);
2936 template <class _Tp>
2937 inline _LIBCPP_INLINE_VISIBILITY
2939 valarray<_Tp>::operator=(const slice_array<value_type>& __sa)
2941 value_type* __t = __begin_;
2942 const value_type* __s = __sa.__vp_;
2943 for (size_t __n = __sa.__size_; __n; --__n, __s += __sa.__stride_, ++__t)
2948 template <class _Tp>
2949 inline _LIBCPP_INLINE_VISIBILITY
2951 valarray<_Tp>::operator=(const gslice_array<value_type>& __ga)
2953 typedef const size_t* _Ip;
2954 value_type* __t = __begin_;
2955 const value_type* __s = __ga.__vp_;
2956 for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
2957 __i != __e; ++__i, ++__t)
2962 template <class _Tp>
2963 inline _LIBCPP_INLINE_VISIBILITY
2965 valarray<_Tp>::operator=(const mask_array<value_type>& __ma)
2967 typedef const size_t* _Ip;
2968 value_type* __t = __begin_;
2969 const value_type* __s = __ma.__vp_;
2970 for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
2971 __i != __e; ++__i, ++__t)
2976 template <class _Tp>
2977 inline _LIBCPP_INLINE_VISIBILITY
2979 valarray<_Tp>::operator=(const indirect_array<value_type>& __ia)
2981 typedef const size_t* _Ip;
2982 value_type* __t = __begin_;
2983 const value_type* __s = __ia.__vp_;
2984 for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
2985 __i != __e; ++__i, ++__t)
2990 template <class _Tp>
2991 template <class _ValExpr>
2992 inline _LIBCPP_INLINE_VISIBILITY
2994 valarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v)
2996 size_t __n = __v.size();
2999 value_type* __t = __begin_;
3000 for (size_t __i = 0; __i != __n; ++__t, ++__i)
3001 *__t = result_type(__v[__i]);
3005 template <class _Tp>
3006 inline _LIBCPP_INLINE_VISIBILITY
3007 __val_expr<__slice_expr<const valarray<_Tp>&> >
3008 valarray<_Tp>::operator[](slice __s) const
3010 return __val_expr<__slice_expr<const valarray&> >(__slice_expr<const valarray&>(__s, *this));
3013 template <class _Tp>
3014 inline _LIBCPP_INLINE_VISIBILITY
3016 valarray<_Tp>::operator[](slice __s)
3018 return slice_array<value_type>(__s, *this);
3021 template <class _Tp>
3022 inline _LIBCPP_INLINE_VISIBILITY
3023 __val_expr<__indirect_expr<const valarray<_Tp>&> >
3024 valarray<_Tp>::operator[](const gslice& __gs) const
3026 return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__gs.__1d_, *this));
3029 template <class _Tp>
3030 inline _LIBCPP_INLINE_VISIBILITY
3032 valarray<_Tp>::operator[](const gslice& __gs)
3034 return gslice_array<value_type>(__gs, *this);
3037 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3039 template <class _Tp>
3040 inline _LIBCPP_INLINE_VISIBILITY
3041 __val_expr<__indirect_expr<const valarray<_Tp>&> >
3042 valarray<_Tp>::operator[](gslice&& __gs) const
3044 return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__gs.__1d_), *this));
3047 template <class _Tp>
3048 inline _LIBCPP_INLINE_VISIBILITY
3050 valarray<_Tp>::operator[](gslice&& __gs)
3052 return gslice_array<value_type>(move(__gs), *this);
3055 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
3057 template <class _Tp>
3058 inline _LIBCPP_INLINE_VISIBILITY
3059 __val_expr<__mask_expr<const valarray<_Tp>&> >
3060 valarray<_Tp>::operator[](const valarray<bool>& __vb) const
3062 return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(__vb, *this));
3065 template <class _Tp>
3066 inline _LIBCPP_INLINE_VISIBILITY
3068 valarray<_Tp>::operator[](const valarray<bool>& __vb)
3070 return mask_array<value_type>(__vb, *this);
3073 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3075 template <class _Tp>
3076 inline _LIBCPP_INLINE_VISIBILITY
3077 __val_expr<__mask_expr<const valarray<_Tp>&> >
3078 valarray<_Tp>::operator[](valarray<bool>&& __vb) const
3080 return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(move(__vb), *this));
3083 template <class _Tp>
3084 inline _LIBCPP_INLINE_VISIBILITY
3086 valarray<_Tp>::operator[](valarray<bool>&& __vb)
3088 return mask_array<value_type>(move(__vb), *this);
3091 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
3093 template <class _Tp>
3094 inline _LIBCPP_INLINE_VISIBILITY
3095 __val_expr<__indirect_expr<const valarray<_Tp>&> >
3096 valarray<_Tp>::operator[](const valarray<size_t>& __vs) const
3098 return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__vs, *this));
3101 template <class _Tp>
3102 inline _LIBCPP_INLINE_VISIBILITY
3104 valarray<_Tp>::operator[](const valarray<size_t>& __vs)
3106 return indirect_array<value_type>(__vs, *this);
3109 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3111 template <class _Tp>
3112 inline _LIBCPP_INLINE_VISIBILITY
3113 __val_expr<__indirect_expr<const valarray<_Tp>&> >
3114 valarray<_Tp>::operator[](valarray<size_t>&& __vs) const
3116 return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__vs), *this));
3119 template <class _Tp>
3120 inline _LIBCPP_INLINE_VISIBILITY
3122 valarray<_Tp>::operator[](valarray<size_t>&& __vs)
3124 return indirect_array<value_type>(move(__vs), *this);
3127 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
3129 template <class _Tp>
3131 valarray<_Tp>::operator+() const
3133 valarray<value_type> __r;
3134 size_t __n = size();
3139 static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
3140 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3141 ::new (__r.__end_) value_type(+*__p);
3146 template <class _Tp>
3148 valarray<_Tp>::operator-() const
3150 valarray<value_type> __r;
3151 size_t __n = size();
3156 static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
3157 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3158 ::new (__r.__end_) value_type(-*__p);
3163 template <class _Tp>
3165 valarray<_Tp>::operator~() const
3167 valarray<value_type> __r;
3168 size_t __n = size();
3173 static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
3174 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3175 ::new (__r.__end_) value_type(~*__p);
3180 template <class _Tp>
3182 valarray<_Tp>::operator!() const
3185 size_t __n = size();
3190 static_cast<bool*>(_VSTD::__allocate(__n * sizeof(bool)));
3191 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3192 ::new (__r.__end_) bool(!*__p);
3197 template <class _Tp>
3198 inline _LIBCPP_INLINE_VISIBILITY
3200 valarray<_Tp>::operator*=(const value_type& __x)
3202 for (value_type* __p = __begin_; __p != __end_; ++__p)
3207 template <class _Tp>
3208 inline _LIBCPP_INLINE_VISIBILITY
3210 valarray<_Tp>::operator/=(const value_type& __x)
3212 for (value_type* __p = __begin_; __p != __end_; ++__p)
3217 template <class _Tp>
3218 inline _LIBCPP_INLINE_VISIBILITY
3220 valarray<_Tp>::operator%=(const value_type& __x)
3222 for (value_type* __p = __begin_; __p != __end_; ++__p)
3227 template <class _Tp>
3228 inline _LIBCPP_INLINE_VISIBILITY
3230 valarray<_Tp>::operator+=(const value_type& __x)
3232 for (value_type* __p = __begin_; __p != __end_; ++__p)
3237 template <class _Tp>
3238 inline _LIBCPP_INLINE_VISIBILITY
3240 valarray<_Tp>::operator-=(const value_type& __x)
3242 for (value_type* __p = __begin_; __p != __end_; ++__p)
3247 template <class _Tp>
3248 inline _LIBCPP_INLINE_VISIBILITY
3250 valarray<_Tp>::operator^=(const value_type& __x)
3252 for (value_type* __p = __begin_; __p != __end_; ++__p)
3257 template <class _Tp>
3258 inline _LIBCPP_INLINE_VISIBILITY
3260 valarray<_Tp>::operator&=(const value_type& __x)
3262 for (value_type* __p = __begin_; __p != __end_; ++__p)
3267 template <class _Tp>
3268 inline _LIBCPP_INLINE_VISIBILITY
3270 valarray<_Tp>::operator|=(const value_type& __x)
3272 for (value_type* __p = __begin_; __p != __end_; ++__p)
3277 template <class _Tp>
3278 inline _LIBCPP_INLINE_VISIBILITY
3280 valarray<_Tp>::operator<<=(const value_type& __x)
3282 for (value_type* __p = __begin_; __p != __end_; ++__p)
3287 template <class _Tp>
3288 inline _LIBCPP_INLINE_VISIBILITY
3290 valarray<_Tp>::operator>>=(const value_type& __x)
3292 for (value_type* __p = __begin_; __p != __end_; ++__p)
3297 template <class _Tp>
3298 template <class _Expr>
3299 inline _LIBCPP_INLINE_VISIBILITY
3302 __is_val_expr<_Expr>::value,
3305 valarray<_Tp>::operator*=(const _Expr& __v)
3308 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3313 template <class _Tp>
3314 template <class _Expr>
3315 inline _LIBCPP_INLINE_VISIBILITY
3318 __is_val_expr<_Expr>::value,
3321 valarray<_Tp>::operator/=(const _Expr& __v)
3324 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3329 template <class _Tp>
3330 template <class _Expr>
3331 inline _LIBCPP_INLINE_VISIBILITY
3334 __is_val_expr<_Expr>::value,
3337 valarray<_Tp>::operator%=(const _Expr& __v)
3340 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3345 template <class _Tp>
3346 template <class _Expr>
3347 inline _LIBCPP_INLINE_VISIBILITY
3350 __is_val_expr<_Expr>::value,
3353 valarray<_Tp>::operator+=(const _Expr& __v)
3356 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3361 template <class _Tp>
3362 template <class _Expr>
3363 inline _LIBCPP_INLINE_VISIBILITY
3366 __is_val_expr<_Expr>::value,
3369 valarray<_Tp>::operator-=(const _Expr& __v)
3372 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3377 template <class _Tp>
3378 template <class _Expr>
3379 inline _LIBCPP_INLINE_VISIBILITY
3382 __is_val_expr<_Expr>::value,
3385 valarray<_Tp>::operator^=(const _Expr& __v)
3388 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3393 template <class _Tp>
3394 template <class _Expr>
3395 inline _LIBCPP_INLINE_VISIBILITY
3398 __is_val_expr<_Expr>::value,
3401 valarray<_Tp>::operator|=(const _Expr& __v)
3404 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3409 template <class _Tp>
3410 template <class _Expr>
3411 inline _LIBCPP_INLINE_VISIBILITY
3414 __is_val_expr<_Expr>::value,
3417 valarray<_Tp>::operator&=(const _Expr& __v)
3420 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3425 template <class _Tp>
3426 template <class _Expr>
3427 inline _LIBCPP_INLINE_VISIBILITY
3430 __is_val_expr<_Expr>::value,
3433 valarray<_Tp>::operator<<=(const _Expr& __v)
3436 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3441 template <class _Tp>
3442 template <class _Expr>
3443 inline _LIBCPP_INLINE_VISIBILITY
3446 __is_val_expr<_Expr>::value,
3449 valarray<_Tp>::operator>>=(const _Expr& __v)
3452 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3457 template <class _Tp>
3458 inline _LIBCPP_INLINE_VISIBILITY
3460 valarray<_Tp>::swap(valarray& __v) _NOEXCEPT
3462 _VSTD::swap(__begin_, __v.__begin_);
3463 _VSTD::swap(__end_, __v.__end_);
3466 template <class _Tp>
3467 inline _LIBCPP_INLINE_VISIBILITY
3469 valarray<_Tp>::sum() const
3471 if (__begin_ == __end_)
3472 return value_type();
3473 const value_type* __p = __begin_;
3475 for (++__p; __p != __end_; ++__p)
3480 template <class _Tp>
3481 inline _LIBCPP_INLINE_VISIBILITY
3483 valarray<_Tp>::min() const
3485 if (__begin_ == __end_)
3486 return value_type();
3487 return *_VSTD::min_element(__begin_, __end_);
3490 template <class _Tp>
3491 inline _LIBCPP_INLINE_VISIBILITY
3493 valarray<_Tp>::max() const
3495 if (__begin_ == __end_)
3496 return value_type();
3497 return *_VSTD::max_element(__begin_, __end_);
3500 template <class _Tp>
3502 valarray<_Tp>::shift(int __i) const
3504 valarray<value_type> __r;
3505 size_t __n = size();
3510 static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
3511 const value_type* __sb;
3516 __i = _VSTD::min(__i, static_cast<int>(__n));
3517 __sb = __begin_ + __i;
3518 __tb = __r.__begin_;
3519 __te = __r.__begin_ + (__n - __i);
3523 __i = _VSTD::min(-__i, static_cast<int>(__n));
3525 __tb = __r.__begin_ + __i;
3526 __te = __r.__begin_ + __n;
3528 for (; __r.__end_ != __tb; ++__r.__end_)
3529 ::new (__r.__end_) value_type();
3530 for (; __r.__end_ != __te; ++__r.__end_, ++__sb)
3531 ::new (__r.__end_) value_type(*__sb);
3532 for (__te = __r.__begin_ + __n; __r.__end_ != __te; ++__r.__end_)
3533 ::new (__r.__end_) value_type();
3538 template <class _Tp>
3540 valarray<_Tp>::cshift(int __i) const
3542 valarray<value_type> __r;
3543 size_t __n = size();
3548 static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
3549 __i %= static_cast<int>(__n);
3550 const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i;
3551 for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s)
3552 ::new (__r.__end_) value_type(*__s);
3553 for (const value_type* __s = __begin_; __s != __m; ++__r.__end_, ++__s)
3554 ::new (__r.__end_) value_type(*__s);
3559 template <class _Tp>
3561 valarray<_Tp>::apply(value_type __f(value_type)) const
3563 valarray<value_type> __r;
3564 size_t __n = size();
3569 static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
3570 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3571 ::new (__r.__end_) value_type(__f(*__p));
3576 template <class _Tp>
3578 valarray<_Tp>::apply(value_type __f(const value_type&)) const
3580 valarray<value_type> __r;
3581 size_t __n = size();
3586 static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
3587 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3588 ::new (__r.__end_) value_type(__f(*__p));
3593 template <class _Tp>
3595 valarray<_Tp>::resize(size_t __n, value_type __x)
3597 if (__begin_ != nullptr)
3599 while (__end_ != __begin_)
3600 (--__end_)->~value_type();
3601 _VSTD::__deallocate(__begin_);
3602 __begin_ = __end_ = nullptr;
3606 __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
3607 #ifndef _LIBCPP_NO_EXCEPTIONS
3610 #endif // _LIBCPP_NO_EXCEPTIONS
3611 for (; __n; --__n, ++__end_)
3612 ::new (__end_) value_type(__x);
3613 #ifndef _LIBCPP_NO_EXCEPTIONS
3620 #endif // _LIBCPP_NO_EXCEPTIONS
3625 inline _LIBCPP_INLINE_VISIBILITY
3627 swap(valarray<_Tp>& __x, valarray<_Tp>& __y) _NOEXCEPT
3632 template<class _Expr1, class _Expr2>
3633 inline _LIBCPP_INLINE_VISIBILITY
3636 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3637 __val_expr<_BinaryOp<multiplies<typename _Expr1::value_type>, _Expr1, _Expr2> >
3639 operator*(const _Expr1& __x, const _Expr2& __y)
3641 typedef typename _Expr1::value_type value_type;
3642 typedef _BinaryOp<multiplies<value_type>, _Expr1, _Expr2> _Op;
3643 return __val_expr<_Op>(_Op(multiplies<value_type>(), __x, __y));
3646 template<class _Expr>
3647 inline _LIBCPP_INLINE_VISIBILITY
3650 __is_val_expr<_Expr>::value,
3651 __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
3652 _Expr, __scalar_expr<typename _Expr::value_type> > >
3654 operator*(const _Expr& __x, const typename _Expr::value_type& __y)
3656 typedef typename _Expr::value_type value_type;
3657 typedef _BinaryOp<multiplies<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3658 return __val_expr<_Op>(_Op(multiplies<value_type>(),
3659 __x, __scalar_expr<value_type>(__y, __x.size())));
3662 template<class _Expr>
3663 inline _LIBCPP_INLINE_VISIBILITY
3666 __is_val_expr<_Expr>::value,
3667 __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
3668 __scalar_expr<typename _Expr::value_type>, _Expr> >
3670 operator*(const typename _Expr::value_type& __x, const _Expr& __y)
3672 typedef typename _Expr::value_type value_type;
3673 typedef _BinaryOp<multiplies<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3674 return __val_expr<_Op>(_Op(multiplies<value_type>(),
3675 __scalar_expr<value_type>(__x, __y.size()), __y));
3678 template<class _Expr1, class _Expr2>
3679 inline _LIBCPP_INLINE_VISIBILITY
3682 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3683 __val_expr<_BinaryOp<divides<typename _Expr1::value_type>, _Expr1, _Expr2> >
3685 operator/(const _Expr1& __x, const _Expr2& __y)
3687 typedef typename _Expr1::value_type value_type;
3688 typedef _BinaryOp<divides<value_type>, _Expr1, _Expr2> _Op;
3689 return __val_expr<_Op>(_Op(divides<value_type>(), __x, __y));
3692 template<class _Expr>
3693 inline _LIBCPP_INLINE_VISIBILITY
3696 __is_val_expr<_Expr>::value,
3697 __val_expr<_BinaryOp<divides<typename _Expr::value_type>,
3698 _Expr, __scalar_expr<typename _Expr::value_type> > >
3700 operator/(const _Expr& __x, const typename _Expr::value_type& __y)
3702 typedef typename _Expr::value_type value_type;
3703 typedef _BinaryOp<divides<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3704 return __val_expr<_Op>(_Op(divides<value_type>(),
3705 __x, __scalar_expr<value_type>(__y, __x.size())));
3708 template<class _Expr>
3709 inline _LIBCPP_INLINE_VISIBILITY
3712 __is_val_expr<_Expr>::value,
3713 __val_expr<_BinaryOp<divides<typename _Expr::value_type>,
3714 __scalar_expr<typename _Expr::value_type>, _Expr> >
3716 operator/(const typename _Expr::value_type& __x, const _Expr& __y)
3718 typedef typename _Expr::value_type value_type;
3719 typedef _BinaryOp<divides<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3720 return __val_expr<_Op>(_Op(divides<value_type>(),
3721 __scalar_expr<value_type>(__x, __y.size()), __y));
3724 template<class _Expr1, class _Expr2>
3725 inline _LIBCPP_INLINE_VISIBILITY
3728 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3729 __val_expr<_BinaryOp<modulus<typename _Expr1::value_type>, _Expr1, _Expr2> >
3731 operator%(const _Expr1& __x, const _Expr2& __y)
3733 typedef typename _Expr1::value_type value_type;
3734 typedef _BinaryOp<modulus<value_type>, _Expr1, _Expr2> _Op;
3735 return __val_expr<_Op>(_Op(modulus<value_type>(), __x, __y));
3738 template<class _Expr>
3739 inline _LIBCPP_INLINE_VISIBILITY
3742 __is_val_expr<_Expr>::value,
3743 __val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
3744 _Expr, __scalar_expr<typename _Expr::value_type> > >
3746 operator%(const _Expr& __x, const typename _Expr::value_type& __y)
3748 typedef typename _Expr::value_type value_type;
3749 typedef _BinaryOp<modulus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3750 return __val_expr<_Op>(_Op(modulus<value_type>(),
3751 __x, __scalar_expr<value_type>(__y, __x.size())));
3754 template<class _Expr>
3755 inline _LIBCPP_INLINE_VISIBILITY
3758 __is_val_expr<_Expr>::value,
3759 __val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
3760 __scalar_expr<typename _Expr::value_type>, _Expr> >
3762 operator%(const typename _Expr::value_type& __x, const _Expr& __y)
3764 typedef typename _Expr::value_type value_type;
3765 typedef _BinaryOp<modulus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3766 return __val_expr<_Op>(_Op(modulus<value_type>(),
3767 __scalar_expr<value_type>(__x, __y.size()), __y));
3770 template<class _Expr1, class _Expr2>
3771 inline _LIBCPP_INLINE_VISIBILITY
3774 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3775 __val_expr<_BinaryOp<plus<typename _Expr1::value_type>, _Expr1, _Expr2> >
3777 operator+(const _Expr1& __x, const _Expr2& __y)
3779 typedef typename _Expr1::value_type value_type;
3780 typedef _BinaryOp<plus<value_type>, _Expr1, _Expr2> _Op;
3781 return __val_expr<_Op>(_Op(plus<value_type>(), __x, __y));
3784 template<class _Expr>
3785 inline _LIBCPP_INLINE_VISIBILITY
3788 __is_val_expr<_Expr>::value,
3789 __val_expr<_BinaryOp<plus<typename _Expr::value_type>,
3790 _Expr, __scalar_expr<typename _Expr::value_type> > >
3792 operator+(const _Expr& __x, const typename _Expr::value_type& __y)
3794 typedef typename _Expr::value_type value_type;
3795 typedef _BinaryOp<plus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3796 return __val_expr<_Op>(_Op(plus<value_type>(),
3797 __x, __scalar_expr<value_type>(__y, __x.size())));
3800 template<class _Expr>
3801 inline _LIBCPP_INLINE_VISIBILITY
3804 __is_val_expr<_Expr>::value,
3805 __val_expr<_BinaryOp<plus<typename _Expr::value_type>,
3806 __scalar_expr<typename _Expr::value_type>, _Expr> >
3808 operator+(const typename _Expr::value_type& __x, const _Expr& __y)
3810 typedef typename _Expr::value_type value_type;
3811 typedef _BinaryOp<plus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3812 return __val_expr<_Op>(_Op(plus<value_type>(),
3813 __scalar_expr<value_type>(__x, __y.size()), __y));
3816 template<class _Expr1, class _Expr2>
3817 inline _LIBCPP_INLINE_VISIBILITY
3820 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3821 __val_expr<_BinaryOp<minus<typename _Expr1::value_type>, _Expr1, _Expr2> >
3823 operator-(const _Expr1& __x, const _Expr2& __y)
3825 typedef typename _Expr1::value_type value_type;
3826 typedef _BinaryOp<minus<value_type>, _Expr1, _Expr2> _Op;
3827 return __val_expr<_Op>(_Op(minus<value_type>(), __x, __y));
3830 template<class _Expr>
3831 inline _LIBCPP_INLINE_VISIBILITY
3834 __is_val_expr<_Expr>::value,
3835 __val_expr<_BinaryOp<minus<typename _Expr::value_type>,
3836 _Expr, __scalar_expr<typename _Expr::value_type> > >
3838 operator-(const _Expr& __x, const typename _Expr::value_type& __y)
3840 typedef typename _Expr::value_type value_type;
3841 typedef _BinaryOp<minus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3842 return __val_expr<_Op>(_Op(minus<value_type>(),
3843 __x, __scalar_expr<value_type>(__y, __x.size())));
3846 template<class _Expr>
3847 inline _LIBCPP_INLINE_VISIBILITY
3850 __is_val_expr<_Expr>::value,
3851 __val_expr<_BinaryOp<minus<typename _Expr::value_type>,
3852 __scalar_expr<typename _Expr::value_type>, _Expr> >
3854 operator-(const typename _Expr::value_type& __x, const _Expr& __y)
3856 typedef typename _Expr::value_type value_type;
3857 typedef _BinaryOp<minus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3858 return __val_expr<_Op>(_Op(minus<value_type>(),
3859 __scalar_expr<value_type>(__x, __y.size()), __y));
3862 template<class _Expr1, class _Expr2>
3863 inline _LIBCPP_INLINE_VISIBILITY
3866 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3867 __val_expr<_BinaryOp<bit_xor<typename _Expr1::value_type>, _Expr1, _Expr2> >
3869 operator^(const _Expr1& __x, const _Expr2& __y)
3871 typedef typename _Expr1::value_type value_type;
3872 typedef _BinaryOp<bit_xor<value_type>, _Expr1, _Expr2> _Op;
3873 return __val_expr<_Op>(_Op(bit_xor<value_type>(), __x, __y));
3876 template<class _Expr>
3877 inline _LIBCPP_INLINE_VISIBILITY
3880 __is_val_expr<_Expr>::value,
3881 __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
3882 _Expr, __scalar_expr<typename _Expr::value_type> > >
3884 operator^(const _Expr& __x, const typename _Expr::value_type& __y)
3886 typedef typename _Expr::value_type value_type;
3887 typedef _BinaryOp<bit_xor<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3888 return __val_expr<_Op>(_Op(bit_xor<value_type>(),
3889 __x, __scalar_expr<value_type>(__y, __x.size())));
3892 template<class _Expr>
3893 inline _LIBCPP_INLINE_VISIBILITY
3896 __is_val_expr<_Expr>::value,
3897 __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
3898 __scalar_expr<typename _Expr::value_type>, _Expr> >
3900 operator^(const typename _Expr::value_type& __x, const _Expr& __y)
3902 typedef typename _Expr::value_type value_type;
3903 typedef _BinaryOp<bit_xor<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3904 return __val_expr<_Op>(_Op(bit_xor<value_type>(),
3905 __scalar_expr<value_type>(__x, __y.size()), __y));
3908 template<class _Expr1, class _Expr2>
3909 inline _LIBCPP_INLINE_VISIBILITY
3912 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3913 __val_expr<_BinaryOp<bit_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
3915 operator&(const _Expr1& __x, const _Expr2& __y)
3917 typedef typename _Expr1::value_type value_type;
3918 typedef _BinaryOp<bit_and<value_type>, _Expr1, _Expr2> _Op;
3919 return __val_expr<_Op>(_Op(bit_and<value_type>(), __x, __y));
3922 template<class _Expr>
3923 inline _LIBCPP_INLINE_VISIBILITY
3926 __is_val_expr<_Expr>::value,
3927 __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
3928 _Expr, __scalar_expr<typename _Expr::value_type> > >
3930 operator&(const _Expr& __x, const typename _Expr::value_type& __y)
3932 typedef typename _Expr::value_type value_type;
3933 typedef _BinaryOp<bit_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3934 return __val_expr<_Op>(_Op(bit_and<value_type>(),
3935 __x, __scalar_expr<value_type>(__y, __x.size())));
3938 template<class _Expr>
3939 inline _LIBCPP_INLINE_VISIBILITY
3942 __is_val_expr<_Expr>::value,
3943 __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
3944 __scalar_expr<typename _Expr::value_type>, _Expr> >
3946 operator&(const typename _Expr::value_type& __x, const _Expr& __y)
3948 typedef typename _Expr::value_type value_type;
3949 typedef _BinaryOp<bit_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3950 return __val_expr<_Op>(_Op(bit_and<value_type>(),
3951 __scalar_expr<value_type>(__x, __y.size()), __y));
3954 template<class _Expr1, class _Expr2>
3955 inline _LIBCPP_INLINE_VISIBILITY
3958 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3959 __val_expr<_BinaryOp<bit_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
3961 operator|(const _Expr1& __x, const _Expr2& __y)
3963 typedef typename _Expr1::value_type value_type;
3964 typedef _BinaryOp<bit_or<value_type>, _Expr1, _Expr2> _Op;
3965 return __val_expr<_Op>(_Op(bit_or<value_type>(), __x, __y));
3968 template<class _Expr>
3969 inline _LIBCPP_INLINE_VISIBILITY
3972 __is_val_expr<_Expr>::value,
3973 __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
3974 _Expr, __scalar_expr<typename _Expr::value_type> > >
3976 operator|(const _Expr& __x, const typename _Expr::value_type& __y)
3978 typedef typename _Expr::value_type value_type;
3979 typedef _BinaryOp<bit_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3980 return __val_expr<_Op>(_Op(bit_or<value_type>(),
3981 __x, __scalar_expr<value_type>(__y, __x.size())));
3984 template<class _Expr>
3985 inline _LIBCPP_INLINE_VISIBILITY
3988 __is_val_expr<_Expr>::value,
3989 __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
3990 __scalar_expr<typename _Expr::value_type>, _Expr> >
3992 operator|(const typename _Expr::value_type& __x, const _Expr& __y)
3994 typedef typename _Expr::value_type value_type;
3995 typedef _BinaryOp<bit_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3996 return __val_expr<_Op>(_Op(bit_or<value_type>(),
3997 __scalar_expr<value_type>(__x, __y.size()), __y));
4000 template<class _Expr1, class _Expr2>
4001 inline _LIBCPP_INLINE_VISIBILITY
4004 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4005 __val_expr<_BinaryOp<__bit_shift_left<typename _Expr1::value_type>, _Expr1, _Expr2> >
4007 operator<<(const _Expr1& __x, const _Expr2& __y)
4009 typedef typename _Expr1::value_type value_type;
4010 typedef _BinaryOp<__bit_shift_left<value_type>, _Expr1, _Expr2> _Op;
4011 return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), __x, __y));
4014 template<class _Expr>
4015 inline _LIBCPP_INLINE_VISIBILITY
4018 __is_val_expr<_Expr>::value,
4019 __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
4020 _Expr, __scalar_expr<typename _Expr::value_type> > >
4022 operator<<(const _Expr& __x, const typename _Expr::value_type& __y)
4024 typedef typename _Expr::value_type value_type;
4025 typedef _BinaryOp<__bit_shift_left<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4026 return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
4027 __x, __scalar_expr<value_type>(__y, __x.size())));
4030 template<class _Expr>
4031 inline _LIBCPP_INLINE_VISIBILITY
4034 __is_val_expr<_Expr>::value,
4035 __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
4036 __scalar_expr<typename _Expr::value_type>, _Expr> >
4038 operator<<(const typename _Expr::value_type& __x, const _Expr& __y)
4040 typedef typename _Expr::value_type value_type;
4041 typedef _BinaryOp<__bit_shift_left<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4042 return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
4043 __scalar_expr<value_type>(__x, __y.size()), __y));
4046 template<class _Expr1, class _Expr2>
4047 inline _LIBCPP_INLINE_VISIBILITY
4050 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4051 __val_expr<_BinaryOp<__bit_shift_right<typename _Expr1::value_type>, _Expr1, _Expr2> >
4053 operator>>(const _Expr1& __x, const _Expr2& __y)
4055 typedef typename _Expr1::value_type value_type;
4056 typedef _BinaryOp<__bit_shift_right<value_type>, _Expr1, _Expr2> _Op;
4057 return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), __x, __y));
4060 template<class _Expr>
4061 inline _LIBCPP_INLINE_VISIBILITY
4064 __is_val_expr<_Expr>::value,
4065 __val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
4066 _Expr, __scalar_expr<typename _Expr::value_type> > >
4068 operator>>(const _Expr& __x, const typename _Expr::value_type& __y)
4070 typedef typename _Expr::value_type value_type;
4071 typedef _BinaryOp<__bit_shift_right<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4072 return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
4073 __x, __scalar_expr<value_type>(__y, __x.size())));
4076 template<class _Expr>
4077 inline _LIBCPP_INLINE_VISIBILITY
4080 __is_val_expr<_Expr>::value,
4081 __val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
4082 __scalar_expr<typename _Expr::value_type>, _Expr> >
4084 operator>>(const typename _Expr::value_type& __x, const _Expr& __y)
4086 typedef typename _Expr::value_type value_type;
4087 typedef _BinaryOp<__bit_shift_right<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4088 return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
4089 __scalar_expr<value_type>(__x, __y.size()), __y));
4092 template<class _Expr1, class _Expr2>
4093 inline _LIBCPP_INLINE_VISIBILITY
4096 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4097 __val_expr<_BinaryOp<logical_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
4099 operator&&(const _Expr1& __x, const _Expr2& __y)
4101 typedef typename _Expr1::value_type value_type;
4102 typedef _BinaryOp<logical_and<value_type>, _Expr1, _Expr2> _Op;
4103 return __val_expr<_Op>(_Op(logical_and<value_type>(), __x, __y));
4106 template<class _Expr>
4107 inline _LIBCPP_INLINE_VISIBILITY
4110 __is_val_expr<_Expr>::value,
4111 __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
4112 _Expr, __scalar_expr<typename _Expr::value_type> > >
4114 operator&&(const _Expr& __x, const typename _Expr::value_type& __y)
4116 typedef typename _Expr::value_type value_type;
4117 typedef _BinaryOp<logical_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4118 return __val_expr<_Op>(_Op(logical_and<value_type>(),
4119 __x, __scalar_expr<value_type>(__y, __x.size())));
4122 template<class _Expr>
4123 inline _LIBCPP_INLINE_VISIBILITY
4126 __is_val_expr<_Expr>::value,
4127 __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
4128 __scalar_expr<typename _Expr::value_type>, _Expr> >
4130 operator&&(const typename _Expr::value_type& __x, const _Expr& __y)
4132 typedef typename _Expr::value_type value_type;
4133 typedef _BinaryOp<logical_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4134 return __val_expr<_Op>(_Op(logical_and<value_type>(),
4135 __scalar_expr<value_type>(__x, __y.size()), __y));
4138 template<class _Expr1, class _Expr2>
4139 inline _LIBCPP_INLINE_VISIBILITY
4142 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4143 __val_expr<_BinaryOp<logical_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
4145 operator||(const _Expr1& __x, const _Expr2& __y)
4147 typedef typename _Expr1::value_type value_type;
4148 typedef _BinaryOp<logical_or<value_type>, _Expr1, _Expr2> _Op;
4149 return __val_expr<_Op>(_Op(logical_or<value_type>(), __x, __y));
4152 template<class _Expr>
4153 inline _LIBCPP_INLINE_VISIBILITY
4156 __is_val_expr<_Expr>::value,
4157 __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
4158 _Expr, __scalar_expr<typename _Expr::value_type> > >
4160 operator||(const _Expr& __x, const typename _Expr::value_type& __y)
4162 typedef typename _Expr::value_type value_type;
4163 typedef _BinaryOp<logical_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4164 return __val_expr<_Op>(_Op(logical_or<value_type>(),
4165 __x, __scalar_expr<value_type>(__y, __x.size())));
4168 template<class _Expr>
4169 inline _LIBCPP_INLINE_VISIBILITY
4172 __is_val_expr<_Expr>::value,
4173 __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
4174 __scalar_expr<typename _Expr::value_type>, _Expr> >
4176 operator||(const typename _Expr::value_type& __x, const _Expr& __y)
4178 typedef typename _Expr::value_type value_type;
4179 typedef _BinaryOp<logical_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4180 return __val_expr<_Op>(_Op(logical_or<value_type>(),
4181 __scalar_expr<value_type>(__x, __y.size()), __y));
4184 template<class _Expr1, class _Expr2>
4185 inline _LIBCPP_INLINE_VISIBILITY
4188 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4189 __val_expr<_BinaryOp<equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
4191 operator==(const _Expr1& __x, const _Expr2& __y)
4193 typedef typename _Expr1::value_type value_type;
4194 typedef _BinaryOp<equal_to<value_type>, _Expr1, _Expr2> _Op;
4195 return __val_expr<_Op>(_Op(equal_to<value_type>(), __x, __y));
4198 template<class _Expr>
4199 inline _LIBCPP_INLINE_VISIBILITY
4202 __is_val_expr<_Expr>::value,
4203 __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
4204 _Expr, __scalar_expr<typename _Expr::value_type> > >
4206 operator==(const _Expr& __x, const typename _Expr::value_type& __y)
4208 typedef typename _Expr::value_type value_type;
4209 typedef _BinaryOp<equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4210 return __val_expr<_Op>(_Op(equal_to<value_type>(),
4211 __x, __scalar_expr<value_type>(__y, __x.size())));
4214 template<class _Expr>
4215 inline _LIBCPP_INLINE_VISIBILITY
4218 __is_val_expr<_Expr>::value,
4219 __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
4220 __scalar_expr<typename _Expr::value_type>, _Expr> >
4222 operator==(const typename _Expr::value_type& __x, const _Expr& __y)
4224 typedef typename _Expr::value_type value_type;
4225 typedef _BinaryOp<equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4226 return __val_expr<_Op>(_Op(equal_to<value_type>(),
4227 __scalar_expr<value_type>(__x, __y.size()), __y));
4230 template<class _Expr1, class _Expr2>
4231 inline _LIBCPP_INLINE_VISIBILITY
4234 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4235 __val_expr<_BinaryOp<not_equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
4237 operator!=(const _Expr1& __x, const _Expr2& __y)
4239 typedef typename _Expr1::value_type value_type;
4240 typedef _BinaryOp<not_equal_to<value_type>, _Expr1, _Expr2> _Op;
4241 return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __x, __y));
4244 template<class _Expr>
4245 inline _LIBCPP_INLINE_VISIBILITY
4248 __is_val_expr<_Expr>::value,
4249 __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
4250 _Expr, __scalar_expr<typename _Expr::value_type> > >
4252 operator!=(const _Expr& __x, const typename _Expr::value_type& __y)
4254 typedef typename _Expr::value_type value_type;
4255 typedef _BinaryOp<not_equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4256 return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
4257 __x, __scalar_expr<value_type>(__y, __x.size())));
4260 template<class _Expr>
4261 inline _LIBCPP_INLINE_VISIBILITY
4264 __is_val_expr<_Expr>::value,
4265 __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
4266 __scalar_expr<typename _Expr::value_type>, _Expr> >
4268 operator!=(const typename _Expr::value_type& __x, const _Expr& __y)
4270 typedef typename _Expr::value_type value_type;
4271 typedef _BinaryOp<not_equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4272 return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
4273 __scalar_expr<value_type>(__x, __y.size()), __y));
4276 template<class _Expr1, class _Expr2>
4277 inline _LIBCPP_INLINE_VISIBILITY
4280 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4281 __val_expr<_BinaryOp<less<typename _Expr1::value_type>, _Expr1, _Expr2> >
4283 operator<(const _Expr1& __x, const _Expr2& __y)
4285 typedef typename _Expr1::value_type value_type;
4286 typedef _BinaryOp<less<value_type>, _Expr1, _Expr2> _Op;
4287 return __val_expr<_Op>(_Op(less<value_type>(), __x, __y));
4290 template<class _Expr>
4291 inline _LIBCPP_INLINE_VISIBILITY
4294 __is_val_expr<_Expr>::value,
4295 __val_expr<_BinaryOp<less<typename _Expr::value_type>,
4296 _Expr, __scalar_expr<typename _Expr::value_type> > >
4298 operator<(const _Expr& __x, const typename _Expr::value_type& __y)
4300 typedef typename _Expr::value_type value_type;
4301 typedef _BinaryOp<less<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4302 return __val_expr<_Op>(_Op(less<value_type>(),
4303 __x, __scalar_expr<value_type>(__y, __x.size())));
4306 template<class _Expr>
4307 inline _LIBCPP_INLINE_VISIBILITY
4310 __is_val_expr<_Expr>::value,
4311 __val_expr<_BinaryOp<less<typename _Expr::value_type>,
4312 __scalar_expr<typename _Expr::value_type>, _Expr> >
4314 operator<(const typename _Expr::value_type& __x, const _Expr& __y)
4316 typedef typename _Expr::value_type value_type;
4317 typedef _BinaryOp<less<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4318 return __val_expr<_Op>(_Op(less<value_type>(),
4319 __scalar_expr<value_type>(__x, __y.size()), __y));
4322 template<class _Expr1, class _Expr2>
4323 inline _LIBCPP_INLINE_VISIBILITY
4326 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4327 __val_expr<_BinaryOp<greater<typename _Expr1::value_type>, _Expr1, _Expr2> >
4329 operator>(const _Expr1& __x, const _Expr2& __y)
4331 typedef typename _Expr1::value_type value_type;
4332 typedef _BinaryOp<greater<value_type>, _Expr1, _Expr2> _Op;
4333 return __val_expr<_Op>(_Op(greater<value_type>(), __x, __y));
4336 template<class _Expr>
4337 inline _LIBCPP_INLINE_VISIBILITY
4340 __is_val_expr<_Expr>::value,
4341 __val_expr<_BinaryOp<greater<typename _Expr::value_type>,
4342 _Expr, __scalar_expr<typename _Expr::value_type> > >
4344 operator>(const _Expr& __x, const typename _Expr::value_type& __y)
4346 typedef typename _Expr::value_type value_type;
4347 typedef _BinaryOp<greater<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4348 return __val_expr<_Op>(_Op(greater<value_type>(),
4349 __x, __scalar_expr<value_type>(__y, __x.size())));
4352 template<class _Expr>
4353 inline _LIBCPP_INLINE_VISIBILITY
4356 __is_val_expr<_Expr>::value,
4357 __val_expr<_BinaryOp<greater<typename _Expr::value_type>,
4358 __scalar_expr<typename _Expr::value_type>, _Expr> >
4360 operator>(const typename _Expr::value_type& __x, const _Expr& __y)
4362 typedef typename _Expr::value_type value_type;
4363 typedef _BinaryOp<greater<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4364 return __val_expr<_Op>(_Op(greater<value_type>(),
4365 __scalar_expr<value_type>(__x, __y.size()), __y));
4368 template<class _Expr1, class _Expr2>
4369 inline _LIBCPP_INLINE_VISIBILITY
4372 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4373 __val_expr<_BinaryOp<less_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
4375 operator<=(const _Expr1& __x, const _Expr2& __y)
4377 typedef typename _Expr1::value_type value_type;
4378 typedef _BinaryOp<less_equal<value_type>, _Expr1, _Expr2> _Op;
4379 return __val_expr<_Op>(_Op(less_equal<value_type>(), __x, __y));
4382 template<class _Expr>
4383 inline _LIBCPP_INLINE_VISIBILITY
4386 __is_val_expr<_Expr>::value,
4387 __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
4388 _Expr, __scalar_expr<typename _Expr::value_type> > >
4390 operator<=(const _Expr& __x, const typename _Expr::value_type& __y)
4392 typedef typename _Expr::value_type value_type;
4393 typedef _BinaryOp<less_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4394 return __val_expr<_Op>(_Op(less_equal<value_type>(),
4395 __x, __scalar_expr<value_type>(__y, __x.size())));
4398 template<class _Expr>
4399 inline _LIBCPP_INLINE_VISIBILITY
4402 __is_val_expr<_Expr>::value,
4403 __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
4404 __scalar_expr<typename _Expr::value_type>, _Expr> >
4406 operator<=(const typename _Expr::value_type& __x, const _Expr& __y)
4408 typedef typename _Expr::value_type value_type;
4409 typedef _BinaryOp<less_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4410 return __val_expr<_Op>(_Op(less_equal<value_type>(),
4411 __scalar_expr<value_type>(__x, __y.size()), __y));
4414 template<class _Expr1, class _Expr2>
4415 inline _LIBCPP_INLINE_VISIBILITY
4418 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4419 __val_expr<_BinaryOp<greater_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
4421 operator>=(const _Expr1& __x, const _Expr2& __y)
4423 typedef typename _Expr1::value_type value_type;
4424 typedef _BinaryOp<greater_equal<value_type>, _Expr1, _Expr2> _Op;
4425 return __val_expr<_Op>(_Op(greater_equal<value_type>(), __x, __y));
4428 template<class _Expr>
4429 inline _LIBCPP_INLINE_VISIBILITY
4432 __is_val_expr<_Expr>::value,
4433 __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
4434 _Expr, __scalar_expr<typename _Expr::value_type> > >
4436 operator>=(const _Expr& __x, const typename _Expr::value_type& __y)
4438 typedef typename _Expr::value_type value_type;
4439 typedef _BinaryOp<greater_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4440 return __val_expr<_Op>(_Op(greater_equal<value_type>(),
4441 __x, __scalar_expr<value_type>(__y, __x.size())));
4444 template<class _Expr>
4445 inline _LIBCPP_INLINE_VISIBILITY
4448 __is_val_expr<_Expr>::value,
4449 __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
4450 __scalar_expr<typename _Expr::value_type>, _Expr> >
4452 operator>=(const typename _Expr::value_type& __x, const _Expr& __y)
4454 typedef typename _Expr::value_type value_type;
4455 typedef _BinaryOp<greater_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4456 return __val_expr<_Op>(_Op(greater_equal<value_type>(),
4457 __scalar_expr<value_type>(__x, __y.size()), __y));
4460 template<class _Expr>
4461 inline _LIBCPP_INLINE_VISIBILITY
4464 __is_val_expr<_Expr>::value,
4465 __val_expr<_UnaryOp<__abs_expr<typename _Expr::value_type>, _Expr> >
4467 abs(const _Expr& __x)
4469 typedef typename _Expr::value_type value_type;
4470 typedef _UnaryOp<__abs_expr<value_type>, _Expr> _Op;
4471 return __val_expr<_Op>(_Op(__abs_expr<value_type>(), __x));
4474 template<class _Expr>
4475 inline _LIBCPP_INLINE_VISIBILITY
4478 __is_val_expr<_Expr>::value,
4479 __val_expr<_UnaryOp<__acos_expr<typename _Expr::value_type>, _Expr> >
4481 acos(const _Expr& __x)
4483 typedef typename _Expr::value_type value_type;
4484 typedef _UnaryOp<__acos_expr<value_type>, _Expr> _Op;
4485 return __val_expr<_Op>(_Op(__acos_expr<value_type>(), __x));
4488 template<class _Expr>
4489 inline _LIBCPP_INLINE_VISIBILITY
4492 __is_val_expr<_Expr>::value,
4493 __val_expr<_UnaryOp<__asin_expr<typename _Expr::value_type>, _Expr> >
4495 asin(const _Expr& __x)
4497 typedef typename _Expr::value_type value_type;
4498 typedef _UnaryOp<__asin_expr<value_type>, _Expr> _Op;
4499 return __val_expr<_Op>(_Op(__asin_expr<value_type>(), __x));
4502 template<class _Expr>
4503 inline _LIBCPP_INLINE_VISIBILITY
4506 __is_val_expr<_Expr>::value,
4507 __val_expr<_UnaryOp<__atan_expr<typename _Expr::value_type>, _Expr> >
4509 atan(const _Expr& __x)
4511 typedef typename _Expr::value_type value_type;
4512 typedef _UnaryOp<__atan_expr<value_type>, _Expr> _Op;
4513 return __val_expr<_Op>(_Op(__atan_expr<value_type>(), __x));
4516 template<class _Expr1, class _Expr2>
4517 inline _LIBCPP_INLINE_VISIBILITY
4520 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4521 __val_expr<_BinaryOp<__atan2_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
4523 atan2(const _Expr1& __x, const _Expr2& __y)
4525 typedef typename _Expr1::value_type value_type;
4526 typedef _BinaryOp<__atan2_expr<value_type>, _Expr1, _Expr2> _Op;
4527 return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __x, __y));
4530 template<class _Expr>
4531 inline _LIBCPP_INLINE_VISIBILITY
4534 __is_val_expr<_Expr>::value,
4535 __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
4536 _Expr, __scalar_expr<typename _Expr::value_type> > >
4538 atan2(const _Expr& __x, const typename _Expr::value_type& __y)
4540 typedef typename _Expr::value_type value_type;
4541 typedef _BinaryOp<__atan2_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4542 return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
4543 __x, __scalar_expr<value_type>(__y, __x.size())));
4546 template<class _Expr>
4547 inline _LIBCPP_INLINE_VISIBILITY
4550 __is_val_expr<_Expr>::value,
4551 __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
4552 __scalar_expr<typename _Expr::value_type>, _Expr> >
4554 atan2(const typename _Expr::value_type& __x, const _Expr& __y)
4556 typedef typename _Expr::value_type value_type;
4557 typedef _BinaryOp<__atan2_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4558 return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
4559 __scalar_expr<value_type>(__x, __y.size()), __y));
4562 template<class _Expr>
4563 inline _LIBCPP_INLINE_VISIBILITY
4566 __is_val_expr<_Expr>::value,
4567 __val_expr<_UnaryOp<__cos_expr<typename _Expr::value_type>, _Expr> >
4569 cos(const _Expr& __x)
4571 typedef typename _Expr::value_type value_type;
4572 typedef _UnaryOp<__cos_expr<value_type>, _Expr> _Op;
4573 return __val_expr<_Op>(_Op(__cos_expr<value_type>(), __x));
4576 template<class _Expr>
4577 inline _LIBCPP_INLINE_VISIBILITY
4580 __is_val_expr<_Expr>::value,
4581 __val_expr<_UnaryOp<__cosh_expr<typename _Expr::value_type>, _Expr> >
4583 cosh(const _Expr& __x)
4585 typedef typename _Expr::value_type value_type;
4586 typedef _UnaryOp<__cosh_expr<value_type>, _Expr> _Op;
4587 return __val_expr<_Op>(_Op(__cosh_expr<value_type>(), __x));
4590 template<class _Expr>
4591 inline _LIBCPP_INLINE_VISIBILITY
4594 __is_val_expr<_Expr>::value,
4595 __val_expr<_UnaryOp<__exp_expr<typename _Expr::value_type>, _Expr> >
4597 exp(const _Expr& __x)
4599 typedef typename _Expr::value_type value_type;
4600 typedef _UnaryOp<__exp_expr<value_type>, _Expr> _Op;
4601 return __val_expr<_Op>(_Op(__exp_expr<value_type>(), __x));
4604 template<class _Expr>
4605 inline _LIBCPP_INLINE_VISIBILITY
4608 __is_val_expr<_Expr>::value,
4609 __val_expr<_UnaryOp<__log_expr<typename _Expr::value_type>, _Expr> >
4611 log(const _Expr& __x)
4613 typedef typename _Expr::value_type value_type;
4614 typedef _UnaryOp<__log_expr<value_type>, _Expr> _Op;
4615 return __val_expr<_Op>(_Op(__log_expr<value_type>(), __x));
4618 template<class _Expr>
4619 inline _LIBCPP_INLINE_VISIBILITY
4622 __is_val_expr<_Expr>::value,
4623 __val_expr<_UnaryOp<__log10_expr<typename _Expr::value_type>, _Expr> >
4625 log10(const _Expr& __x)
4627 typedef typename _Expr::value_type value_type;
4628 typedef _UnaryOp<__log10_expr<value_type>, _Expr> _Op;
4629 return __val_expr<_Op>(_Op(__log10_expr<value_type>(), __x));
4632 template<class _Expr1, class _Expr2>
4633 inline _LIBCPP_INLINE_VISIBILITY
4636 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4637 __val_expr<_BinaryOp<__pow_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
4639 pow(const _Expr1& __x, const _Expr2& __y)
4641 typedef typename _Expr1::value_type value_type;
4642 typedef _BinaryOp<__pow_expr<value_type>, _Expr1, _Expr2> _Op;
4643 return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __x, __y));
4646 template<class _Expr>
4647 inline _LIBCPP_INLINE_VISIBILITY
4650 __is_val_expr<_Expr>::value,
4651 __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
4652 _Expr, __scalar_expr<typename _Expr::value_type> > >
4654 pow(const _Expr& __x, const typename _Expr::value_type& __y)
4656 typedef typename _Expr::value_type value_type;
4657 typedef _BinaryOp<__pow_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4658 return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
4659 __x, __scalar_expr<value_type>(__y, __x.size())));
4662 template<class _Expr>
4663 inline _LIBCPP_INLINE_VISIBILITY
4666 __is_val_expr<_Expr>::value,
4667 __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
4668 __scalar_expr<typename _Expr::value_type>, _Expr> >
4670 pow(const typename _Expr::value_type& __x, const _Expr& __y)
4672 typedef typename _Expr::value_type value_type;
4673 typedef _BinaryOp<__pow_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4674 return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
4675 __scalar_expr<value_type>(__x, __y.size()), __y));
4678 template<class _Expr>
4679 inline _LIBCPP_INLINE_VISIBILITY
4682 __is_val_expr<_Expr>::value,
4683 __val_expr<_UnaryOp<__sin_expr<typename _Expr::value_type>, _Expr> >
4685 sin(const _Expr& __x)
4687 typedef typename _Expr::value_type value_type;
4688 typedef _UnaryOp<__sin_expr<value_type>, _Expr> _Op;
4689 return __val_expr<_Op>(_Op(__sin_expr<value_type>(), __x));
4692 template<class _Expr>
4693 inline _LIBCPP_INLINE_VISIBILITY
4696 __is_val_expr<_Expr>::value,
4697 __val_expr<_UnaryOp<__sinh_expr<typename _Expr::value_type>, _Expr> >
4699 sinh(const _Expr& __x)
4701 typedef typename _Expr::value_type value_type;
4702 typedef _UnaryOp<__sinh_expr<value_type>, _Expr> _Op;
4703 return __val_expr<_Op>(_Op(__sinh_expr<value_type>(), __x));
4706 template<class _Expr>
4707 inline _LIBCPP_INLINE_VISIBILITY
4710 __is_val_expr<_Expr>::value,
4711 __val_expr<_UnaryOp<__sqrt_expr<typename _Expr::value_type>, _Expr> >
4713 sqrt(const _Expr& __x)
4715 typedef typename _Expr::value_type value_type;
4716 typedef _UnaryOp<__sqrt_expr<value_type>, _Expr> _Op;
4717 return __val_expr<_Op>(_Op(__sqrt_expr<value_type>(), __x));
4720 template<class _Expr>
4721 inline _LIBCPP_INLINE_VISIBILITY
4724 __is_val_expr<_Expr>::value,
4725 __val_expr<_UnaryOp<__tan_expr<typename _Expr::value_type>, _Expr> >
4727 tan(const _Expr& __x)
4729 typedef typename _Expr::value_type value_type;
4730 typedef _UnaryOp<__tan_expr<value_type>, _Expr> _Op;
4731 return __val_expr<_Op>(_Op(__tan_expr<value_type>(), __x));
4734 template<class _Expr>
4735 inline _LIBCPP_INLINE_VISIBILITY
4738 __is_val_expr<_Expr>::value,
4739 __val_expr<_UnaryOp<__tanh_expr<typename _Expr::value_type>, _Expr> >
4741 tanh(const _Expr& __x)
4743 typedef typename _Expr::value_type value_type;
4744 typedef _UnaryOp<__tanh_expr<value_type>, _Expr> _Op;
4745 return __val_expr<_Op>(_Op(__tanh_expr<value_type>(), __x));
4748 template <class _Tp>
4749 inline _LIBCPP_INLINE_VISIBILITY
4751 begin(valarray<_Tp>& __v)
4753 return __v.__begin_;
4756 template <class _Tp>
4757 inline _LIBCPP_INLINE_VISIBILITY
4759 begin(const valarray<_Tp>& __v)
4761 return __v.__begin_;
4764 template <class _Tp>
4765 inline _LIBCPP_INLINE_VISIBILITY
4767 end(valarray<_Tp>& __v)
4772 template <class _Tp>
4773 inline _LIBCPP_INLINE_VISIBILITY
4775 end(const valarray<_Tp>& __v)
4780 _LIBCPP_END_NAMESPACE_STD
4782 #endif // _LIBCPP_VALARRAY