2 //===-------------------------- valarray ----------------------------------===//
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP_VALARRAY
11 #define _LIBCPP_VALARRAY
27 explicit valarray(size_t n);
28 valarray(const value_type& x, size_t n);
29 valarray(const value_type* px, size_t n);
30 valarray(const valarray& v);
31 valarray(valarray&& v) noexcept;
32 valarray(const slice_array<value_type>& sa);
33 valarray(const gslice_array<value_type>& ga);
34 valarray(const mask_array<value_type>& ma);
35 valarray(const indirect_array<value_type>& ia);
36 valarray(initializer_list<value_type> il);
40 valarray& operator=(const valarray& v);
41 valarray& operator=(valarray&& v) noexcept;
42 valarray& operator=(initializer_list<value_type> il);
43 valarray& operator=(const value_type& x);
44 valarray& operator=(const slice_array<value_type>& sa);
45 valarray& operator=(const gslice_array<value_type>& ga);
46 valarray& operator=(const mask_array<value_type>& ma);
47 valarray& operator=(const indirect_array<value_type>& ia);
50 const value_type& operator[](size_t i) const;
51 value_type& operator[](size_t i);
54 valarray operator[](slice s) const;
55 slice_array<value_type> operator[](slice s);
56 valarray operator[](const gslice& gs) const;
57 gslice_array<value_type> operator[](const gslice& gs);
58 valarray operator[](const valarray<bool>& vb) const;
59 mask_array<value_type> operator[](const valarray<bool>& vb);
60 valarray operator[](const valarray<size_t>& vs) const;
61 indirect_array<value_type> operator[](const valarray<size_t>& vs);
64 valarray operator+() const;
65 valarray operator-() const;
66 valarray operator~() const;
67 valarray<bool> operator!() const;
69 // computed assignment:
70 valarray& operator*= (const value_type& x);
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);
81 valarray& operator*= (const valarray& v);
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);
93 void swap(valarray& v) noexcept;
97 value_type sum() const;
98 value_type min() const;
99 value_type max() const;
101 valarray shift (int i) const;
102 valarray cshift(int i) const;
103 valarray apply(value_type f(value_type)) const;
104 valarray apply(value_type f(const value_type&)) const;
105 void resize(size_t n, value_type x = value_type());
112 slice(size_t start, size_t size, size_t stride);
114 size_t start() const;
116 size_t stride() const;
123 typedef T value_type;
125 const slice_array& operator=(const slice_array& sa) const;
126 void operator= (const valarray<value_type>& v) 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;
138 void operator=(const value_type& x) const;
140 slice_array() = delete;
147 gslice(size_t start, const valarray<size_t>& size,
148 const valarray<size_t>& stride);
150 size_t start() const;
151 valarray<size_t> size() const;
152 valarray<size_t> stride() const;
159 typedef T value_type;
161 void operator= (const valarray<value_type>& v) const;
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;
173 gslice_array(const gslice_array& ga);
175 const gslice_array& operator=(const gslice_array& ga) const;
176 void operator=(const value_type& x) const;
178 gslice_array() = delete;
185 typedef T value_type;
187 void operator= (const valarray<value_type>& v) const;
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;
199 mask_array(const mask_array& ma);
201 const mask_array& operator=(const mask_array& ma) const;
202 void operator=(const value_type& x) const;
204 mask_array() = delete;
211 typedef T value_type;
213 void operator= (const valarray<value_type>& v) const;
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;
225 indirect_array(const indirect_array& ia);
227 const indirect_array& operator=(const indirect_array& ia) const;
228 void operator=(const value_type& x) const;
230 indirect_array() = delete;
233 template<class T> void swap(valarray<T>& x, valarray<T>& y) noexcept;
235 template<class T> valarray<T> operator* (const valarray<T>& x, const valarray<T>& y);
236 template<class T> valarray<T> operator* (const valarray<T>& x, const T& y);
237 template<class T> valarray<T> operator* (const T& x, const valarray<T>& y);
239 template<class T> valarray<T> operator/ (const valarray<T>& x, const valarray<T>& y);
240 template<class T> valarray<T> operator/ (const valarray<T>& x, const T& y);
241 template<class T> valarray<T> operator/ (const T& x, const valarray<T>& y);
243 template<class T> valarray<T> operator% (const valarray<T>& x, const valarray<T>& y);
244 template<class T> valarray<T> operator% (const valarray<T>& x, const T& y);
245 template<class T> valarray<T> operator% (const T& x, const valarray<T>& y);
247 template<class T> valarray<T> operator+ (const valarray<T>& x, const valarray<T>& y);
248 template<class T> valarray<T> operator+ (const valarray<T>& x, const T& y);
249 template<class T> valarray<T> operator+ (const T& x, const valarray<T>& y);
251 template<class T> valarray<T> operator- (const valarray<T>& x, const valarray<T>& y);
252 template<class T> valarray<T> operator- (const valarray<T>& x, const T& y);
253 template<class T> valarray<T> operator- (const T& x, const valarray<T>& y);
255 template<class T> valarray<T> operator^ (const valarray<T>& x, const valarray<T>& y);
256 template<class T> valarray<T> operator^ (const valarray<T>& x, const T& y);
257 template<class T> valarray<T> operator^ (const T& x, const valarray<T>& y);
259 template<class T> valarray<T> operator& (const valarray<T>& x, const valarray<T>& y);
260 template<class T> valarray<T> operator& (const valarray<T>& x, const T& y);
261 template<class T> valarray<T> operator& (const T& x, const valarray<T>& y);
263 template<class T> valarray<T> operator| (const valarray<T>& x, const valarray<T>& y);
264 template<class T> valarray<T> operator| (const valarray<T>& x, const T& y);
265 template<class T> valarray<T> operator| (const T& x, const valarray<T>& y);
267 template<class T> valarray<T> operator<<(const valarray<T>& x, const valarray<T>& y);
268 template<class T> valarray<T> operator<<(const valarray<T>& x, const T& y);
269 template<class T> valarray<T> operator<<(const T& x, const valarray<T>& y);
271 template<class T> valarray<T> operator>>(const valarray<T>& x, const valarray<T>& y);
272 template<class T> valarray<T> operator>>(const valarray<T>& x, const T& y);
273 template<class T> valarray<T> operator>>(const T& x, const valarray<T>& y);
275 template<class T> valarray<bool> operator&&(const valarray<T>& x, const valarray<T>& y);
276 template<class T> valarray<bool> operator&&(const valarray<T>& x, const T& y);
277 template<class T> valarray<bool> operator&&(const T& x, const valarray<T>& y);
279 template<class T> valarray<bool> operator||(const valarray<T>& x, const valarray<T>& y);
280 template<class T> valarray<bool> operator||(const valarray<T>& x, const T& y);
281 template<class T> valarray<bool> operator||(const T& x, const valarray<T>& y);
283 template<class T> valarray<bool> operator==(const valarray<T>& x, const valarray<T>& y);
284 template<class T> valarray<bool> operator==(const valarray<T>& x, const T& y);
285 template<class T> valarray<bool> operator==(const T& x, const valarray<T>& y);
287 template<class T> valarray<bool> operator!=(const valarray<T>& x, const valarray<T>& y);
288 template<class T> valarray<bool> operator!=(const valarray<T>& x, const T& y);
289 template<class T> valarray<bool> operator!=(const T& x, const valarray<T>& y);
291 template<class T> valarray<bool> operator< (const valarray<T>& x, const valarray<T>& y);
292 template<class T> valarray<bool> operator< (const valarray<T>& x, const T& y);
293 template<class T> valarray<bool> operator< (const T& x, const valarray<T>& y);
295 template<class T> valarray<bool> operator> (const valarray<T>& x, const valarray<T>& y);
296 template<class T> valarray<bool> operator> (const valarray<T>& x, const T& y);
297 template<class T> valarray<bool> operator> (const T& x, const valarray<T>& y);
299 template<class T> valarray<bool> operator<=(const valarray<T>& x, const valarray<T>& y);
300 template<class T> valarray<bool> operator<=(const valarray<T>& x, const T& y);
301 template<class T> valarray<bool> operator<=(const T& x, const valarray<T>& y);
303 template<class T> valarray<bool> operator>=(const valarray<T>& x, const valarray<T>& y);
304 template<class T> valarray<bool> operator>=(const valarray<T>& x, const T& y);
305 template<class T> valarray<bool> operator>=(const T& x, const valarray<T>& y);
307 template<class T> valarray<T> abs (const valarray<T>& x);
308 template<class T> valarray<T> acos (const valarray<T>& x);
309 template<class T> valarray<T> asin (const valarray<T>& x);
310 template<class T> valarray<T> atan (const valarray<T>& x);
312 template<class T> valarray<T> atan2(const valarray<T>& x, const valarray<T>& y);
313 template<class T> valarray<T> atan2(const valarray<T>& x, const T& y);
314 template<class T> valarray<T> atan2(const T& x, const valarray<T>& y);
316 template<class T> valarray<T> cos (const valarray<T>& x);
317 template<class T> valarray<T> cosh (const valarray<T>& x);
318 template<class T> valarray<T> exp (const valarray<T>& x);
319 template<class T> valarray<T> log (const valarray<T>& x);
320 template<class T> valarray<T> log10(const valarray<T>& x);
322 template<class T> valarray<T> pow(const valarray<T>& x, const valarray<T>& y);
323 template<class T> valarray<T> pow(const valarray<T>& x, const T& y);
324 template<class T> valarray<T> pow(const T& x, const valarray<T>& y);
326 template<class T> valarray<T> sin (const valarray<T>& x);
327 template<class T> valarray<T> sinh (const valarray<T>& x);
328 template<class T> valarray<T> sqrt (const valarray<T>& x);
329 template<class T> valarray<T> tan (const valarray<T>& x);
330 template<class T> valarray<T> tanh (const valarray<T>& x);
332 template <class T> unspecified1 begin(valarray<T>& v);
333 template <class T> unspecified2 begin(const valarray<T>& v);
334 template <class T> unspecified1 end(valarray<T>& v);
335 template <class T> unspecified2 end(const valarray<T>& v);
344 #include <initializer_list>
346 #include <functional>
349 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
350 #pragma GCC system_header
354 #include <__undef_macros>
357 _LIBCPP_BEGIN_NAMESPACE_STD
359 template<class _Tp> class _LIBCPP_TEMPLATE_VIS valarray;
361 class _LIBCPP_TEMPLATE_VIS slice
367 _LIBCPP_INLINE_VISIBILITY
374 _LIBCPP_INLINE_VISIBILITY
375 slice(size_t __start, size_t __size, size_t __stride)
381 _LIBCPP_INLINE_VISIBILITY size_t start() const {return __start_;}
382 _LIBCPP_INLINE_VISIBILITY size_t size() const {return __size_;}
383 _LIBCPP_INLINE_VISIBILITY size_t stride() const {return __stride_;}
386 template <class _Tp> class _LIBCPP_TEMPLATE_VIS slice_array;
387 class _LIBCPP_TYPE_VIS gslice;
388 template <class _Tp> class _LIBCPP_TEMPLATE_VIS gslice_array;
389 template <class _Tp> class _LIBCPP_TEMPLATE_VIS mask_array;
390 template <class _Tp> class _LIBCPP_TEMPLATE_VIS indirect_array;
393 _LIBCPP_INLINE_VISIBILITY
395 begin(valarray<_Tp>& __v);
398 _LIBCPP_INLINE_VISIBILITY
400 begin(const valarray<_Tp>& __v);
403 _LIBCPP_INLINE_VISIBILITY
405 end(valarray<_Tp>& __v);
408 _LIBCPP_INLINE_VISIBILITY
410 end(const valarray<_Tp>& __v);
412 template <class _Op, class _A0>
415 typedef typename _Op::result_type result_type;
416 typedef typename _A0::value_type value_type;
421 _LIBCPP_INLINE_VISIBILITY
422 _UnaryOp(const _Op& __op, const _A0& __a0) : __op_(__op), __a0_(__a0) {}
424 _LIBCPP_INLINE_VISIBILITY
425 result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
427 _LIBCPP_INLINE_VISIBILITY
428 size_t size() const {return __a0_.size();}
431 template <class _Op, class _A0, class _A1>
434 typedef typename _Op::result_type result_type;
435 typedef typename _A0::value_type value_type;
441 _LIBCPP_INLINE_VISIBILITY
442 _BinaryOp(const _Op& __op, const _A0& __a0, const _A1& __a1)
443 : __op_(__op), __a0_(__a0), __a1_(__a1) {}
445 _LIBCPP_INLINE_VISIBILITY
446 value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
448 _LIBCPP_INLINE_VISIBILITY
449 size_t size() const {return __a0_.size();}
456 typedef _Tp value_type;
457 typedef const _Tp& result_type;
459 const value_type& __t_;
462 _LIBCPP_INLINE_VISIBILITY
463 explicit __scalar_expr(const value_type& __t, size_t __s) : __t_(__t), __s_(__s) {}
465 _LIBCPP_INLINE_VISIBILITY
466 result_type operator[](size_t) const {return __t_;}
468 _LIBCPP_INLINE_VISIBILITY
469 size_t size() const {return __s_;}
473 struct __unary_plus : unary_function<_Tp, _Tp>
475 _LIBCPP_INLINE_VISIBILITY
476 _Tp operator()(const _Tp& __x) const
481 struct __bit_not : unary_function<_Tp, _Tp>
483 _LIBCPP_INLINE_VISIBILITY
484 _Tp operator()(const _Tp& __x) const
489 struct __bit_shift_left : binary_function<_Tp, _Tp, _Tp>
491 _LIBCPP_INLINE_VISIBILITY
492 _Tp operator()(const _Tp& __x, const _Tp& __y) const
497 struct __bit_shift_right : binary_function<_Tp, _Tp, _Tp>
499 _LIBCPP_INLINE_VISIBILITY
500 _Tp operator()(const _Tp& __x, const _Tp& __y) const
504 template <class _Tp, class _Fp>
505 struct __apply_expr : unary_function<_Tp, _Tp>
510 _LIBCPP_INLINE_VISIBILITY
511 explicit __apply_expr(_Fp __f) : __f_(__f) {}
513 _LIBCPP_INLINE_VISIBILITY
514 _Tp operator()(const _Tp& __x) const
519 struct __abs_expr : unary_function<_Tp, _Tp>
521 _LIBCPP_INLINE_VISIBILITY
522 _Tp operator()(const _Tp& __x) const
527 struct __acos_expr : unary_function<_Tp, _Tp>
529 _LIBCPP_INLINE_VISIBILITY
530 _Tp operator()(const _Tp& __x) const
535 struct __asin_expr : unary_function<_Tp, _Tp>
537 _LIBCPP_INLINE_VISIBILITY
538 _Tp operator()(const _Tp& __x) const
543 struct __atan_expr : unary_function<_Tp, _Tp>
545 _LIBCPP_INLINE_VISIBILITY
546 _Tp operator()(const _Tp& __x) const
551 struct __atan2_expr : binary_function<_Tp, _Tp, _Tp>
553 _LIBCPP_INLINE_VISIBILITY
554 _Tp operator()(const _Tp& __x, const _Tp& __y) const
555 {return atan2(__x, __y);}
559 struct __cos_expr : unary_function<_Tp, _Tp>
561 _LIBCPP_INLINE_VISIBILITY
562 _Tp operator()(const _Tp& __x) const
567 struct __cosh_expr : unary_function<_Tp, _Tp>
569 _LIBCPP_INLINE_VISIBILITY
570 _Tp operator()(const _Tp& __x) const
575 struct __exp_expr : unary_function<_Tp, _Tp>
577 _LIBCPP_INLINE_VISIBILITY
578 _Tp operator()(const _Tp& __x) const
583 struct __log_expr : unary_function<_Tp, _Tp>
585 _LIBCPP_INLINE_VISIBILITY
586 _Tp operator()(const _Tp& __x) const
591 struct __log10_expr : unary_function<_Tp, _Tp>
593 _LIBCPP_INLINE_VISIBILITY
594 _Tp operator()(const _Tp& __x) const
599 struct __pow_expr : binary_function<_Tp, _Tp, _Tp>
601 _LIBCPP_INLINE_VISIBILITY
602 _Tp operator()(const _Tp& __x, const _Tp& __y) const
603 {return pow(__x, __y);}
607 struct __sin_expr : unary_function<_Tp, _Tp>
609 _LIBCPP_INLINE_VISIBILITY
610 _Tp operator()(const _Tp& __x) const
615 struct __sinh_expr : unary_function<_Tp, _Tp>
617 _LIBCPP_INLINE_VISIBILITY
618 _Tp operator()(const _Tp& __x) const
623 struct __sqrt_expr : unary_function<_Tp, _Tp>
625 _LIBCPP_INLINE_VISIBILITY
626 _Tp operator()(const _Tp& __x) const
631 struct __tan_expr : unary_function<_Tp, _Tp>
633 _LIBCPP_INLINE_VISIBILITY
634 _Tp operator()(const _Tp& __x) const
639 struct __tanh_expr : unary_function<_Tp, _Tp>
641 _LIBCPP_INLINE_VISIBILITY
642 _Tp operator()(const _Tp& __x) const
646 template <class _ValExpr>
649 typedef typename remove_reference<_ValExpr>::type _RmExpr;
651 typedef typename _RmExpr::value_type value_type;
652 typedef value_type result_type;
660 _LIBCPP_INLINE_VISIBILITY
661 __slice_expr(const slice& __sl, const _RmExpr& __e)
663 __start_(__sl.start()),
664 __size_(__sl.size()),
665 __stride_(__sl.stride())
669 _LIBCPP_INLINE_VISIBILITY
670 result_type operator[](size_t __i) const
671 {return __expr_[__start_ + __i * __stride_];}
673 _LIBCPP_INLINE_VISIBILITY
674 size_t size() const {return __size_;}
676 template <class> friend class __val_expr;
677 template <class> friend class _LIBCPP_TEMPLATE_VIS valarray;
680 template <class _ValExpr>
683 template <class _ValExpr>
684 class __indirect_expr;
686 template <class _ValExpr>
689 typedef typename remove_reference<_ValExpr>::type _RmExpr;
691 typedef typename _RmExpr::value_type value_type;
692 typedef value_type result_type;
700 static const ptrdiff_t _Np = static_cast<ptrdiff_t>(
701 sizeof(ptrdiff_t) * __CHAR_BIT__ - 1);
703 _LIBCPP_INLINE_VISIBILITY
704 __shift_expr(int __n, const _RmExpr& __e)
709 ptrdiff_t __neg_n = static_cast<ptrdiff_t>(__n_ >> _Np);
710 __sn_ = __neg_n | static_cast<ptrdiff_t>(static_cast<size_t>(-__n_) >> _Np);
711 __ul_ = ((__size_ - __n_) & ~__neg_n) | ((__n_ + 1) & __neg_n);
715 _LIBCPP_INLINE_VISIBILITY
716 result_type operator[](size_t __j) const
718 ptrdiff_t __i = static_cast<ptrdiff_t>(__j);
719 ptrdiff_t __m = (__sn_ * __i - __ul_) >> _Np;
720 return (__expr_[(__i + __n_) & __m] & __m) | (value_type() & ~__m);
723 _LIBCPP_INLINE_VISIBILITY
724 size_t size() const {return __size_;}
726 template <class> friend class __val_expr;
729 template <class _ValExpr>
732 typedef typename remove_reference<_ValExpr>::type _RmExpr;
734 typedef typename _RmExpr::value_type value_type;
735 typedef value_type result_type;
744 _LIBCPP_INLINE_VISIBILITY
745 __cshift_expr(int __n, const _RmExpr& __e)
749 __n %= static_cast<int>(__size_);
752 __m_ = __size_ - __n;
754 __o2_ = __n - __size_;
759 __o1_ = __n + __size_;
765 _LIBCPP_INLINE_VISIBILITY
766 result_type operator[](size_t __i) const
769 return __expr_[__i + __o1_];
770 return __expr_[__i + __o2_];
773 _LIBCPP_INLINE_VISIBILITY
774 size_t size() const {return __size_;}
776 template <class> friend class __val_expr;
779 template<class _ValExpr>
782 template<class _ValExpr>
783 struct __is_val_expr : false_type {};
785 template<class _ValExpr>
786 struct __is_val_expr<__val_expr<_ValExpr> > : true_type {};
789 struct __is_val_expr<valarray<_Tp> > : true_type {};
792 class _LIBCPP_TEMPLATE_VIS valarray
795 typedef _Tp value_type;
796 typedef _Tp result_type;
799 value_type* __begin_;
803 // construct/destroy:
804 _LIBCPP_INLINE_VISIBILITY
805 valarray() : __begin_(0), __end_(0) {}
806 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
807 explicit valarray(size_t __n);
808 _LIBCPP_INLINE_VISIBILITY
809 valarray(const value_type& __x, size_t __n);
810 valarray(const value_type* __p, size_t __n);
811 valarray(const valarray& __v);
812 #ifndef _LIBCPP_CXX03_LANG
813 _LIBCPP_INLINE_VISIBILITY
814 valarray(valarray&& __v) _NOEXCEPT;
815 valarray(initializer_list<value_type> __il);
816 #endif // _LIBCPP_CXX03_LANG
817 valarray(const slice_array<value_type>& __sa);
818 valarray(const gslice_array<value_type>& __ga);
819 valarray(const mask_array<value_type>& __ma);
820 valarray(const indirect_array<value_type>& __ia);
821 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
825 valarray& operator=(const valarray& __v);
826 #ifndef _LIBCPP_CXX03_LANG
827 _LIBCPP_INLINE_VISIBILITY
828 valarray& operator=(valarray&& __v) _NOEXCEPT;
829 _LIBCPP_INLINE_VISIBILITY
830 valarray& operator=(initializer_list<value_type>);
831 #endif // _LIBCPP_CXX03_LANG
832 _LIBCPP_INLINE_VISIBILITY
833 valarray& operator=(const value_type& __x);
834 _LIBCPP_INLINE_VISIBILITY
835 valarray& operator=(const slice_array<value_type>& __sa);
836 _LIBCPP_INLINE_VISIBILITY
837 valarray& operator=(const gslice_array<value_type>& __ga);
838 _LIBCPP_INLINE_VISIBILITY
839 valarray& operator=(const mask_array<value_type>& __ma);
840 _LIBCPP_INLINE_VISIBILITY
841 valarray& operator=(const indirect_array<value_type>& __ia);
842 template <class _ValExpr>
843 _LIBCPP_INLINE_VISIBILITY
844 valarray& operator=(const __val_expr<_ValExpr>& __v);
847 _LIBCPP_INLINE_VISIBILITY
848 const value_type& operator[](size_t __i) const {return __begin_[__i];}
850 _LIBCPP_INLINE_VISIBILITY
851 value_type& operator[](size_t __i) {return __begin_[__i];}
853 // subset operations:
854 _LIBCPP_INLINE_VISIBILITY
855 __val_expr<__slice_expr<const valarray&> > operator[](slice __s) const;
856 _LIBCPP_INLINE_VISIBILITY
857 slice_array<value_type> operator[](slice __s);
858 _LIBCPP_INLINE_VISIBILITY
859 __val_expr<__indirect_expr<const valarray&> > operator[](const gslice& __gs) const;
860 _LIBCPP_INLINE_VISIBILITY
861 gslice_array<value_type> operator[](const gslice& __gs);
862 #ifndef _LIBCPP_CXX03_LANG
863 _LIBCPP_INLINE_VISIBILITY
864 __val_expr<__indirect_expr<const valarray&> > operator[](gslice&& __gs) const;
865 _LIBCPP_INLINE_VISIBILITY
866 gslice_array<value_type> operator[](gslice&& __gs);
867 #endif // _LIBCPP_CXX03_LANG
868 _LIBCPP_INLINE_VISIBILITY
869 __val_expr<__mask_expr<const valarray&> > operator[](const valarray<bool>& __vb) const;
870 _LIBCPP_INLINE_VISIBILITY
871 mask_array<value_type> operator[](const valarray<bool>& __vb);
872 #ifndef _LIBCPP_CXX03_LANG
873 _LIBCPP_INLINE_VISIBILITY
874 __val_expr<__mask_expr<const valarray&> > operator[](valarray<bool>&& __vb) const;
875 _LIBCPP_INLINE_VISIBILITY
876 mask_array<value_type> operator[](valarray<bool>&& __vb);
877 #endif // _LIBCPP_CXX03_LANG
878 _LIBCPP_INLINE_VISIBILITY
879 __val_expr<__indirect_expr<const valarray&> > operator[](const valarray<size_t>& __vs) const;
880 _LIBCPP_INLINE_VISIBILITY
881 indirect_array<value_type> operator[](const valarray<size_t>& __vs);
882 #ifndef _LIBCPP_CXX03_LANG
883 _LIBCPP_INLINE_VISIBILITY
884 __val_expr<__indirect_expr<const valarray&> > operator[](valarray<size_t>&& __vs) const;
885 _LIBCPP_INLINE_VISIBILITY
886 indirect_array<value_type> operator[](valarray<size_t>&& __vs);
887 #endif // _LIBCPP_CXX03_LANG
890 valarray operator+() const;
891 valarray operator-() const;
892 valarray operator~() const;
893 valarray<bool> operator!() const;
895 // computed assignment:
896 _LIBCPP_INLINE_VISIBILITY
897 valarray& operator*= (const value_type& __x);
898 _LIBCPP_INLINE_VISIBILITY
899 valarray& operator/= (const value_type& __x);
900 _LIBCPP_INLINE_VISIBILITY
901 valarray& operator%= (const value_type& __x);
902 _LIBCPP_INLINE_VISIBILITY
903 valarray& operator+= (const value_type& __x);
904 _LIBCPP_INLINE_VISIBILITY
905 valarray& operator-= (const value_type& __x);
906 _LIBCPP_INLINE_VISIBILITY
907 valarray& operator^= (const value_type& __x);
908 _LIBCPP_INLINE_VISIBILITY
909 valarray& operator&= (const value_type& __x);
910 _LIBCPP_INLINE_VISIBILITY
911 valarray& operator|= (const value_type& __x);
912 _LIBCPP_INLINE_VISIBILITY
913 valarray& operator<<=(const value_type& __x);
914 _LIBCPP_INLINE_VISIBILITY
915 valarray& operator>>=(const value_type& __x);
917 template <class _Expr>
920 __is_val_expr<_Expr>::value,
923 _LIBCPP_INLINE_VISIBILITY
924 operator*= (const _Expr& __v);
926 template <class _Expr>
929 __is_val_expr<_Expr>::value,
932 _LIBCPP_INLINE_VISIBILITY
933 operator/= (const _Expr& __v);
935 template <class _Expr>
938 __is_val_expr<_Expr>::value,
941 _LIBCPP_INLINE_VISIBILITY
942 operator%= (const _Expr& __v);
944 template <class _Expr>
947 __is_val_expr<_Expr>::value,
950 _LIBCPP_INLINE_VISIBILITY
951 operator+= (const _Expr& __v);
953 template <class _Expr>
956 __is_val_expr<_Expr>::value,
959 _LIBCPP_INLINE_VISIBILITY
960 operator-= (const _Expr& __v);
962 template <class _Expr>
965 __is_val_expr<_Expr>::value,
968 _LIBCPP_INLINE_VISIBILITY
969 operator^= (const _Expr& __v);
971 template <class _Expr>
974 __is_val_expr<_Expr>::value,
977 _LIBCPP_INLINE_VISIBILITY
978 operator|= (const _Expr& __v);
980 template <class _Expr>
983 __is_val_expr<_Expr>::value,
986 _LIBCPP_INLINE_VISIBILITY
987 operator&= (const _Expr& __v);
989 template <class _Expr>
992 __is_val_expr<_Expr>::value,
995 _LIBCPP_INLINE_VISIBILITY
996 operator<<= (const _Expr& __v);
998 template <class _Expr>
1001 __is_val_expr<_Expr>::value,
1004 _LIBCPP_INLINE_VISIBILITY
1005 operator>>= (const _Expr& __v);
1007 // member functions:
1008 _LIBCPP_INLINE_VISIBILITY
1009 void swap(valarray& __v) _NOEXCEPT;
1011 _LIBCPP_INLINE_VISIBILITY
1012 size_t size() const {return static_cast<size_t>(__end_ - __begin_);}
1014 _LIBCPP_INLINE_VISIBILITY
1015 value_type sum() const;
1016 _LIBCPP_INLINE_VISIBILITY
1017 value_type min() const;
1018 _LIBCPP_INLINE_VISIBILITY
1019 value_type max() const;
1021 valarray shift (int __i) const;
1022 valarray cshift(int __i) const;
1023 valarray apply(value_type __f(value_type)) const;
1024 valarray apply(value_type __f(const value_type&)) const;
1025 void resize(size_t __n, value_type __x = value_type());
1028 template <class> friend class _LIBCPP_TEMPLATE_VIS valarray;
1029 template <class> friend class _LIBCPP_TEMPLATE_VIS slice_array;
1030 template <class> friend class _LIBCPP_TEMPLATE_VIS gslice_array;
1031 template <class> friend class _LIBCPP_TEMPLATE_VIS mask_array;
1032 template <class> friend class __mask_expr;
1033 template <class> friend class _LIBCPP_TEMPLATE_VIS indirect_array;
1034 template <class> friend class __indirect_expr;
1035 template <class> friend class __val_expr;
1037 template <class _Up>
1040 begin(valarray<_Up>& __v);
1042 template <class _Up>
1045 begin(const valarray<_Up>& __v);
1047 template <class _Up>
1050 end(valarray<_Up>& __v);
1052 template <class _Up>
1055 end(const valarray<_Up>& __v);
1057 _LIBCPP_INLINE_VISIBILITY
1058 void __clear(size_t __capacity);
1059 valarray& __assign_range(const value_type* __f, const value_type* __l);
1062 _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void valarray<size_t>::resize(size_t, size_t))
1064 template <class _Op, class _Tp>
1065 struct _UnaryOp<_Op, valarray<_Tp> >
1067 typedef typename _Op::result_type result_type;
1068 typedef _Tp value_type;
1071 const valarray<_Tp>& __a0_;
1073 _LIBCPP_INLINE_VISIBILITY
1074 _UnaryOp(const _Op& __op, const valarray<_Tp>& __a0) : __op_(__op), __a0_(__a0) {}
1076 _LIBCPP_INLINE_VISIBILITY
1077 result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
1079 _LIBCPP_INLINE_VISIBILITY
1080 size_t size() const {return __a0_.size();}
1083 template <class _Op, class _Tp, class _A1>
1084 struct _BinaryOp<_Op, valarray<_Tp>, _A1>
1086 typedef typename _Op::result_type result_type;
1087 typedef _Tp value_type;
1090 const valarray<_Tp>& __a0_;
1093 _LIBCPP_INLINE_VISIBILITY
1094 _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const _A1& __a1)
1095 : __op_(__op), __a0_(__a0), __a1_(__a1) {}
1097 _LIBCPP_INLINE_VISIBILITY
1098 value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
1100 _LIBCPP_INLINE_VISIBILITY
1101 size_t size() const {return __a0_.size();}
1104 template <class _Op, class _A0, class _Tp>
1105 struct _BinaryOp<_Op, _A0, valarray<_Tp> >
1107 typedef typename _Op::result_type result_type;
1108 typedef _Tp value_type;
1112 const valarray<_Tp>& __a1_;
1114 _LIBCPP_INLINE_VISIBILITY
1115 _BinaryOp(const _Op& __op, const _A0& __a0, const valarray<_Tp>& __a1)
1116 : __op_(__op), __a0_(__a0), __a1_(__a1) {}
1118 _LIBCPP_INLINE_VISIBILITY
1119 value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
1121 _LIBCPP_INLINE_VISIBILITY
1122 size_t size() const {return __a0_.size();}
1125 template <class _Op, class _Tp>
1126 struct _BinaryOp<_Op, valarray<_Tp>, valarray<_Tp> >
1128 typedef typename _Op::result_type result_type;
1129 typedef _Tp value_type;
1132 const valarray<_Tp>& __a0_;
1133 const valarray<_Tp>& __a1_;
1135 _LIBCPP_INLINE_VISIBILITY
1136 _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const valarray<_Tp>& __a1)
1137 : __op_(__op), __a0_(__a0), __a1_(__a1) {}
1139 _LIBCPP_INLINE_VISIBILITY
1140 value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
1142 _LIBCPP_INLINE_VISIBILITY
1143 size_t size() const {return __a0_.size();}
1148 template <class _Tp>
1149 class _LIBCPP_TEMPLATE_VIS slice_array
1152 typedef _Tp value_type;
1160 template <class _Expr>
1163 __is_val_expr<_Expr>::value,
1166 _LIBCPP_INLINE_VISIBILITY
1167 operator=(const _Expr& __v) const;
1169 template <class _Expr>
1172 __is_val_expr<_Expr>::value,
1175 _LIBCPP_INLINE_VISIBILITY
1176 operator*=(const _Expr& __v) const;
1178 template <class _Expr>
1181 __is_val_expr<_Expr>::value,
1184 _LIBCPP_INLINE_VISIBILITY
1185 operator/=(const _Expr& __v) const;
1187 template <class _Expr>
1190 __is_val_expr<_Expr>::value,
1193 _LIBCPP_INLINE_VISIBILITY
1194 operator%=(const _Expr& __v) const;
1196 template <class _Expr>
1199 __is_val_expr<_Expr>::value,
1202 _LIBCPP_INLINE_VISIBILITY
1203 operator+=(const _Expr& __v) const;
1205 template <class _Expr>
1208 __is_val_expr<_Expr>::value,
1211 _LIBCPP_INLINE_VISIBILITY
1212 operator-=(const _Expr& __v) const;
1214 template <class _Expr>
1217 __is_val_expr<_Expr>::value,
1220 _LIBCPP_INLINE_VISIBILITY
1221 operator^=(const _Expr& __v) const;
1223 template <class _Expr>
1226 __is_val_expr<_Expr>::value,
1229 _LIBCPP_INLINE_VISIBILITY
1230 operator&=(const _Expr& __v) const;
1232 template <class _Expr>
1235 __is_val_expr<_Expr>::value,
1238 _LIBCPP_INLINE_VISIBILITY
1239 operator|=(const _Expr& __v) const;
1241 template <class _Expr>
1244 __is_val_expr<_Expr>::value,
1247 _LIBCPP_INLINE_VISIBILITY
1248 operator<<=(const _Expr& __v) const;
1250 template <class _Expr>
1253 __is_val_expr<_Expr>::value,
1256 _LIBCPP_INLINE_VISIBILITY
1257 operator>>=(const _Expr& __v) const;
1259 _LIBCPP_INLINE_VISIBILITY
1260 const slice_array& operator=(const slice_array& __sa) const;
1262 _LIBCPP_INLINE_VISIBILITY
1263 void operator=(const value_type& __x) const;
1266 _LIBCPP_INLINE_VISIBILITY
1267 slice_array(const slice& __sl, const valarray<value_type>& __v)
1268 : __vp_(const_cast<value_type*>(__v.__begin_ + __sl.start())),
1269 __size_(__sl.size()),
1270 __stride_(__sl.stride())
1273 template <class> friend class valarray;
1274 template <class> friend class sliceExpr;
1277 template <class _Tp>
1279 const slice_array<_Tp>&
1280 slice_array<_Tp>::operator=(const slice_array& __sa) const
1282 value_type* __t = __vp_;
1283 const value_type* __s = __sa.__vp_;
1284 for (size_t __n = __size_; __n; --__n, __t += __stride_, __s += __sa.__stride_)
1289 template <class _Tp>
1290 template <class _Expr>
1294 __is_val_expr<_Expr>::value,
1297 slice_array<_Tp>::operator=(const _Expr& __v) const
1299 value_type* __t = __vp_;
1300 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1304 template <class _Tp>
1305 template <class _Expr>
1309 __is_val_expr<_Expr>::value,
1312 slice_array<_Tp>::operator*=(const _Expr& __v) const
1314 value_type* __t = __vp_;
1315 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1319 template <class _Tp>
1320 template <class _Expr>
1324 __is_val_expr<_Expr>::value,
1327 slice_array<_Tp>::operator/=(const _Expr& __v) const
1329 value_type* __t = __vp_;
1330 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1334 template <class _Tp>
1335 template <class _Expr>
1339 __is_val_expr<_Expr>::value,
1342 slice_array<_Tp>::operator%=(const _Expr& __v) const
1344 value_type* __t = __vp_;
1345 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1349 template <class _Tp>
1350 template <class _Expr>
1354 __is_val_expr<_Expr>::value,
1357 slice_array<_Tp>::operator+=(const _Expr& __v) const
1359 value_type* __t = __vp_;
1360 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1364 template <class _Tp>
1365 template <class _Expr>
1369 __is_val_expr<_Expr>::value,
1372 slice_array<_Tp>::operator-=(const _Expr& __v) const
1374 value_type* __t = __vp_;
1375 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1379 template <class _Tp>
1380 template <class _Expr>
1384 __is_val_expr<_Expr>::value,
1387 slice_array<_Tp>::operator^=(const _Expr& __v) const
1389 value_type* __t = __vp_;
1390 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1394 template <class _Tp>
1395 template <class _Expr>
1399 __is_val_expr<_Expr>::value,
1402 slice_array<_Tp>::operator&=(const _Expr& __v) const
1404 value_type* __t = __vp_;
1405 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1409 template <class _Tp>
1410 template <class _Expr>
1414 __is_val_expr<_Expr>::value,
1417 slice_array<_Tp>::operator|=(const _Expr& __v) const
1419 value_type* __t = __vp_;
1420 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1424 template <class _Tp>
1425 template <class _Expr>
1429 __is_val_expr<_Expr>::value,
1432 slice_array<_Tp>::operator<<=(const _Expr& __v) const
1434 value_type* __t = __vp_;
1435 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1439 template <class _Tp>
1440 template <class _Expr>
1444 __is_val_expr<_Expr>::value,
1447 slice_array<_Tp>::operator>>=(const _Expr& __v) const
1449 value_type* __t = __vp_;
1450 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1454 template <class _Tp>
1457 slice_array<_Tp>::operator=(const value_type& __x) const
1459 value_type* __t = __vp_;
1460 for (size_t __n = __size_; __n; --__n, __t += __stride_)
1466 class _LIBCPP_TYPE_VIS gslice
1468 valarray<size_t> __size_;
1469 valarray<size_t> __stride_;
1470 valarray<size_t> __1d_;
1473 _LIBCPP_INLINE_VISIBILITY
1476 _LIBCPP_INLINE_VISIBILITY
1477 gslice(size_t __start, const valarray<size_t>& __size,
1478 const valarray<size_t>& __stride)
1483 #ifndef _LIBCPP_CXX03_LANG
1485 _LIBCPP_INLINE_VISIBILITY
1486 gslice(size_t __start, const valarray<size_t>& __size,
1487 valarray<size_t>&& __stride)
1489 __stride_(move(__stride))
1492 _LIBCPP_INLINE_VISIBILITY
1493 gslice(size_t __start, valarray<size_t>&& __size,
1494 const valarray<size_t>& __stride)
1495 : __size_(move(__size)),
1499 _LIBCPP_INLINE_VISIBILITY
1500 gslice(size_t __start, valarray<size_t>&& __size,
1501 valarray<size_t>&& __stride)
1502 : __size_(move(__size)),
1503 __stride_(move(__stride))
1506 #endif // _LIBCPP_CXX03_LANG
1508 // gslice(const gslice&) = default;
1509 // gslice(gslice&&) = default;
1510 // gslice& operator=(const gslice&) = default;
1511 // gslice& operator=(gslice&&) = default;
1513 _LIBCPP_INLINE_VISIBILITY
1514 size_t start() const {return __1d_.size() ? __1d_[0] : 0;}
1516 _LIBCPP_INLINE_VISIBILITY
1517 valarray<size_t> size() const {return __size_;}
1519 _LIBCPP_INLINE_VISIBILITY
1520 valarray<size_t> stride() const {return __stride_;}
1523 void __init(size_t __start);
1525 template <class> friend class gslice_array;
1526 template <class> friend class valarray;
1527 template <class> friend class __val_expr;
1532 template <class _Tp>
1533 class _LIBCPP_TEMPLATE_VIS gslice_array
1536 typedef _Tp value_type;
1540 valarray<size_t> __1d_;
1543 template <class _Expr>
1546 __is_val_expr<_Expr>::value,
1549 _LIBCPP_INLINE_VISIBILITY
1550 operator=(const _Expr& __v) const;
1552 template <class _Expr>
1555 __is_val_expr<_Expr>::value,
1558 _LIBCPP_INLINE_VISIBILITY
1559 operator*=(const _Expr& __v) const;
1561 template <class _Expr>
1564 __is_val_expr<_Expr>::value,
1567 _LIBCPP_INLINE_VISIBILITY
1568 operator/=(const _Expr& __v) const;
1570 template <class _Expr>
1573 __is_val_expr<_Expr>::value,
1576 _LIBCPP_INLINE_VISIBILITY
1577 operator%=(const _Expr& __v) const;
1579 template <class _Expr>
1582 __is_val_expr<_Expr>::value,
1585 _LIBCPP_INLINE_VISIBILITY
1586 operator+=(const _Expr& __v) const;
1588 template <class _Expr>
1591 __is_val_expr<_Expr>::value,
1594 _LIBCPP_INLINE_VISIBILITY
1595 operator-=(const _Expr& __v) const;
1597 template <class _Expr>
1600 __is_val_expr<_Expr>::value,
1603 _LIBCPP_INLINE_VISIBILITY
1604 operator^=(const _Expr& __v) const;
1606 template <class _Expr>
1609 __is_val_expr<_Expr>::value,
1612 _LIBCPP_INLINE_VISIBILITY
1613 operator&=(const _Expr& __v) const;
1615 template <class _Expr>
1618 __is_val_expr<_Expr>::value,
1621 _LIBCPP_INLINE_VISIBILITY
1622 operator|=(const _Expr& __v) const;
1624 template <class _Expr>
1627 __is_val_expr<_Expr>::value,
1630 _LIBCPP_INLINE_VISIBILITY
1631 operator<<=(const _Expr& __v) const;
1633 template <class _Expr>
1636 __is_val_expr<_Expr>::value,
1639 _LIBCPP_INLINE_VISIBILITY
1640 operator>>=(const _Expr& __v) const;
1642 _LIBCPP_INLINE_VISIBILITY
1643 const gslice_array& operator=(const gslice_array& __ga) const;
1645 _LIBCPP_INLINE_VISIBILITY
1646 void operator=(const value_type& __x) const;
1648 // gslice_array(const gslice_array&) = default;
1649 // gslice_array(gslice_array&&) = default;
1650 // gslice_array& operator=(const gslice_array&) = default;
1651 // gslice_array& operator=(gslice_array&&) = default;
1654 gslice_array(const gslice& __gs, const valarray<value_type>& __v)
1655 : __vp_(const_cast<value_type*>(__v.__begin_)),
1659 #ifndef _LIBCPP_CXX03_LANG
1660 gslice_array(gslice&& __gs, const valarray<value_type>& __v)
1661 : __vp_(const_cast<value_type*>(__v.__begin_)),
1662 __1d_(move(__gs.__1d_))
1664 #endif // _LIBCPP_CXX03_LANG
1666 template <class> friend class valarray;
1669 template <class _Tp>
1670 template <class _Expr>
1674 __is_val_expr<_Expr>::value,
1677 gslice_array<_Tp>::operator=(const _Expr& __v) const
1679 typedef const size_t* _Ip;
1681 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1682 __vp_[*__i] = __v[__j];
1685 template <class _Tp>
1686 template <class _Expr>
1690 __is_val_expr<_Expr>::value,
1693 gslice_array<_Tp>::operator*=(const _Expr& __v) const
1695 typedef const size_t* _Ip;
1697 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1698 __vp_[*__i] *= __v[__j];
1701 template <class _Tp>
1702 template <class _Expr>
1706 __is_val_expr<_Expr>::value,
1709 gslice_array<_Tp>::operator/=(const _Expr& __v) const
1711 typedef const size_t* _Ip;
1713 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1714 __vp_[*__i] /= __v[__j];
1717 template <class _Tp>
1718 template <class _Expr>
1722 __is_val_expr<_Expr>::value,
1725 gslice_array<_Tp>::operator%=(const _Expr& __v) const
1727 typedef const size_t* _Ip;
1729 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1730 __vp_[*__i] %= __v[__j];
1733 template <class _Tp>
1734 template <class _Expr>
1738 __is_val_expr<_Expr>::value,
1741 gslice_array<_Tp>::operator+=(const _Expr& __v) const
1743 typedef const size_t* _Ip;
1745 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1746 __vp_[*__i] += __v[__j];
1749 template <class _Tp>
1750 template <class _Expr>
1754 __is_val_expr<_Expr>::value,
1757 gslice_array<_Tp>::operator-=(const _Expr& __v) const
1759 typedef const size_t* _Ip;
1761 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1762 __vp_[*__i] -= __v[__j];
1765 template <class _Tp>
1766 template <class _Expr>
1770 __is_val_expr<_Expr>::value,
1773 gslice_array<_Tp>::operator^=(const _Expr& __v) const
1775 typedef const size_t* _Ip;
1777 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1778 __vp_[*__i] ^= __v[__j];
1781 template <class _Tp>
1782 template <class _Expr>
1786 __is_val_expr<_Expr>::value,
1789 gslice_array<_Tp>::operator&=(const _Expr& __v) const
1791 typedef const size_t* _Ip;
1793 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1794 __vp_[*__i] &= __v[__j];
1797 template <class _Tp>
1798 template <class _Expr>
1802 __is_val_expr<_Expr>::value,
1805 gslice_array<_Tp>::operator|=(const _Expr& __v) const
1807 typedef const size_t* _Ip;
1809 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1810 __vp_[*__i] |= __v[__j];
1813 template <class _Tp>
1814 template <class _Expr>
1818 __is_val_expr<_Expr>::value,
1821 gslice_array<_Tp>::operator<<=(const _Expr& __v) const
1823 typedef const size_t* _Ip;
1825 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1826 __vp_[*__i] <<= __v[__j];
1829 template <class _Tp>
1830 template <class _Expr>
1834 __is_val_expr<_Expr>::value,
1837 gslice_array<_Tp>::operator>>=(const _Expr& __v) const
1839 typedef const size_t* _Ip;
1841 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1842 __vp_[*__i] >>= __v[__j];
1845 template <class _Tp>
1847 const gslice_array<_Tp>&
1848 gslice_array<_Tp>::operator=(const gslice_array& __ga) const
1850 typedef const size_t* _Ip;
1851 const value_type* __s = __ga.__vp_;
1852 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ga.__1d_.__begin_;
1853 __i != __e; ++__i, ++__j)
1854 __vp_[*__i] = __s[*__j];
1858 template <class _Tp>
1861 gslice_array<_Tp>::operator=(const value_type& __x) const
1863 typedef const size_t* _Ip;
1864 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
1870 template <class _Tp>
1871 class _LIBCPP_TEMPLATE_VIS mask_array
1874 typedef _Tp value_type;
1878 valarray<size_t> __1d_;
1881 template <class _Expr>
1884 __is_val_expr<_Expr>::value,
1887 _LIBCPP_INLINE_VISIBILITY
1888 operator=(const _Expr& __v) const;
1890 template <class _Expr>
1893 __is_val_expr<_Expr>::value,
1896 _LIBCPP_INLINE_VISIBILITY
1897 operator*=(const _Expr& __v) const;
1899 template <class _Expr>
1902 __is_val_expr<_Expr>::value,
1905 _LIBCPP_INLINE_VISIBILITY
1906 operator/=(const _Expr& __v) const;
1908 template <class _Expr>
1911 __is_val_expr<_Expr>::value,
1914 _LIBCPP_INLINE_VISIBILITY
1915 operator%=(const _Expr& __v) const;
1917 template <class _Expr>
1920 __is_val_expr<_Expr>::value,
1923 _LIBCPP_INLINE_VISIBILITY
1924 operator+=(const _Expr& __v) const;
1926 template <class _Expr>
1929 __is_val_expr<_Expr>::value,
1932 _LIBCPP_INLINE_VISIBILITY
1933 operator-=(const _Expr& __v) const;
1935 template <class _Expr>
1938 __is_val_expr<_Expr>::value,
1941 _LIBCPP_INLINE_VISIBILITY
1942 operator^=(const _Expr& __v) const;
1944 template <class _Expr>
1947 __is_val_expr<_Expr>::value,
1950 _LIBCPP_INLINE_VISIBILITY
1951 operator&=(const _Expr& __v) const;
1953 template <class _Expr>
1956 __is_val_expr<_Expr>::value,
1959 _LIBCPP_INLINE_VISIBILITY
1960 operator|=(const _Expr& __v) const;
1962 template <class _Expr>
1965 __is_val_expr<_Expr>::value,
1968 _LIBCPP_INLINE_VISIBILITY
1969 operator<<=(const _Expr& __v) const;
1971 template <class _Expr>
1974 __is_val_expr<_Expr>::value,
1977 _LIBCPP_INLINE_VISIBILITY
1978 operator>>=(const _Expr& __v) const;
1980 _LIBCPP_INLINE_VISIBILITY
1981 const mask_array& operator=(const mask_array& __ma) const;
1983 _LIBCPP_INLINE_VISIBILITY
1984 void operator=(const value_type& __x) const;
1986 // mask_array(const mask_array&) = default;
1987 // mask_array(mask_array&&) = default;
1988 // mask_array& operator=(const mask_array&) = default;
1989 // mask_array& operator=(mask_array&&) = default;
1992 _LIBCPP_INLINE_VISIBILITY
1993 mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v)
1994 : __vp_(const_cast<value_type*>(__v.__begin_)),
1995 __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
1998 for (size_t __i = 0; __i < __vb.size(); ++__i)
2003 template <class> friend class valarray;
2006 template <class _Tp>
2007 template <class _Expr>
2011 __is_val_expr<_Expr>::value,
2014 mask_array<_Tp>::operator=(const _Expr& __v) const
2016 size_t __n = __1d_.size();
2017 for (size_t __i = 0; __i < __n; ++__i)
2018 __vp_[__1d_[__i]] = __v[__i];
2021 template <class _Tp>
2022 template <class _Expr>
2026 __is_val_expr<_Expr>::value,
2029 mask_array<_Tp>::operator*=(const _Expr& __v) const
2031 size_t __n = __1d_.size();
2032 for (size_t __i = 0; __i < __n; ++__i)
2033 __vp_[__1d_[__i]] *= __v[__i];
2036 template <class _Tp>
2037 template <class _Expr>
2041 __is_val_expr<_Expr>::value,
2044 mask_array<_Tp>::operator/=(const _Expr& __v) const
2046 size_t __n = __1d_.size();
2047 for (size_t __i = 0; __i < __n; ++__i)
2048 __vp_[__1d_[__i]] /= __v[__i];
2051 template <class _Tp>
2052 template <class _Expr>
2056 __is_val_expr<_Expr>::value,
2059 mask_array<_Tp>::operator%=(const _Expr& __v) const
2061 size_t __n = __1d_.size();
2062 for (size_t __i = 0; __i < __n; ++__i)
2063 __vp_[__1d_[__i]] %= __v[__i];
2066 template <class _Tp>
2067 template <class _Expr>
2071 __is_val_expr<_Expr>::value,
2074 mask_array<_Tp>::operator+=(const _Expr& __v) const
2076 size_t __n = __1d_.size();
2077 for (size_t __i = 0; __i < __n; ++__i)
2078 __vp_[__1d_[__i]] += __v[__i];
2081 template <class _Tp>
2082 template <class _Expr>
2086 __is_val_expr<_Expr>::value,
2089 mask_array<_Tp>::operator-=(const _Expr& __v) const
2091 size_t __n = __1d_.size();
2092 for (size_t __i = 0; __i < __n; ++__i)
2093 __vp_[__1d_[__i]] -= __v[__i];
2096 template <class _Tp>
2097 template <class _Expr>
2101 __is_val_expr<_Expr>::value,
2104 mask_array<_Tp>::operator^=(const _Expr& __v) const
2106 size_t __n = __1d_.size();
2107 for (size_t __i = 0; __i < __n; ++__i)
2108 __vp_[__1d_[__i]] ^= __v[__i];
2111 template <class _Tp>
2112 template <class _Expr>
2116 __is_val_expr<_Expr>::value,
2119 mask_array<_Tp>::operator&=(const _Expr& __v) const
2121 size_t __n = __1d_.size();
2122 for (size_t __i = 0; __i < __n; ++__i)
2123 __vp_[__1d_[__i]] &= __v[__i];
2126 template <class _Tp>
2127 template <class _Expr>
2131 __is_val_expr<_Expr>::value,
2134 mask_array<_Tp>::operator|=(const _Expr& __v) const
2136 size_t __n = __1d_.size();
2137 for (size_t __i = 0; __i < __n; ++__i)
2138 __vp_[__1d_[__i]] |= __v[__i];
2141 template <class _Tp>
2142 template <class _Expr>
2146 __is_val_expr<_Expr>::value,
2149 mask_array<_Tp>::operator<<=(const _Expr& __v) const
2151 size_t __n = __1d_.size();
2152 for (size_t __i = 0; __i < __n; ++__i)
2153 __vp_[__1d_[__i]] <<= __v[__i];
2156 template <class _Tp>
2157 template <class _Expr>
2161 __is_val_expr<_Expr>::value,
2164 mask_array<_Tp>::operator>>=(const _Expr& __v) const
2166 size_t __n = __1d_.size();
2167 for (size_t __i = 0; __i < __n; ++__i)
2168 __vp_[__1d_[__i]] >>= __v[__i];
2171 template <class _Tp>
2173 const mask_array<_Tp>&
2174 mask_array<_Tp>::operator=(const mask_array& __ma) const
2176 size_t __n = __1d_.size();
2177 for (size_t __i = 0; __i < __n; ++__i)
2178 __vp_[__1d_[__i]] = __ma.__vp_[__1d_[__i]];
2182 template <class _Tp>
2185 mask_array<_Tp>::operator=(const value_type& __x) const
2187 size_t __n = __1d_.size();
2188 for (size_t __i = 0; __i < __n; ++__i)
2189 __vp_[__1d_[__i]] = __x;
2192 template <class _ValExpr>
2195 typedef typename remove_reference<_ValExpr>::type _RmExpr;
2197 typedef typename _RmExpr::value_type value_type;
2198 typedef value_type result_type;
2202 valarray<size_t> __1d_;
2204 _LIBCPP_INLINE_VISIBILITY
2205 __mask_expr(const valarray<bool>& __vb, const _RmExpr& __e)
2207 __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
2210 for (size_t __i = 0; __i < __vb.size(); ++__i)
2216 _LIBCPP_INLINE_VISIBILITY
2217 result_type operator[](size_t __i) const
2218 {return __expr_[__1d_[__i]];}
2220 _LIBCPP_INLINE_VISIBILITY
2221 size_t size() const {return __1d_.size();}
2223 template <class> friend class __val_expr;
2224 template <class> friend class valarray;
2229 template <class _Tp>
2230 class _LIBCPP_TEMPLATE_VIS indirect_array
2233 typedef _Tp value_type;
2237 valarray<size_t> __1d_;
2240 template <class _Expr>
2243 __is_val_expr<_Expr>::value,
2246 _LIBCPP_INLINE_VISIBILITY
2247 operator=(const _Expr& __v) const;
2249 template <class _Expr>
2252 __is_val_expr<_Expr>::value,
2255 _LIBCPP_INLINE_VISIBILITY
2256 operator*=(const _Expr& __v) const;
2258 template <class _Expr>
2261 __is_val_expr<_Expr>::value,
2264 _LIBCPP_INLINE_VISIBILITY
2265 operator/=(const _Expr& __v) const;
2267 template <class _Expr>
2270 __is_val_expr<_Expr>::value,
2273 _LIBCPP_INLINE_VISIBILITY
2274 operator%=(const _Expr& __v) const;
2276 template <class _Expr>
2279 __is_val_expr<_Expr>::value,
2282 _LIBCPP_INLINE_VISIBILITY
2283 operator+=(const _Expr& __v) const;
2285 template <class _Expr>
2288 __is_val_expr<_Expr>::value,
2291 _LIBCPP_INLINE_VISIBILITY
2292 operator-=(const _Expr& __v) const;
2294 template <class _Expr>
2297 __is_val_expr<_Expr>::value,
2300 _LIBCPP_INLINE_VISIBILITY
2301 operator^=(const _Expr& __v) const;
2303 template <class _Expr>
2306 __is_val_expr<_Expr>::value,
2309 _LIBCPP_INLINE_VISIBILITY
2310 operator&=(const _Expr& __v) const;
2312 template <class _Expr>
2315 __is_val_expr<_Expr>::value,
2318 _LIBCPP_INLINE_VISIBILITY
2319 operator|=(const _Expr& __v) const;
2321 template <class _Expr>
2324 __is_val_expr<_Expr>::value,
2327 _LIBCPP_INLINE_VISIBILITY
2328 operator<<=(const _Expr& __v) const;
2330 template <class _Expr>
2333 __is_val_expr<_Expr>::value,
2336 _LIBCPP_INLINE_VISIBILITY
2337 operator>>=(const _Expr& __v) const;
2339 _LIBCPP_INLINE_VISIBILITY
2340 const indirect_array& operator=(const indirect_array& __ia) const;
2342 _LIBCPP_INLINE_VISIBILITY
2343 void operator=(const value_type& __x) const;
2345 // indirect_array(const indirect_array&) = default;
2346 // indirect_array(indirect_array&&) = default;
2347 // indirect_array& operator=(const indirect_array&) = default;
2348 // indirect_array& operator=(indirect_array&&) = default;
2351 _LIBCPP_INLINE_VISIBILITY
2352 indirect_array(const valarray<size_t>& __ia, const valarray<value_type>& __v)
2353 : __vp_(const_cast<value_type*>(__v.__begin_)),
2357 #ifndef _LIBCPP_CXX03_LANG
2359 _LIBCPP_INLINE_VISIBILITY
2360 indirect_array(valarray<size_t>&& __ia, const valarray<value_type>& __v)
2361 : __vp_(const_cast<value_type*>(__v.__begin_)),
2365 #endif // _LIBCPP_CXX03_LANG
2367 template <class> friend class valarray;
2370 template <class _Tp>
2371 template <class _Expr>
2375 __is_val_expr<_Expr>::value,
2378 indirect_array<_Tp>::operator=(const _Expr& __v) const
2380 size_t __n = __1d_.size();
2381 for (size_t __i = 0; __i < __n; ++__i)
2382 __vp_[__1d_[__i]] = __v[__i];
2385 template <class _Tp>
2386 template <class _Expr>
2390 __is_val_expr<_Expr>::value,
2393 indirect_array<_Tp>::operator*=(const _Expr& __v) const
2395 size_t __n = __1d_.size();
2396 for (size_t __i = 0; __i < __n; ++__i)
2397 __vp_[__1d_[__i]] *= __v[__i];
2400 template <class _Tp>
2401 template <class _Expr>
2405 __is_val_expr<_Expr>::value,
2408 indirect_array<_Tp>::operator/=(const _Expr& __v) const
2410 size_t __n = __1d_.size();
2411 for (size_t __i = 0; __i < __n; ++__i)
2412 __vp_[__1d_[__i]] /= __v[__i];
2415 template <class _Tp>
2416 template <class _Expr>
2420 __is_val_expr<_Expr>::value,
2423 indirect_array<_Tp>::operator%=(const _Expr& __v) const
2425 size_t __n = __1d_.size();
2426 for (size_t __i = 0; __i < __n; ++__i)
2427 __vp_[__1d_[__i]] %= __v[__i];
2430 template <class _Tp>
2431 template <class _Expr>
2435 __is_val_expr<_Expr>::value,
2438 indirect_array<_Tp>::operator+=(const _Expr& __v) const
2440 size_t __n = __1d_.size();
2441 for (size_t __i = 0; __i < __n; ++__i)
2442 __vp_[__1d_[__i]] += __v[__i];
2445 template <class _Tp>
2446 template <class _Expr>
2450 __is_val_expr<_Expr>::value,
2453 indirect_array<_Tp>::operator-=(const _Expr& __v) const
2455 size_t __n = __1d_.size();
2456 for (size_t __i = 0; __i < __n; ++__i)
2457 __vp_[__1d_[__i]] -= __v[__i];
2460 template <class _Tp>
2461 template <class _Expr>
2465 __is_val_expr<_Expr>::value,
2468 indirect_array<_Tp>::operator^=(const _Expr& __v) const
2470 size_t __n = __1d_.size();
2471 for (size_t __i = 0; __i < __n; ++__i)
2472 __vp_[__1d_[__i]] ^= __v[__i];
2475 template <class _Tp>
2476 template <class _Expr>
2480 __is_val_expr<_Expr>::value,
2483 indirect_array<_Tp>::operator&=(const _Expr& __v) const
2485 size_t __n = __1d_.size();
2486 for (size_t __i = 0; __i < __n; ++__i)
2487 __vp_[__1d_[__i]] &= __v[__i];
2490 template <class _Tp>
2491 template <class _Expr>
2495 __is_val_expr<_Expr>::value,
2498 indirect_array<_Tp>::operator|=(const _Expr& __v) const
2500 size_t __n = __1d_.size();
2501 for (size_t __i = 0; __i < __n; ++__i)
2502 __vp_[__1d_[__i]] |= __v[__i];
2505 template <class _Tp>
2506 template <class _Expr>
2510 __is_val_expr<_Expr>::value,
2513 indirect_array<_Tp>::operator<<=(const _Expr& __v) const
2515 size_t __n = __1d_.size();
2516 for (size_t __i = 0; __i < __n; ++__i)
2517 __vp_[__1d_[__i]] <<= __v[__i];
2520 template <class _Tp>
2521 template <class _Expr>
2525 __is_val_expr<_Expr>::value,
2528 indirect_array<_Tp>::operator>>=(const _Expr& __v) const
2530 size_t __n = __1d_.size();
2531 for (size_t __i = 0; __i < __n; ++__i)
2532 __vp_[__1d_[__i]] >>= __v[__i];
2535 template <class _Tp>
2537 const indirect_array<_Tp>&
2538 indirect_array<_Tp>::operator=(const indirect_array& __ia) const
2540 typedef const size_t* _Ip;
2541 const value_type* __s = __ia.__vp_;
2542 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ia.__1d_.__begin_;
2543 __i != __e; ++__i, ++__j)
2544 __vp_[*__i] = __s[*__j];
2548 template <class _Tp>
2551 indirect_array<_Tp>::operator=(const value_type& __x) const
2553 typedef const size_t* _Ip;
2554 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
2558 template <class _ValExpr>
2559 class __indirect_expr
2561 typedef typename remove_reference<_ValExpr>::type _RmExpr;
2563 typedef typename _RmExpr::value_type value_type;
2564 typedef value_type result_type;
2568 valarray<size_t> __1d_;
2570 _LIBCPP_INLINE_VISIBILITY
2571 __indirect_expr(const valarray<size_t>& __ia, const _RmExpr& __e)
2576 #ifndef _LIBCPP_CXX03_LANG
2578 _LIBCPP_INLINE_VISIBILITY
2579 __indirect_expr(valarray<size_t>&& __ia, const _RmExpr& __e)
2584 #endif // _LIBCPP_CXX03_LANG
2587 _LIBCPP_INLINE_VISIBILITY
2588 result_type operator[](size_t __i) const
2589 {return __expr_[__1d_[__i]];}
2591 _LIBCPP_INLINE_VISIBILITY
2592 size_t size() const {return __1d_.size();}
2594 template <class> friend class __val_expr;
2595 template <class> friend class _LIBCPP_TEMPLATE_VIS valarray;
2598 template<class _ValExpr>
2601 typedef typename remove_reference<_ValExpr>::type _RmExpr;
2605 typedef typename _RmExpr::value_type value_type;
2606 typedef typename _RmExpr::result_type result_type;
2608 _LIBCPP_INLINE_VISIBILITY
2609 explicit __val_expr(const _RmExpr& __e) : __expr_(__e) {}
2611 _LIBCPP_INLINE_VISIBILITY
2612 result_type operator[](size_t __i) const
2613 {return __expr_[__i];}
2615 _LIBCPP_INLINE_VISIBILITY
2616 __val_expr<__slice_expr<_ValExpr> > operator[](slice __s) const
2618 typedef __slice_expr<_ValExpr> _NewExpr;
2619 return __val_expr< _NewExpr >(_NewExpr(__s, __expr_));
2622 _LIBCPP_INLINE_VISIBILITY
2623 __val_expr<__indirect_expr<_ValExpr> > operator[](const gslice& __gs) const
2625 typedef __indirect_expr<_ValExpr> _NewExpr;
2626 return __val_expr<_NewExpr >(_NewExpr(__gs.__1d_, __expr_));
2629 _LIBCPP_INLINE_VISIBILITY
2630 __val_expr<__mask_expr<_ValExpr> > operator[](const valarray<bool>& __vb) const
2632 typedef __mask_expr<_ValExpr> _NewExpr;
2633 return __val_expr< _NewExpr >( _NewExpr(__vb, __expr_));
2636 _LIBCPP_INLINE_VISIBILITY
2637 __val_expr<__indirect_expr<_ValExpr> > operator[](const valarray<size_t>& __vs) const
2639 typedef __indirect_expr<_ValExpr> _NewExpr;
2640 return __val_expr< _NewExpr >(_NewExpr(__vs, __expr_));
2643 _LIBCPP_INLINE_VISIBILITY
2644 __val_expr<_UnaryOp<__unary_plus<value_type>, _ValExpr> >
2647 typedef _UnaryOp<__unary_plus<value_type>, _ValExpr> _NewExpr;
2648 return __val_expr<_NewExpr>(_NewExpr(__unary_plus<value_type>(), __expr_));
2651 _LIBCPP_INLINE_VISIBILITY
2652 __val_expr<_UnaryOp<negate<value_type>, _ValExpr> >
2655 typedef _UnaryOp<negate<value_type>, _ValExpr> _NewExpr;
2656 return __val_expr<_NewExpr>(_NewExpr(negate<value_type>(), __expr_));
2659 _LIBCPP_INLINE_VISIBILITY
2660 __val_expr<_UnaryOp<__bit_not<value_type>, _ValExpr> >
2663 typedef _UnaryOp<__bit_not<value_type>, _ValExpr> _NewExpr;
2664 return __val_expr<_NewExpr>(_NewExpr(__bit_not<value_type>(), __expr_));
2667 _LIBCPP_INLINE_VISIBILITY
2668 __val_expr<_UnaryOp<logical_not<value_type>, _ValExpr> >
2671 typedef _UnaryOp<logical_not<value_type>, _ValExpr> _NewExpr;
2672 return __val_expr<_NewExpr>(_NewExpr(logical_not<value_type>(), __expr_));
2675 operator valarray<result_type>() const;
2677 _LIBCPP_INLINE_VISIBILITY
2678 size_t size() const {return __expr_.size();}
2680 _LIBCPP_INLINE_VISIBILITY
2681 result_type sum() const
2683 size_t __n = __expr_.size();
2684 result_type __r = __n ? __expr_[0] : result_type();
2685 for (size_t __i = 1; __i < __n; ++__i)
2686 __r += __expr_[__i];
2690 _LIBCPP_INLINE_VISIBILITY
2691 result_type min() const
2693 size_t __n = size();
2694 result_type __r = __n ? (*this)[0] : result_type();
2695 for (size_t __i = 1; __i < __n; ++__i)
2697 result_type __x = __expr_[__i];
2704 _LIBCPP_INLINE_VISIBILITY
2705 result_type max() const
2707 size_t __n = size();
2708 result_type __r = __n ? (*this)[0] : result_type();
2709 for (size_t __i = 1; __i < __n; ++__i)
2711 result_type __x = __expr_[__i];
2718 _LIBCPP_INLINE_VISIBILITY
2719 __val_expr<__shift_expr<_ValExpr> > shift (int __i) const
2720 {return __val_expr<__shift_expr<_ValExpr> >(__shift_expr<_ValExpr>(__i, __expr_));}
2722 _LIBCPP_INLINE_VISIBILITY
2723 __val_expr<__cshift_expr<_ValExpr> > cshift(int __i) const
2724 {return __val_expr<__cshift_expr<_ValExpr> >(__cshift_expr<_ValExpr>(__i, __expr_));}
2726 _LIBCPP_INLINE_VISIBILITY
2727 __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(value_type)>, _ValExpr> >
2728 apply(value_type __f(value_type)) const
2730 typedef __apply_expr<value_type, value_type(*)(value_type)> _Op;
2731 typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
2732 return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
2735 _LIBCPP_INLINE_VISIBILITY
2736 __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(const value_type&)>, _ValExpr> >
2737 apply(value_type __f(const value_type&)) const
2739 typedef __apply_expr<value_type, value_type(*)(const value_type&)> _Op;
2740 typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
2741 return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
2745 template<class _ValExpr>
2746 __val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const
2748 valarray<result_type> __r;
2749 size_t __n = __expr_.size();
2754 static_cast<result_type*>(
2755 _VSTD::__libcpp_allocate(__n * sizeof(result_type), _LIBCPP_ALIGNOF(result_type)));
2756 for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i)
2757 ::new (__r.__end_) result_type(__expr_[__i]);
2764 template <class _Tp>
2766 valarray<_Tp>::valarray(size_t __n)
2772 __begin_ = __end_ = static_cast<value_type*>(
2773 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
2774 #ifndef _LIBCPP_NO_EXCEPTIONS
2777 #endif // _LIBCPP_NO_EXCEPTIONS
2778 for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
2779 ::new (__end_) value_type();
2780 #ifndef _LIBCPP_NO_EXCEPTIONS
2787 #endif // _LIBCPP_NO_EXCEPTIONS
2791 template <class _Tp>
2793 valarray<_Tp>::valarray(const value_type& __x, size_t __n)
2800 template <class _Tp>
2801 valarray<_Tp>::valarray(const value_type* __p, size_t __n)
2807 __begin_ = __end_ = static_cast<value_type*>(
2808 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
2809 #ifndef _LIBCPP_NO_EXCEPTIONS
2812 #endif // _LIBCPP_NO_EXCEPTIONS
2813 for (size_t __n_left = __n; __n_left; ++__end_, ++__p, --__n_left)
2814 ::new (__end_) value_type(*__p);
2815 #ifndef _LIBCPP_NO_EXCEPTIONS
2822 #endif // _LIBCPP_NO_EXCEPTIONS
2826 template <class _Tp>
2827 valarray<_Tp>::valarray(const valarray& __v)
2833 __begin_ = __end_ = static_cast<value_type*>(
2834 _VSTD::__libcpp_allocate(__v.size() * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
2835 #ifndef _LIBCPP_NO_EXCEPTIONS
2838 #endif // _LIBCPP_NO_EXCEPTIONS
2839 for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p)
2840 ::new (__end_) value_type(*__p);
2841 #ifndef _LIBCPP_NO_EXCEPTIONS
2845 __clear(__v.size());
2848 #endif // _LIBCPP_NO_EXCEPTIONS
2852 #ifndef _LIBCPP_CXX03_LANG
2854 template <class _Tp>
2856 valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT
2857 : __begin_(__v.__begin_),
2860 __v.__begin_ = __v.__end_ = nullptr;
2863 template <class _Tp>
2864 valarray<_Tp>::valarray(initializer_list<value_type> __il)
2868 const size_t __n = __il.size();
2871 __begin_ = __end_ = static_cast<value_type*>(
2872 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
2873 #ifndef _LIBCPP_NO_EXCEPTIONS
2876 #endif // _LIBCPP_NO_EXCEPTIONS
2877 size_t __n_left = __n;
2878 for (const value_type* __p = __il.begin(); __n_left; ++__end_, ++__p, --__n_left)
2879 ::new (__end_) value_type(*__p);
2880 #ifndef _LIBCPP_NO_EXCEPTIONS
2887 #endif // _LIBCPP_NO_EXCEPTIONS
2891 #endif // _LIBCPP_CXX03_LANG
2893 template <class _Tp>
2894 valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
2898 const size_t __n = __sa.__size_;
2901 __begin_ = __end_ = static_cast<value_type*>(
2902 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
2903 #ifndef _LIBCPP_NO_EXCEPTIONS
2906 #endif // _LIBCPP_NO_EXCEPTIONS
2907 size_t __n_left = __n;
2908 for (const value_type* __p = __sa.__vp_; __n_left; ++__end_, __p += __sa.__stride_, --__n_left)
2909 ::new (__end_) value_type(*__p);
2910 #ifndef _LIBCPP_NO_EXCEPTIONS
2917 #endif // _LIBCPP_NO_EXCEPTIONS
2921 template <class _Tp>
2922 valarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
2926 const size_t __n = __ga.__1d_.size();
2929 __begin_ = __end_ = static_cast<value_type*>(
2930 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
2931 #ifndef _LIBCPP_NO_EXCEPTIONS
2934 #endif // _LIBCPP_NO_EXCEPTIONS
2935 typedef const size_t* _Ip;
2936 const value_type* __s = __ga.__vp_;
2937 for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
2938 __i != __e; ++__i, ++__end_)
2939 ::new (__end_) value_type(__s[*__i]);
2940 #ifndef _LIBCPP_NO_EXCEPTIONS
2947 #endif // _LIBCPP_NO_EXCEPTIONS
2951 template <class _Tp>
2952 valarray<_Tp>::valarray(const mask_array<value_type>& __ma)
2956 const size_t __n = __ma.__1d_.size();
2959 __begin_ = __end_ = static_cast<value_type*>(
2960 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
2961 #ifndef _LIBCPP_NO_EXCEPTIONS
2964 #endif // _LIBCPP_NO_EXCEPTIONS
2965 typedef const size_t* _Ip;
2966 const value_type* __s = __ma.__vp_;
2967 for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
2968 __i != __e; ++__i, ++__end_)
2969 ::new (__end_) value_type(__s[*__i]);
2970 #ifndef _LIBCPP_NO_EXCEPTIONS
2977 #endif // _LIBCPP_NO_EXCEPTIONS
2981 template <class _Tp>
2982 valarray<_Tp>::valarray(const indirect_array<value_type>& __ia)
2986 const size_t __n = __ia.__1d_.size();
2989 __begin_ = __end_ = static_cast<value_type*>(
2990 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
2991 #ifndef _LIBCPP_NO_EXCEPTIONS
2994 #endif // _LIBCPP_NO_EXCEPTIONS
2995 typedef const size_t* _Ip;
2996 const value_type* __s = __ia.__vp_;
2997 for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
2998 __i != __e; ++__i, ++__end_)
2999 ::new (__end_) value_type(__s[*__i]);
3000 #ifndef _LIBCPP_NO_EXCEPTIONS
3007 #endif // _LIBCPP_NO_EXCEPTIONS
3011 template <class _Tp>
3013 valarray<_Tp>::~valarray()
3018 template <class _Tp>
3020 valarray<_Tp>::__assign_range(const value_type* __f, const value_type* __l)
3022 size_t __n = __l - __f;
3026 __begin_ = static_cast<value_type*>(
3027 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3028 __end_ = __begin_ + __n;
3029 _VSTD::uninitialized_copy(__f, __l, __begin_);
3031 _VSTD::copy(__f, __l, __begin_);
3036 template <class _Tp>
3038 valarray<_Tp>::operator=(const valarray& __v)
3041 return __assign_range(__v.__begin_, __v.__end_);
3045 #ifndef _LIBCPP_CXX03_LANG
3047 template <class _Tp>
3050 valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT
3053 __begin_ = __v.__begin_;
3054 __end_ = __v.__end_;
3055 __v.__begin_ = nullptr;
3056 __v.__end_ = nullptr;
3060 template <class _Tp>
3063 valarray<_Tp>::operator=(initializer_list<value_type> __il)
3065 return __assign_range(__il.begin(), __il.end());
3068 #endif // _LIBCPP_CXX03_LANG
3070 template <class _Tp>
3073 valarray<_Tp>::operator=(const value_type& __x)
3075 _VSTD::fill(__begin_, __end_, __x);
3079 template <class _Tp>
3082 valarray<_Tp>::operator=(const slice_array<value_type>& __sa)
3084 value_type* __t = __begin_;
3085 const value_type* __s = __sa.__vp_;
3086 for (size_t __n = __sa.__size_; __n; --__n, __s += __sa.__stride_, ++__t)
3091 template <class _Tp>
3094 valarray<_Tp>::operator=(const gslice_array<value_type>& __ga)
3096 typedef const size_t* _Ip;
3097 value_type* __t = __begin_;
3098 const value_type* __s = __ga.__vp_;
3099 for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
3100 __i != __e; ++__i, ++__t)
3105 template <class _Tp>
3108 valarray<_Tp>::operator=(const mask_array<value_type>& __ma)
3110 typedef const size_t* _Ip;
3111 value_type* __t = __begin_;
3112 const value_type* __s = __ma.__vp_;
3113 for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
3114 __i != __e; ++__i, ++__t)
3119 template <class _Tp>
3122 valarray<_Tp>::operator=(const indirect_array<value_type>& __ia)
3124 typedef const size_t* _Ip;
3125 value_type* __t = __begin_;
3126 const value_type* __s = __ia.__vp_;
3127 for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
3128 __i != __e; ++__i, ++__t)
3133 template <class _Tp>
3134 template <class _ValExpr>
3137 valarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v)
3139 size_t __n = __v.size();
3142 value_type* __t = __begin_;
3143 for (size_t __i = 0; __i != __n; ++__t, ++__i)
3144 *__t = result_type(__v[__i]);
3148 template <class _Tp>
3150 __val_expr<__slice_expr<const valarray<_Tp>&> >
3151 valarray<_Tp>::operator[](slice __s) const
3153 return __val_expr<__slice_expr<const valarray&> >(__slice_expr<const valarray&>(__s, *this));
3156 template <class _Tp>
3159 valarray<_Tp>::operator[](slice __s)
3161 return slice_array<value_type>(__s, *this);
3164 template <class _Tp>
3166 __val_expr<__indirect_expr<const valarray<_Tp>&> >
3167 valarray<_Tp>::operator[](const gslice& __gs) const
3169 return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__gs.__1d_, *this));
3172 template <class _Tp>
3175 valarray<_Tp>::operator[](const gslice& __gs)
3177 return gslice_array<value_type>(__gs, *this);
3180 #ifndef _LIBCPP_CXX03_LANG
3182 template <class _Tp>
3184 __val_expr<__indirect_expr<const valarray<_Tp>&> >
3185 valarray<_Tp>::operator[](gslice&& __gs) const
3187 return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__gs.__1d_), *this));
3190 template <class _Tp>
3193 valarray<_Tp>::operator[](gslice&& __gs)
3195 return gslice_array<value_type>(move(__gs), *this);
3198 #endif // _LIBCPP_CXX03_LANG
3200 template <class _Tp>
3202 __val_expr<__mask_expr<const valarray<_Tp>&> >
3203 valarray<_Tp>::operator[](const valarray<bool>& __vb) const
3205 return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(__vb, *this));
3208 template <class _Tp>
3211 valarray<_Tp>::operator[](const valarray<bool>& __vb)
3213 return mask_array<value_type>(__vb, *this);
3216 #ifndef _LIBCPP_CXX03_LANG
3218 template <class _Tp>
3220 __val_expr<__mask_expr<const valarray<_Tp>&> >
3221 valarray<_Tp>::operator[](valarray<bool>&& __vb) const
3223 return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(move(__vb), *this));
3226 template <class _Tp>
3229 valarray<_Tp>::operator[](valarray<bool>&& __vb)
3231 return mask_array<value_type>(move(__vb), *this);
3234 #endif // _LIBCPP_CXX03_LANG
3236 template <class _Tp>
3238 __val_expr<__indirect_expr<const valarray<_Tp>&> >
3239 valarray<_Tp>::operator[](const valarray<size_t>& __vs) const
3241 return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__vs, *this));
3244 template <class _Tp>
3247 valarray<_Tp>::operator[](const valarray<size_t>& __vs)
3249 return indirect_array<value_type>(__vs, *this);
3252 #ifndef _LIBCPP_CXX03_LANG
3254 template <class _Tp>
3256 __val_expr<__indirect_expr<const valarray<_Tp>&> >
3257 valarray<_Tp>::operator[](valarray<size_t>&& __vs) const
3259 return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__vs), *this));
3262 template <class _Tp>
3265 valarray<_Tp>::operator[](valarray<size_t>&& __vs)
3267 return indirect_array<value_type>(move(__vs), *this);
3270 #endif // _LIBCPP_CXX03_LANG
3272 template <class _Tp>
3274 valarray<_Tp>::operator+() const
3276 valarray<value_type> __r;
3277 size_t __n = size();
3282 static_cast<value_type*>(
3283 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3284 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3285 ::new (__r.__end_) value_type(+*__p);
3290 template <class _Tp>
3292 valarray<_Tp>::operator-() const
3294 valarray<value_type> __r;
3295 size_t __n = size();
3300 static_cast<value_type*>(
3301 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3302 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3303 ::new (__r.__end_) value_type(-*__p);
3308 template <class _Tp>
3310 valarray<_Tp>::operator~() const
3312 valarray<value_type> __r;
3313 size_t __n = size();
3318 static_cast<value_type*>(
3319 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3320 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3321 ::new (__r.__end_) value_type(~*__p);
3326 template <class _Tp>
3328 valarray<_Tp>::operator!() const
3331 size_t __n = size();
3336 static_cast<bool*>(_VSTD::__libcpp_allocate(__n * sizeof(bool), _LIBCPP_ALIGNOF(bool)));
3337 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3338 ::new (__r.__end_) bool(!*__p);
3343 template <class _Tp>
3346 valarray<_Tp>::operator*=(const value_type& __x)
3348 for (value_type* __p = __begin_; __p != __end_; ++__p)
3353 template <class _Tp>
3356 valarray<_Tp>::operator/=(const value_type& __x)
3358 for (value_type* __p = __begin_; __p != __end_; ++__p)
3363 template <class _Tp>
3366 valarray<_Tp>::operator%=(const value_type& __x)
3368 for (value_type* __p = __begin_; __p != __end_; ++__p)
3373 template <class _Tp>
3376 valarray<_Tp>::operator+=(const value_type& __x)
3378 for (value_type* __p = __begin_; __p != __end_; ++__p)
3383 template <class _Tp>
3386 valarray<_Tp>::operator-=(const value_type& __x)
3388 for (value_type* __p = __begin_; __p != __end_; ++__p)
3393 template <class _Tp>
3396 valarray<_Tp>::operator^=(const value_type& __x)
3398 for (value_type* __p = __begin_; __p != __end_; ++__p)
3403 template <class _Tp>
3406 valarray<_Tp>::operator&=(const value_type& __x)
3408 for (value_type* __p = __begin_; __p != __end_; ++__p)
3413 template <class _Tp>
3416 valarray<_Tp>::operator|=(const value_type& __x)
3418 for (value_type* __p = __begin_; __p != __end_; ++__p)
3423 template <class _Tp>
3426 valarray<_Tp>::operator<<=(const value_type& __x)
3428 for (value_type* __p = __begin_; __p != __end_; ++__p)
3433 template <class _Tp>
3436 valarray<_Tp>::operator>>=(const value_type& __x)
3438 for (value_type* __p = __begin_; __p != __end_; ++__p)
3443 template <class _Tp>
3444 template <class _Expr>
3448 __is_val_expr<_Expr>::value,
3451 valarray<_Tp>::operator*=(const _Expr& __v)
3454 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3459 template <class _Tp>
3460 template <class _Expr>
3464 __is_val_expr<_Expr>::value,
3467 valarray<_Tp>::operator/=(const _Expr& __v)
3470 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3475 template <class _Tp>
3476 template <class _Expr>
3480 __is_val_expr<_Expr>::value,
3483 valarray<_Tp>::operator%=(const _Expr& __v)
3486 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3491 template <class _Tp>
3492 template <class _Expr>
3496 __is_val_expr<_Expr>::value,
3499 valarray<_Tp>::operator+=(const _Expr& __v)
3502 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3507 template <class _Tp>
3508 template <class _Expr>
3512 __is_val_expr<_Expr>::value,
3515 valarray<_Tp>::operator-=(const _Expr& __v)
3518 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3523 template <class _Tp>
3524 template <class _Expr>
3528 __is_val_expr<_Expr>::value,
3531 valarray<_Tp>::operator^=(const _Expr& __v)
3534 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3539 template <class _Tp>
3540 template <class _Expr>
3544 __is_val_expr<_Expr>::value,
3547 valarray<_Tp>::operator|=(const _Expr& __v)
3550 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3555 template <class _Tp>
3556 template <class _Expr>
3560 __is_val_expr<_Expr>::value,
3563 valarray<_Tp>::operator&=(const _Expr& __v)
3566 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3571 template <class _Tp>
3572 template <class _Expr>
3576 __is_val_expr<_Expr>::value,
3579 valarray<_Tp>::operator<<=(const _Expr& __v)
3582 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3587 template <class _Tp>
3588 template <class _Expr>
3592 __is_val_expr<_Expr>::value,
3595 valarray<_Tp>::operator>>=(const _Expr& __v)
3598 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3603 template <class _Tp>
3606 valarray<_Tp>::swap(valarray& __v) _NOEXCEPT
3608 _VSTD::swap(__begin_, __v.__begin_);
3609 _VSTD::swap(__end_, __v.__end_);
3612 template <class _Tp>
3615 valarray<_Tp>::sum() const
3617 if (__begin_ == __end_)
3618 return value_type();
3619 const value_type* __p = __begin_;
3621 for (++__p; __p != __end_; ++__p)
3626 template <class _Tp>
3629 valarray<_Tp>::min() const
3631 if (__begin_ == __end_)
3632 return value_type();
3633 return *_VSTD::min_element(__begin_, __end_);
3636 template <class _Tp>
3639 valarray<_Tp>::max() const
3641 if (__begin_ == __end_)
3642 return value_type();
3643 return *_VSTD::max_element(__begin_, __end_);
3646 template <class _Tp>
3648 valarray<_Tp>::shift(int __i) const
3650 valarray<value_type> __r;
3651 size_t __n = size();
3656 static_cast<value_type*>(
3657 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3658 const value_type* __sb;
3663 __i = _VSTD::min(__i, static_cast<int>(__n));
3664 __sb = __begin_ + __i;
3665 __tb = __r.__begin_;
3666 __te = __r.__begin_ + (__n - __i);
3670 __i = _VSTD::min(-__i, static_cast<int>(__n));
3672 __tb = __r.__begin_ + __i;
3673 __te = __r.__begin_ + __n;
3675 for (; __r.__end_ != __tb; ++__r.__end_)
3676 ::new (__r.__end_) value_type();
3677 for (; __r.__end_ != __te; ++__r.__end_, ++__sb)
3678 ::new (__r.__end_) value_type(*__sb);
3679 for (__te = __r.__begin_ + __n; __r.__end_ != __te; ++__r.__end_)
3680 ::new (__r.__end_) value_type();
3685 template <class _Tp>
3687 valarray<_Tp>::cshift(int __i) const
3689 valarray<value_type> __r;
3690 size_t __n = size();
3695 static_cast<value_type*>(
3696 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3697 __i %= static_cast<int>(__n);
3698 const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i;
3699 for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s)
3700 ::new (__r.__end_) value_type(*__s);
3701 for (const value_type* __s = __begin_; __s != __m; ++__r.__end_, ++__s)
3702 ::new (__r.__end_) value_type(*__s);
3707 template <class _Tp>
3709 valarray<_Tp>::apply(value_type __f(value_type)) const
3711 valarray<value_type> __r;
3712 size_t __n = size();
3717 static_cast<value_type*>(
3718 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3719 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3720 ::new (__r.__end_) value_type(__f(*__p));
3725 template <class _Tp>
3727 valarray<_Tp>::apply(value_type __f(const value_type&)) const
3729 valarray<value_type> __r;
3730 size_t __n = size();
3735 static_cast<value_type*>(
3736 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3737 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3738 ::new (__r.__end_) value_type(__f(*__p));
3743 template <class _Tp>
3745 void valarray<_Tp>::__clear(size_t __capacity)
3747 if (__begin_ != nullptr)
3749 while (__end_ != __begin_)
3750 (--__end_)->~value_type();
3751 _VSTD::__libcpp_deallocate(__begin_, __capacity * sizeof(value_type), _LIBCPP_ALIGNOF(value_type));
3752 __begin_ = __end_ = nullptr;
3756 template <class _Tp>
3758 valarray<_Tp>::resize(size_t __n, value_type __x)
3763 __begin_ = __end_ = static_cast<value_type*>(
3764 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3765 #ifndef _LIBCPP_NO_EXCEPTIONS
3768 #endif // _LIBCPP_NO_EXCEPTIONS
3769 for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
3770 ::new (__end_) value_type(__x);
3771 #ifndef _LIBCPP_NO_EXCEPTIONS
3778 #endif // _LIBCPP_NO_EXCEPTIONS
3783 inline _LIBCPP_INLINE_VISIBILITY
3785 swap(valarray<_Tp>& __x, valarray<_Tp>& __y) _NOEXCEPT
3790 template<class _Expr1, class _Expr2>
3791 inline _LIBCPP_INLINE_VISIBILITY
3794 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3795 __val_expr<_BinaryOp<multiplies<typename _Expr1::value_type>, _Expr1, _Expr2> >
3797 operator*(const _Expr1& __x, const _Expr2& __y)
3799 typedef typename _Expr1::value_type value_type;
3800 typedef _BinaryOp<multiplies<value_type>, _Expr1, _Expr2> _Op;
3801 return __val_expr<_Op>(_Op(multiplies<value_type>(), __x, __y));
3804 template<class _Expr>
3805 inline _LIBCPP_INLINE_VISIBILITY
3808 __is_val_expr<_Expr>::value,
3809 __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
3810 _Expr, __scalar_expr<typename _Expr::value_type> > >
3812 operator*(const _Expr& __x, const typename _Expr::value_type& __y)
3814 typedef typename _Expr::value_type value_type;
3815 typedef _BinaryOp<multiplies<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3816 return __val_expr<_Op>(_Op(multiplies<value_type>(),
3817 __x, __scalar_expr<value_type>(__y, __x.size())));
3820 template<class _Expr>
3821 inline _LIBCPP_INLINE_VISIBILITY
3824 __is_val_expr<_Expr>::value,
3825 __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
3826 __scalar_expr<typename _Expr::value_type>, _Expr> >
3828 operator*(const typename _Expr::value_type& __x, const _Expr& __y)
3830 typedef typename _Expr::value_type value_type;
3831 typedef _BinaryOp<multiplies<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3832 return __val_expr<_Op>(_Op(multiplies<value_type>(),
3833 __scalar_expr<value_type>(__x, __y.size()), __y));
3836 template<class _Expr1, class _Expr2>
3837 inline _LIBCPP_INLINE_VISIBILITY
3840 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3841 __val_expr<_BinaryOp<divides<typename _Expr1::value_type>, _Expr1, _Expr2> >
3843 operator/(const _Expr1& __x, const _Expr2& __y)
3845 typedef typename _Expr1::value_type value_type;
3846 typedef _BinaryOp<divides<value_type>, _Expr1, _Expr2> _Op;
3847 return __val_expr<_Op>(_Op(divides<value_type>(), __x, __y));
3850 template<class _Expr>
3851 inline _LIBCPP_INLINE_VISIBILITY
3854 __is_val_expr<_Expr>::value,
3855 __val_expr<_BinaryOp<divides<typename _Expr::value_type>,
3856 _Expr, __scalar_expr<typename _Expr::value_type> > >
3858 operator/(const _Expr& __x, const typename _Expr::value_type& __y)
3860 typedef typename _Expr::value_type value_type;
3861 typedef _BinaryOp<divides<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3862 return __val_expr<_Op>(_Op(divides<value_type>(),
3863 __x, __scalar_expr<value_type>(__y, __x.size())));
3866 template<class _Expr>
3867 inline _LIBCPP_INLINE_VISIBILITY
3870 __is_val_expr<_Expr>::value,
3871 __val_expr<_BinaryOp<divides<typename _Expr::value_type>,
3872 __scalar_expr<typename _Expr::value_type>, _Expr> >
3874 operator/(const typename _Expr::value_type& __x, const _Expr& __y)
3876 typedef typename _Expr::value_type value_type;
3877 typedef _BinaryOp<divides<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3878 return __val_expr<_Op>(_Op(divides<value_type>(),
3879 __scalar_expr<value_type>(__x, __y.size()), __y));
3882 template<class _Expr1, class _Expr2>
3883 inline _LIBCPP_INLINE_VISIBILITY
3886 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3887 __val_expr<_BinaryOp<modulus<typename _Expr1::value_type>, _Expr1, _Expr2> >
3889 operator%(const _Expr1& __x, const _Expr2& __y)
3891 typedef typename _Expr1::value_type value_type;
3892 typedef _BinaryOp<modulus<value_type>, _Expr1, _Expr2> _Op;
3893 return __val_expr<_Op>(_Op(modulus<value_type>(), __x, __y));
3896 template<class _Expr>
3897 inline _LIBCPP_INLINE_VISIBILITY
3900 __is_val_expr<_Expr>::value,
3901 __val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
3902 _Expr, __scalar_expr<typename _Expr::value_type> > >
3904 operator%(const _Expr& __x, const typename _Expr::value_type& __y)
3906 typedef typename _Expr::value_type value_type;
3907 typedef _BinaryOp<modulus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3908 return __val_expr<_Op>(_Op(modulus<value_type>(),
3909 __x, __scalar_expr<value_type>(__y, __x.size())));
3912 template<class _Expr>
3913 inline _LIBCPP_INLINE_VISIBILITY
3916 __is_val_expr<_Expr>::value,
3917 __val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
3918 __scalar_expr<typename _Expr::value_type>, _Expr> >
3920 operator%(const typename _Expr::value_type& __x, const _Expr& __y)
3922 typedef typename _Expr::value_type value_type;
3923 typedef _BinaryOp<modulus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3924 return __val_expr<_Op>(_Op(modulus<value_type>(),
3925 __scalar_expr<value_type>(__x, __y.size()), __y));
3928 template<class _Expr1, class _Expr2>
3929 inline _LIBCPP_INLINE_VISIBILITY
3932 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3933 __val_expr<_BinaryOp<plus<typename _Expr1::value_type>, _Expr1, _Expr2> >
3935 operator+(const _Expr1& __x, const _Expr2& __y)
3937 typedef typename _Expr1::value_type value_type;
3938 typedef _BinaryOp<plus<value_type>, _Expr1, _Expr2> _Op;
3939 return __val_expr<_Op>(_Op(plus<value_type>(), __x, __y));
3942 template<class _Expr>
3943 inline _LIBCPP_INLINE_VISIBILITY
3946 __is_val_expr<_Expr>::value,
3947 __val_expr<_BinaryOp<plus<typename _Expr::value_type>,
3948 _Expr, __scalar_expr<typename _Expr::value_type> > >
3950 operator+(const _Expr& __x, const typename _Expr::value_type& __y)
3952 typedef typename _Expr::value_type value_type;
3953 typedef _BinaryOp<plus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3954 return __val_expr<_Op>(_Op(plus<value_type>(),
3955 __x, __scalar_expr<value_type>(__y, __x.size())));
3958 template<class _Expr>
3959 inline _LIBCPP_INLINE_VISIBILITY
3962 __is_val_expr<_Expr>::value,
3963 __val_expr<_BinaryOp<plus<typename _Expr::value_type>,
3964 __scalar_expr<typename _Expr::value_type>, _Expr> >
3966 operator+(const typename _Expr::value_type& __x, const _Expr& __y)
3968 typedef typename _Expr::value_type value_type;
3969 typedef _BinaryOp<plus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3970 return __val_expr<_Op>(_Op(plus<value_type>(),
3971 __scalar_expr<value_type>(__x, __y.size()), __y));
3974 template<class _Expr1, class _Expr2>
3975 inline _LIBCPP_INLINE_VISIBILITY
3978 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3979 __val_expr<_BinaryOp<minus<typename _Expr1::value_type>, _Expr1, _Expr2> >
3981 operator-(const _Expr1& __x, const _Expr2& __y)
3983 typedef typename _Expr1::value_type value_type;
3984 typedef _BinaryOp<minus<value_type>, _Expr1, _Expr2> _Op;
3985 return __val_expr<_Op>(_Op(minus<value_type>(), __x, __y));
3988 template<class _Expr>
3989 inline _LIBCPP_INLINE_VISIBILITY
3992 __is_val_expr<_Expr>::value,
3993 __val_expr<_BinaryOp<minus<typename _Expr::value_type>,
3994 _Expr, __scalar_expr<typename _Expr::value_type> > >
3996 operator-(const _Expr& __x, const typename _Expr::value_type& __y)
3998 typedef typename _Expr::value_type value_type;
3999 typedef _BinaryOp<minus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4000 return __val_expr<_Op>(_Op(minus<value_type>(),
4001 __x, __scalar_expr<value_type>(__y, __x.size())));
4004 template<class _Expr>
4005 inline _LIBCPP_INLINE_VISIBILITY
4008 __is_val_expr<_Expr>::value,
4009 __val_expr<_BinaryOp<minus<typename _Expr::value_type>,
4010 __scalar_expr<typename _Expr::value_type>, _Expr> >
4012 operator-(const typename _Expr::value_type& __x, const _Expr& __y)
4014 typedef typename _Expr::value_type value_type;
4015 typedef _BinaryOp<minus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4016 return __val_expr<_Op>(_Op(minus<value_type>(),
4017 __scalar_expr<value_type>(__x, __y.size()), __y));
4020 template<class _Expr1, class _Expr2>
4021 inline _LIBCPP_INLINE_VISIBILITY
4024 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4025 __val_expr<_BinaryOp<bit_xor<typename _Expr1::value_type>, _Expr1, _Expr2> >
4027 operator^(const _Expr1& __x, const _Expr2& __y)
4029 typedef typename _Expr1::value_type value_type;
4030 typedef _BinaryOp<bit_xor<value_type>, _Expr1, _Expr2> _Op;
4031 return __val_expr<_Op>(_Op(bit_xor<value_type>(), __x, __y));
4034 template<class _Expr>
4035 inline _LIBCPP_INLINE_VISIBILITY
4038 __is_val_expr<_Expr>::value,
4039 __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
4040 _Expr, __scalar_expr<typename _Expr::value_type> > >
4042 operator^(const _Expr& __x, const typename _Expr::value_type& __y)
4044 typedef typename _Expr::value_type value_type;
4045 typedef _BinaryOp<bit_xor<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4046 return __val_expr<_Op>(_Op(bit_xor<value_type>(),
4047 __x, __scalar_expr<value_type>(__y, __x.size())));
4050 template<class _Expr>
4051 inline _LIBCPP_INLINE_VISIBILITY
4054 __is_val_expr<_Expr>::value,
4055 __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
4056 __scalar_expr<typename _Expr::value_type>, _Expr> >
4058 operator^(const typename _Expr::value_type& __x, const _Expr& __y)
4060 typedef typename _Expr::value_type value_type;
4061 typedef _BinaryOp<bit_xor<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4062 return __val_expr<_Op>(_Op(bit_xor<value_type>(),
4063 __scalar_expr<value_type>(__x, __y.size()), __y));
4066 template<class _Expr1, class _Expr2>
4067 inline _LIBCPP_INLINE_VISIBILITY
4070 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4071 __val_expr<_BinaryOp<bit_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
4073 operator&(const _Expr1& __x, const _Expr2& __y)
4075 typedef typename _Expr1::value_type value_type;
4076 typedef _BinaryOp<bit_and<value_type>, _Expr1, _Expr2> _Op;
4077 return __val_expr<_Op>(_Op(bit_and<value_type>(), __x, __y));
4080 template<class _Expr>
4081 inline _LIBCPP_INLINE_VISIBILITY
4084 __is_val_expr<_Expr>::value,
4085 __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
4086 _Expr, __scalar_expr<typename _Expr::value_type> > >
4088 operator&(const _Expr& __x, const typename _Expr::value_type& __y)
4090 typedef typename _Expr::value_type value_type;
4091 typedef _BinaryOp<bit_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4092 return __val_expr<_Op>(_Op(bit_and<value_type>(),
4093 __x, __scalar_expr<value_type>(__y, __x.size())));
4096 template<class _Expr>
4097 inline _LIBCPP_INLINE_VISIBILITY
4100 __is_val_expr<_Expr>::value,
4101 __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
4102 __scalar_expr<typename _Expr::value_type>, _Expr> >
4104 operator&(const typename _Expr::value_type& __x, const _Expr& __y)
4106 typedef typename _Expr::value_type value_type;
4107 typedef _BinaryOp<bit_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4108 return __val_expr<_Op>(_Op(bit_and<value_type>(),
4109 __scalar_expr<value_type>(__x, __y.size()), __y));
4112 template<class _Expr1, class _Expr2>
4113 inline _LIBCPP_INLINE_VISIBILITY
4116 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4117 __val_expr<_BinaryOp<bit_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
4119 operator|(const _Expr1& __x, const _Expr2& __y)
4121 typedef typename _Expr1::value_type value_type;
4122 typedef _BinaryOp<bit_or<value_type>, _Expr1, _Expr2> _Op;
4123 return __val_expr<_Op>(_Op(bit_or<value_type>(), __x, __y));
4126 template<class _Expr>
4127 inline _LIBCPP_INLINE_VISIBILITY
4130 __is_val_expr<_Expr>::value,
4131 __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
4132 _Expr, __scalar_expr<typename _Expr::value_type> > >
4134 operator|(const _Expr& __x, const typename _Expr::value_type& __y)
4136 typedef typename _Expr::value_type value_type;
4137 typedef _BinaryOp<bit_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4138 return __val_expr<_Op>(_Op(bit_or<value_type>(),
4139 __x, __scalar_expr<value_type>(__y, __x.size())));
4142 template<class _Expr>
4143 inline _LIBCPP_INLINE_VISIBILITY
4146 __is_val_expr<_Expr>::value,
4147 __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
4148 __scalar_expr<typename _Expr::value_type>, _Expr> >
4150 operator|(const typename _Expr::value_type& __x, const _Expr& __y)
4152 typedef typename _Expr::value_type value_type;
4153 typedef _BinaryOp<bit_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4154 return __val_expr<_Op>(_Op(bit_or<value_type>(),
4155 __scalar_expr<value_type>(__x, __y.size()), __y));
4158 template<class _Expr1, class _Expr2>
4159 inline _LIBCPP_INLINE_VISIBILITY
4162 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4163 __val_expr<_BinaryOp<__bit_shift_left<typename _Expr1::value_type>, _Expr1, _Expr2> >
4165 operator<<(const _Expr1& __x, const _Expr2& __y)
4167 typedef typename _Expr1::value_type value_type;
4168 typedef _BinaryOp<__bit_shift_left<value_type>, _Expr1, _Expr2> _Op;
4169 return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), __x, __y));
4172 template<class _Expr>
4173 inline _LIBCPP_INLINE_VISIBILITY
4176 __is_val_expr<_Expr>::value,
4177 __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
4178 _Expr, __scalar_expr<typename _Expr::value_type> > >
4180 operator<<(const _Expr& __x, const typename _Expr::value_type& __y)
4182 typedef typename _Expr::value_type value_type;
4183 typedef _BinaryOp<__bit_shift_left<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4184 return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
4185 __x, __scalar_expr<value_type>(__y, __x.size())));
4188 template<class _Expr>
4189 inline _LIBCPP_INLINE_VISIBILITY
4192 __is_val_expr<_Expr>::value,
4193 __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
4194 __scalar_expr<typename _Expr::value_type>, _Expr> >
4196 operator<<(const typename _Expr::value_type& __x, const _Expr& __y)
4198 typedef typename _Expr::value_type value_type;
4199 typedef _BinaryOp<__bit_shift_left<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4200 return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
4201 __scalar_expr<value_type>(__x, __y.size()), __y));
4204 template<class _Expr1, class _Expr2>
4205 inline _LIBCPP_INLINE_VISIBILITY
4208 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4209 __val_expr<_BinaryOp<__bit_shift_right<typename _Expr1::value_type>, _Expr1, _Expr2> >
4211 operator>>(const _Expr1& __x, const _Expr2& __y)
4213 typedef typename _Expr1::value_type value_type;
4214 typedef _BinaryOp<__bit_shift_right<value_type>, _Expr1, _Expr2> _Op;
4215 return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), __x, __y));
4218 template<class _Expr>
4219 inline _LIBCPP_INLINE_VISIBILITY
4222 __is_val_expr<_Expr>::value,
4223 __val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
4224 _Expr, __scalar_expr<typename _Expr::value_type> > >
4226 operator>>(const _Expr& __x, const typename _Expr::value_type& __y)
4228 typedef typename _Expr::value_type value_type;
4229 typedef _BinaryOp<__bit_shift_right<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4230 return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
4231 __x, __scalar_expr<value_type>(__y, __x.size())));
4234 template<class _Expr>
4235 inline _LIBCPP_INLINE_VISIBILITY
4238 __is_val_expr<_Expr>::value,
4239 __val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
4240 __scalar_expr<typename _Expr::value_type>, _Expr> >
4242 operator>>(const typename _Expr::value_type& __x, const _Expr& __y)
4244 typedef typename _Expr::value_type value_type;
4245 typedef _BinaryOp<__bit_shift_right<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4246 return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
4247 __scalar_expr<value_type>(__x, __y.size()), __y));
4250 template<class _Expr1, class _Expr2>
4251 inline _LIBCPP_INLINE_VISIBILITY
4254 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4255 __val_expr<_BinaryOp<logical_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
4257 operator&&(const _Expr1& __x, const _Expr2& __y)
4259 typedef typename _Expr1::value_type value_type;
4260 typedef _BinaryOp<logical_and<value_type>, _Expr1, _Expr2> _Op;
4261 return __val_expr<_Op>(_Op(logical_and<value_type>(), __x, __y));
4264 template<class _Expr>
4265 inline _LIBCPP_INLINE_VISIBILITY
4268 __is_val_expr<_Expr>::value,
4269 __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
4270 _Expr, __scalar_expr<typename _Expr::value_type> > >
4272 operator&&(const _Expr& __x, const typename _Expr::value_type& __y)
4274 typedef typename _Expr::value_type value_type;
4275 typedef _BinaryOp<logical_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4276 return __val_expr<_Op>(_Op(logical_and<value_type>(),
4277 __x, __scalar_expr<value_type>(__y, __x.size())));
4280 template<class _Expr>
4281 inline _LIBCPP_INLINE_VISIBILITY
4284 __is_val_expr<_Expr>::value,
4285 __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
4286 __scalar_expr<typename _Expr::value_type>, _Expr> >
4288 operator&&(const typename _Expr::value_type& __x, const _Expr& __y)
4290 typedef typename _Expr::value_type value_type;
4291 typedef _BinaryOp<logical_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4292 return __val_expr<_Op>(_Op(logical_and<value_type>(),
4293 __scalar_expr<value_type>(__x, __y.size()), __y));
4296 template<class _Expr1, class _Expr2>
4297 inline _LIBCPP_INLINE_VISIBILITY
4300 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4301 __val_expr<_BinaryOp<logical_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
4303 operator||(const _Expr1& __x, const _Expr2& __y)
4305 typedef typename _Expr1::value_type value_type;
4306 typedef _BinaryOp<logical_or<value_type>, _Expr1, _Expr2> _Op;
4307 return __val_expr<_Op>(_Op(logical_or<value_type>(), __x, __y));
4310 template<class _Expr>
4311 inline _LIBCPP_INLINE_VISIBILITY
4314 __is_val_expr<_Expr>::value,
4315 __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
4316 _Expr, __scalar_expr<typename _Expr::value_type> > >
4318 operator||(const _Expr& __x, const typename _Expr::value_type& __y)
4320 typedef typename _Expr::value_type value_type;
4321 typedef _BinaryOp<logical_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4322 return __val_expr<_Op>(_Op(logical_or<value_type>(),
4323 __x, __scalar_expr<value_type>(__y, __x.size())));
4326 template<class _Expr>
4327 inline _LIBCPP_INLINE_VISIBILITY
4330 __is_val_expr<_Expr>::value,
4331 __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
4332 __scalar_expr<typename _Expr::value_type>, _Expr> >
4334 operator||(const typename _Expr::value_type& __x, const _Expr& __y)
4336 typedef typename _Expr::value_type value_type;
4337 typedef _BinaryOp<logical_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4338 return __val_expr<_Op>(_Op(logical_or<value_type>(),
4339 __scalar_expr<value_type>(__x, __y.size()), __y));
4342 template<class _Expr1, class _Expr2>
4343 inline _LIBCPP_INLINE_VISIBILITY
4346 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4347 __val_expr<_BinaryOp<equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
4349 operator==(const _Expr1& __x, const _Expr2& __y)
4351 typedef typename _Expr1::value_type value_type;
4352 typedef _BinaryOp<equal_to<value_type>, _Expr1, _Expr2> _Op;
4353 return __val_expr<_Op>(_Op(equal_to<value_type>(), __x, __y));
4356 template<class _Expr>
4357 inline _LIBCPP_INLINE_VISIBILITY
4360 __is_val_expr<_Expr>::value,
4361 __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
4362 _Expr, __scalar_expr<typename _Expr::value_type> > >
4364 operator==(const _Expr& __x, const typename _Expr::value_type& __y)
4366 typedef typename _Expr::value_type value_type;
4367 typedef _BinaryOp<equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4368 return __val_expr<_Op>(_Op(equal_to<value_type>(),
4369 __x, __scalar_expr<value_type>(__y, __x.size())));
4372 template<class _Expr>
4373 inline _LIBCPP_INLINE_VISIBILITY
4376 __is_val_expr<_Expr>::value,
4377 __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
4378 __scalar_expr<typename _Expr::value_type>, _Expr> >
4380 operator==(const typename _Expr::value_type& __x, const _Expr& __y)
4382 typedef typename _Expr::value_type value_type;
4383 typedef _BinaryOp<equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4384 return __val_expr<_Op>(_Op(equal_to<value_type>(),
4385 __scalar_expr<value_type>(__x, __y.size()), __y));
4388 template<class _Expr1, class _Expr2>
4389 inline _LIBCPP_INLINE_VISIBILITY
4392 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4393 __val_expr<_BinaryOp<not_equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
4395 operator!=(const _Expr1& __x, const _Expr2& __y)
4397 typedef typename _Expr1::value_type value_type;
4398 typedef _BinaryOp<not_equal_to<value_type>, _Expr1, _Expr2> _Op;
4399 return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __x, __y));
4402 template<class _Expr>
4403 inline _LIBCPP_INLINE_VISIBILITY
4406 __is_val_expr<_Expr>::value,
4407 __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
4408 _Expr, __scalar_expr<typename _Expr::value_type> > >
4410 operator!=(const _Expr& __x, const typename _Expr::value_type& __y)
4412 typedef typename _Expr::value_type value_type;
4413 typedef _BinaryOp<not_equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4414 return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
4415 __x, __scalar_expr<value_type>(__y, __x.size())));
4418 template<class _Expr>
4419 inline _LIBCPP_INLINE_VISIBILITY
4422 __is_val_expr<_Expr>::value,
4423 __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
4424 __scalar_expr<typename _Expr::value_type>, _Expr> >
4426 operator!=(const typename _Expr::value_type& __x, const _Expr& __y)
4428 typedef typename _Expr::value_type value_type;
4429 typedef _BinaryOp<not_equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4430 return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
4431 __scalar_expr<value_type>(__x, __y.size()), __y));
4434 template<class _Expr1, class _Expr2>
4435 inline _LIBCPP_INLINE_VISIBILITY
4438 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4439 __val_expr<_BinaryOp<less<typename _Expr1::value_type>, _Expr1, _Expr2> >
4441 operator<(const _Expr1& __x, const _Expr2& __y)
4443 typedef typename _Expr1::value_type value_type;
4444 typedef _BinaryOp<less<value_type>, _Expr1, _Expr2> _Op;
4445 return __val_expr<_Op>(_Op(less<value_type>(), __x, __y));
4448 template<class _Expr>
4449 inline _LIBCPP_INLINE_VISIBILITY
4452 __is_val_expr<_Expr>::value,
4453 __val_expr<_BinaryOp<less<typename _Expr::value_type>,
4454 _Expr, __scalar_expr<typename _Expr::value_type> > >
4456 operator<(const _Expr& __x, const typename _Expr::value_type& __y)
4458 typedef typename _Expr::value_type value_type;
4459 typedef _BinaryOp<less<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4460 return __val_expr<_Op>(_Op(less<value_type>(),
4461 __x, __scalar_expr<value_type>(__y, __x.size())));
4464 template<class _Expr>
4465 inline _LIBCPP_INLINE_VISIBILITY
4468 __is_val_expr<_Expr>::value,
4469 __val_expr<_BinaryOp<less<typename _Expr::value_type>,
4470 __scalar_expr<typename _Expr::value_type>, _Expr> >
4472 operator<(const typename _Expr::value_type& __x, const _Expr& __y)
4474 typedef typename _Expr::value_type value_type;
4475 typedef _BinaryOp<less<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4476 return __val_expr<_Op>(_Op(less<value_type>(),
4477 __scalar_expr<value_type>(__x, __y.size()), __y));
4480 template<class _Expr1, class _Expr2>
4481 inline _LIBCPP_INLINE_VISIBILITY
4484 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4485 __val_expr<_BinaryOp<greater<typename _Expr1::value_type>, _Expr1, _Expr2> >
4487 operator>(const _Expr1& __x, const _Expr2& __y)
4489 typedef typename _Expr1::value_type value_type;
4490 typedef _BinaryOp<greater<value_type>, _Expr1, _Expr2> _Op;
4491 return __val_expr<_Op>(_Op(greater<value_type>(), __x, __y));
4494 template<class _Expr>
4495 inline _LIBCPP_INLINE_VISIBILITY
4498 __is_val_expr<_Expr>::value,
4499 __val_expr<_BinaryOp<greater<typename _Expr::value_type>,
4500 _Expr, __scalar_expr<typename _Expr::value_type> > >
4502 operator>(const _Expr& __x, const typename _Expr::value_type& __y)
4504 typedef typename _Expr::value_type value_type;
4505 typedef _BinaryOp<greater<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4506 return __val_expr<_Op>(_Op(greater<value_type>(),
4507 __x, __scalar_expr<value_type>(__y, __x.size())));
4510 template<class _Expr>
4511 inline _LIBCPP_INLINE_VISIBILITY
4514 __is_val_expr<_Expr>::value,
4515 __val_expr<_BinaryOp<greater<typename _Expr::value_type>,
4516 __scalar_expr<typename _Expr::value_type>, _Expr> >
4518 operator>(const typename _Expr::value_type& __x, const _Expr& __y)
4520 typedef typename _Expr::value_type value_type;
4521 typedef _BinaryOp<greater<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4522 return __val_expr<_Op>(_Op(greater<value_type>(),
4523 __scalar_expr<value_type>(__x, __y.size()), __y));
4526 template<class _Expr1, class _Expr2>
4527 inline _LIBCPP_INLINE_VISIBILITY
4530 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4531 __val_expr<_BinaryOp<less_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
4533 operator<=(const _Expr1& __x, const _Expr2& __y)
4535 typedef typename _Expr1::value_type value_type;
4536 typedef _BinaryOp<less_equal<value_type>, _Expr1, _Expr2> _Op;
4537 return __val_expr<_Op>(_Op(less_equal<value_type>(), __x, __y));
4540 template<class _Expr>
4541 inline _LIBCPP_INLINE_VISIBILITY
4544 __is_val_expr<_Expr>::value,
4545 __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
4546 _Expr, __scalar_expr<typename _Expr::value_type> > >
4548 operator<=(const _Expr& __x, const typename _Expr::value_type& __y)
4550 typedef typename _Expr::value_type value_type;
4551 typedef _BinaryOp<less_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4552 return __val_expr<_Op>(_Op(less_equal<value_type>(),
4553 __x, __scalar_expr<value_type>(__y, __x.size())));
4556 template<class _Expr>
4557 inline _LIBCPP_INLINE_VISIBILITY
4560 __is_val_expr<_Expr>::value,
4561 __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
4562 __scalar_expr<typename _Expr::value_type>, _Expr> >
4564 operator<=(const typename _Expr::value_type& __x, const _Expr& __y)
4566 typedef typename _Expr::value_type value_type;
4567 typedef _BinaryOp<less_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4568 return __val_expr<_Op>(_Op(less_equal<value_type>(),
4569 __scalar_expr<value_type>(__x, __y.size()), __y));
4572 template<class _Expr1, class _Expr2>
4573 inline _LIBCPP_INLINE_VISIBILITY
4576 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4577 __val_expr<_BinaryOp<greater_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
4579 operator>=(const _Expr1& __x, const _Expr2& __y)
4581 typedef typename _Expr1::value_type value_type;
4582 typedef _BinaryOp<greater_equal<value_type>, _Expr1, _Expr2> _Op;
4583 return __val_expr<_Op>(_Op(greater_equal<value_type>(), __x, __y));
4586 template<class _Expr>
4587 inline _LIBCPP_INLINE_VISIBILITY
4590 __is_val_expr<_Expr>::value,
4591 __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
4592 _Expr, __scalar_expr<typename _Expr::value_type> > >
4594 operator>=(const _Expr& __x, const typename _Expr::value_type& __y)
4596 typedef typename _Expr::value_type value_type;
4597 typedef _BinaryOp<greater_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4598 return __val_expr<_Op>(_Op(greater_equal<value_type>(),
4599 __x, __scalar_expr<value_type>(__y, __x.size())));
4602 template<class _Expr>
4603 inline _LIBCPP_INLINE_VISIBILITY
4606 __is_val_expr<_Expr>::value,
4607 __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
4608 __scalar_expr<typename _Expr::value_type>, _Expr> >
4610 operator>=(const typename _Expr::value_type& __x, const _Expr& __y)
4612 typedef typename _Expr::value_type value_type;
4613 typedef _BinaryOp<greater_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4614 return __val_expr<_Op>(_Op(greater_equal<value_type>(),
4615 __scalar_expr<value_type>(__x, __y.size()), __y));
4618 template<class _Expr>
4619 inline _LIBCPP_INLINE_VISIBILITY
4622 __is_val_expr<_Expr>::value,
4623 __val_expr<_UnaryOp<__abs_expr<typename _Expr::value_type>, _Expr> >
4625 abs(const _Expr& __x)
4627 typedef typename _Expr::value_type value_type;
4628 typedef _UnaryOp<__abs_expr<value_type>, _Expr> _Op;
4629 return __val_expr<_Op>(_Op(__abs_expr<value_type>(), __x));
4632 template<class _Expr>
4633 inline _LIBCPP_INLINE_VISIBILITY
4636 __is_val_expr<_Expr>::value,
4637 __val_expr<_UnaryOp<__acos_expr<typename _Expr::value_type>, _Expr> >
4639 acos(const _Expr& __x)
4641 typedef typename _Expr::value_type value_type;
4642 typedef _UnaryOp<__acos_expr<value_type>, _Expr> _Op;
4643 return __val_expr<_Op>(_Op(__acos_expr<value_type>(), __x));
4646 template<class _Expr>
4647 inline _LIBCPP_INLINE_VISIBILITY
4650 __is_val_expr<_Expr>::value,
4651 __val_expr<_UnaryOp<__asin_expr<typename _Expr::value_type>, _Expr> >
4653 asin(const _Expr& __x)
4655 typedef typename _Expr::value_type value_type;
4656 typedef _UnaryOp<__asin_expr<value_type>, _Expr> _Op;
4657 return __val_expr<_Op>(_Op(__asin_expr<value_type>(), __x));
4660 template<class _Expr>
4661 inline _LIBCPP_INLINE_VISIBILITY
4664 __is_val_expr<_Expr>::value,
4665 __val_expr<_UnaryOp<__atan_expr<typename _Expr::value_type>, _Expr> >
4667 atan(const _Expr& __x)
4669 typedef typename _Expr::value_type value_type;
4670 typedef _UnaryOp<__atan_expr<value_type>, _Expr> _Op;
4671 return __val_expr<_Op>(_Op(__atan_expr<value_type>(), __x));
4674 template<class _Expr1, class _Expr2>
4675 inline _LIBCPP_INLINE_VISIBILITY
4678 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4679 __val_expr<_BinaryOp<__atan2_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
4681 atan2(const _Expr1& __x, const _Expr2& __y)
4683 typedef typename _Expr1::value_type value_type;
4684 typedef _BinaryOp<__atan2_expr<value_type>, _Expr1, _Expr2> _Op;
4685 return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __x, __y));
4688 template<class _Expr>
4689 inline _LIBCPP_INLINE_VISIBILITY
4692 __is_val_expr<_Expr>::value,
4693 __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
4694 _Expr, __scalar_expr<typename _Expr::value_type> > >
4696 atan2(const _Expr& __x, const typename _Expr::value_type& __y)
4698 typedef typename _Expr::value_type value_type;
4699 typedef _BinaryOp<__atan2_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4700 return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
4701 __x, __scalar_expr<value_type>(__y, __x.size())));
4704 template<class _Expr>
4705 inline _LIBCPP_INLINE_VISIBILITY
4708 __is_val_expr<_Expr>::value,
4709 __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
4710 __scalar_expr<typename _Expr::value_type>, _Expr> >
4712 atan2(const typename _Expr::value_type& __x, const _Expr& __y)
4714 typedef typename _Expr::value_type value_type;
4715 typedef _BinaryOp<__atan2_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4716 return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
4717 __scalar_expr<value_type>(__x, __y.size()), __y));
4720 template<class _Expr>
4721 inline _LIBCPP_INLINE_VISIBILITY
4724 __is_val_expr<_Expr>::value,
4725 __val_expr<_UnaryOp<__cos_expr<typename _Expr::value_type>, _Expr> >
4727 cos(const _Expr& __x)
4729 typedef typename _Expr::value_type value_type;
4730 typedef _UnaryOp<__cos_expr<value_type>, _Expr> _Op;
4731 return __val_expr<_Op>(_Op(__cos_expr<value_type>(), __x));
4734 template<class _Expr>
4735 inline _LIBCPP_INLINE_VISIBILITY
4738 __is_val_expr<_Expr>::value,
4739 __val_expr<_UnaryOp<__cosh_expr<typename _Expr::value_type>, _Expr> >
4741 cosh(const _Expr& __x)
4743 typedef typename _Expr::value_type value_type;
4744 typedef _UnaryOp<__cosh_expr<value_type>, _Expr> _Op;
4745 return __val_expr<_Op>(_Op(__cosh_expr<value_type>(), __x));
4748 template<class _Expr>
4749 inline _LIBCPP_INLINE_VISIBILITY
4752 __is_val_expr<_Expr>::value,
4753 __val_expr<_UnaryOp<__exp_expr<typename _Expr::value_type>, _Expr> >
4755 exp(const _Expr& __x)
4757 typedef typename _Expr::value_type value_type;
4758 typedef _UnaryOp<__exp_expr<value_type>, _Expr> _Op;
4759 return __val_expr<_Op>(_Op(__exp_expr<value_type>(), __x));
4762 template<class _Expr>
4763 inline _LIBCPP_INLINE_VISIBILITY
4766 __is_val_expr<_Expr>::value,
4767 __val_expr<_UnaryOp<__log_expr<typename _Expr::value_type>, _Expr> >
4769 log(const _Expr& __x)
4771 typedef typename _Expr::value_type value_type;
4772 typedef _UnaryOp<__log_expr<value_type>, _Expr> _Op;
4773 return __val_expr<_Op>(_Op(__log_expr<value_type>(), __x));
4776 template<class _Expr>
4777 inline _LIBCPP_INLINE_VISIBILITY
4780 __is_val_expr<_Expr>::value,
4781 __val_expr<_UnaryOp<__log10_expr<typename _Expr::value_type>, _Expr> >
4783 log10(const _Expr& __x)
4785 typedef typename _Expr::value_type value_type;
4786 typedef _UnaryOp<__log10_expr<value_type>, _Expr> _Op;
4787 return __val_expr<_Op>(_Op(__log10_expr<value_type>(), __x));
4790 template<class _Expr1, class _Expr2>
4791 inline _LIBCPP_INLINE_VISIBILITY
4794 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4795 __val_expr<_BinaryOp<__pow_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
4797 pow(const _Expr1& __x, const _Expr2& __y)
4799 typedef typename _Expr1::value_type value_type;
4800 typedef _BinaryOp<__pow_expr<value_type>, _Expr1, _Expr2> _Op;
4801 return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __x, __y));
4804 template<class _Expr>
4805 inline _LIBCPP_INLINE_VISIBILITY
4808 __is_val_expr<_Expr>::value,
4809 __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
4810 _Expr, __scalar_expr<typename _Expr::value_type> > >
4812 pow(const _Expr& __x, const typename _Expr::value_type& __y)
4814 typedef typename _Expr::value_type value_type;
4815 typedef _BinaryOp<__pow_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4816 return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
4817 __x, __scalar_expr<value_type>(__y, __x.size())));
4820 template<class _Expr>
4821 inline _LIBCPP_INLINE_VISIBILITY
4824 __is_val_expr<_Expr>::value,
4825 __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
4826 __scalar_expr<typename _Expr::value_type>, _Expr> >
4828 pow(const typename _Expr::value_type& __x, const _Expr& __y)
4830 typedef typename _Expr::value_type value_type;
4831 typedef _BinaryOp<__pow_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4832 return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
4833 __scalar_expr<value_type>(__x, __y.size()), __y));
4836 template<class _Expr>
4837 inline _LIBCPP_INLINE_VISIBILITY
4840 __is_val_expr<_Expr>::value,
4841 __val_expr<_UnaryOp<__sin_expr<typename _Expr::value_type>, _Expr> >
4843 sin(const _Expr& __x)
4845 typedef typename _Expr::value_type value_type;
4846 typedef _UnaryOp<__sin_expr<value_type>, _Expr> _Op;
4847 return __val_expr<_Op>(_Op(__sin_expr<value_type>(), __x));
4850 template<class _Expr>
4851 inline _LIBCPP_INLINE_VISIBILITY
4854 __is_val_expr<_Expr>::value,
4855 __val_expr<_UnaryOp<__sinh_expr<typename _Expr::value_type>, _Expr> >
4857 sinh(const _Expr& __x)
4859 typedef typename _Expr::value_type value_type;
4860 typedef _UnaryOp<__sinh_expr<value_type>, _Expr> _Op;
4861 return __val_expr<_Op>(_Op(__sinh_expr<value_type>(), __x));
4864 template<class _Expr>
4865 inline _LIBCPP_INLINE_VISIBILITY
4868 __is_val_expr<_Expr>::value,
4869 __val_expr<_UnaryOp<__sqrt_expr<typename _Expr::value_type>, _Expr> >
4871 sqrt(const _Expr& __x)
4873 typedef typename _Expr::value_type value_type;
4874 typedef _UnaryOp<__sqrt_expr<value_type>, _Expr> _Op;
4875 return __val_expr<_Op>(_Op(__sqrt_expr<value_type>(), __x));
4878 template<class _Expr>
4879 inline _LIBCPP_INLINE_VISIBILITY
4882 __is_val_expr<_Expr>::value,
4883 __val_expr<_UnaryOp<__tan_expr<typename _Expr::value_type>, _Expr> >
4885 tan(const _Expr& __x)
4887 typedef typename _Expr::value_type value_type;
4888 typedef _UnaryOp<__tan_expr<value_type>, _Expr> _Op;
4889 return __val_expr<_Op>(_Op(__tan_expr<value_type>(), __x));
4892 template<class _Expr>
4893 inline _LIBCPP_INLINE_VISIBILITY
4896 __is_val_expr<_Expr>::value,
4897 __val_expr<_UnaryOp<__tanh_expr<typename _Expr::value_type>, _Expr> >
4899 tanh(const _Expr& __x)
4901 typedef typename _Expr::value_type value_type;
4902 typedef _UnaryOp<__tanh_expr<value_type>, _Expr> _Op;
4903 return __val_expr<_Op>(_Op(__tanh_expr<value_type>(), __x));
4906 template <class _Tp>
4907 inline _LIBCPP_INLINE_VISIBILITY
4909 begin(valarray<_Tp>& __v)
4911 return __v.__begin_;
4914 template <class _Tp>
4915 inline _LIBCPP_INLINE_VISIBILITY
4917 begin(const valarray<_Tp>& __v)
4919 return __v.__begin_;
4922 template <class _Tp>
4923 inline _LIBCPP_INLINE_VISIBILITY
4925 end(valarray<_Tp>& __v)
4930 template <class _Tp>
4931 inline _LIBCPP_INLINE_VISIBILITY
4933 end(const valarray<_Tp>& __v)
4938 _LIBCPP_END_NAMESPACE_STD
4942 #endif // _LIBCPP_VALARRAY