2 //===-------------------------- valarray ----------------------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 #ifndef _LIBCPP_VALARRAY
12 #define _LIBCPP_VALARRAY
28 explicit valarray(size_t n);
29 valarray(const value_type& x, size_t n);
30 valarray(const value_type* px, size_t n);
31 valarray(const valarray& v);
32 valarray(valarray&& v) noexcept;
33 valarray(const slice_array<value_type>& sa);
34 valarray(const gslice_array<value_type>& ga);
35 valarray(const mask_array<value_type>& ma);
36 valarray(const indirect_array<value_type>& ia);
37 valarray(initializer_list<value_type> il);
41 valarray& operator=(const valarray& v);
42 valarray& operator=(valarray&& v) noexcept;
43 valarray& operator=(initializer_list<value_type> il);
44 valarray& operator=(const value_type& x);
45 valarray& operator=(const slice_array<value_type>& sa);
46 valarray& operator=(const gslice_array<value_type>& ga);
47 valarray& operator=(const mask_array<value_type>& ma);
48 valarray& operator=(const indirect_array<value_type>& ia);
51 const value_type& operator[](size_t i) const;
52 value_type& operator[](size_t i);
55 valarray operator[](slice s) const;
56 slice_array<value_type> operator[](slice s);
57 valarray operator[](const gslice& gs) const;
58 gslice_array<value_type> operator[](const gslice& gs);
59 valarray operator[](const valarray<bool>& vb) const;
60 mask_array<value_type> operator[](const valarray<bool>& vb);
61 valarray operator[](const valarray<size_t>& vs) const;
62 indirect_array<value_type> operator[](const valarray<size_t>& vs);
65 valarray operator+() const;
66 valarray operator-() const;
67 valarray operator~() const;
68 valarray<bool> operator!() const;
70 // computed assignment:
71 valarray& operator*= (const value_type& x);
72 valarray& operator/= (const value_type& x);
73 valarray& operator%= (const value_type& x);
74 valarray& operator+= (const value_type& x);
75 valarray& operator-= (const value_type& x);
76 valarray& operator^= (const value_type& x);
77 valarray& operator&= (const value_type& x);
78 valarray& operator|= (const value_type& x);
79 valarray& operator<<=(const value_type& x);
80 valarray& operator>>=(const value_type& x);
82 valarray& operator*= (const valarray& v);
83 valarray& operator/= (const valarray& v);
84 valarray& operator%= (const valarray& v);
85 valarray& operator+= (const valarray& v);
86 valarray& operator-= (const valarray& v);
87 valarray& operator^= (const valarray& v);
88 valarray& operator|= (const valarray& v);
89 valarray& operator&= (const valarray& v);
90 valarray& operator<<=(const valarray& v);
91 valarray& operator>>=(const valarray& v);
94 void swap(valarray& v) noexcept;
98 value_type sum() const;
99 value_type min() const;
100 value_type max() const;
102 valarray shift (int i) const;
103 valarray cshift(int i) const;
104 valarray apply(value_type f(value_type)) const;
105 valarray apply(value_type f(const value_type&)) const;
106 void resize(size_t n, value_type x = value_type());
113 slice(size_t start, size_t size, size_t stride);
115 size_t start() const;
117 size_t stride() const;
124 typedef T value_type;
126 const slice_array& operator=(const slice_array& sa) const;
127 void operator= (const valarray<value_type>& v) const;
128 void operator*= (const valarray<value_type>& v) const;
129 void operator/= (const valarray<value_type>& v) const;
130 void operator%= (const valarray<value_type>& v) const;
131 void operator+= (const valarray<value_type>& v) const;
132 void operator-= (const valarray<value_type>& v) const;
133 void operator^= (const valarray<value_type>& v) const;
134 void operator&= (const valarray<value_type>& v) const;
135 void operator|= (const valarray<value_type>& v) const;
136 void operator<<=(const valarray<value_type>& v) const;
137 void operator>>=(const valarray<value_type>& v) const;
139 void operator=(const value_type& x) const;
141 slice_array() = delete;
148 gslice(size_t start, const valarray<size_t>& size,
149 const valarray<size_t>& stride);
151 size_t start() const;
152 valarray<size_t> size() const;
153 valarray<size_t> stride() const;
160 typedef T value_type;
162 void operator= (const valarray<value_type>& v) const;
163 void operator*= (const valarray<value_type>& v) const;
164 void operator/= (const valarray<value_type>& v) const;
165 void operator%= (const valarray<value_type>& v) const;
166 void operator+= (const valarray<value_type>& v) const;
167 void operator-= (const valarray<value_type>& v) const;
168 void operator^= (const valarray<value_type>& v) const;
169 void operator&= (const valarray<value_type>& v) const;
170 void operator|= (const valarray<value_type>& v) const;
171 void operator<<=(const valarray<value_type>& v) const;
172 void operator>>=(const valarray<value_type>& v) const;
174 gslice_array(const gslice_array& ga);
176 const gslice_array& operator=(const gslice_array& ga) const;
177 void operator=(const value_type& x) const;
179 gslice_array() = delete;
186 typedef T value_type;
188 void operator= (const valarray<value_type>& v) const;
189 void operator*= (const valarray<value_type>& v) const;
190 void operator/= (const valarray<value_type>& v) const;
191 void operator%= (const valarray<value_type>& v) const;
192 void operator+= (const valarray<value_type>& v) const;
193 void operator-= (const valarray<value_type>& v) const;
194 void operator^= (const valarray<value_type>& v) const;
195 void operator&= (const valarray<value_type>& v) const;
196 void operator|= (const valarray<value_type>& v) const;
197 void operator<<=(const valarray<value_type>& v) const;
198 void operator>>=(const valarray<value_type>& v) const;
200 mask_array(const mask_array& ma);
202 const mask_array& operator=(const mask_array& ma) const;
203 void operator=(const value_type& x) const;
205 mask_array() = delete;
212 typedef T value_type;
214 void operator= (const valarray<value_type>& v) const;
215 void operator*= (const valarray<value_type>& v) const;
216 void operator/= (const valarray<value_type>& v) const;
217 void operator%= (const valarray<value_type>& v) const;
218 void operator+= (const valarray<value_type>& v) const;
219 void operator-= (const valarray<value_type>& v) const;
220 void operator^= (const valarray<value_type>& v) const;
221 void operator&= (const valarray<value_type>& v) const;
222 void operator|= (const valarray<value_type>& v) const;
223 void operator<<=(const valarray<value_type>& v) const;
224 void operator>>=(const valarray<value_type>& v) const;
226 indirect_array(const indirect_array& ia);
228 const indirect_array& operator=(const indirect_array& ia) const;
229 void operator=(const value_type& x) const;
231 indirect_array() = delete;
234 template<class T> void swap(valarray<T>& x, valarray<T>& y) noexcept;
236 template<class T> valarray<T> operator* (const valarray<T>& x, const valarray<T>& y);
237 template<class T> valarray<T> operator* (const valarray<T>& x, const T& y);
238 template<class T> valarray<T> operator* (const T& x, const valarray<T>& y);
240 template<class T> valarray<T> operator/ (const valarray<T>& x, const valarray<T>& y);
241 template<class T> valarray<T> operator/ (const valarray<T>& x, const T& y);
242 template<class T> valarray<T> operator/ (const T& x, const valarray<T>& y);
244 template<class T> valarray<T> operator% (const valarray<T>& x, const valarray<T>& y);
245 template<class T> valarray<T> operator% (const valarray<T>& x, const T& y);
246 template<class T> valarray<T> operator% (const T& x, const valarray<T>& y);
248 template<class T> valarray<T> operator+ (const valarray<T>& x, const valarray<T>& y);
249 template<class T> valarray<T> operator+ (const valarray<T>& x, const T& y);
250 template<class T> valarray<T> operator+ (const T& x, const valarray<T>& y);
252 template<class T> valarray<T> operator- (const valarray<T>& x, const valarray<T>& y);
253 template<class T> valarray<T> operator- (const valarray<T>& x, const T& y);
254 template<class T> valarray<T> operator- (const T& x, const valarray<T>& y);
256 template<class T> valarray<T> operator^ (const valarray<T>& x, const valarray<T>& y);
257 template<class T> valarray<T> operator^ (const valarray<T>& x, const T& y);
258 template<class T> valarray<T> operator^ (const T& x, const valarray<T>& y);
260 template<class T> valarray<T> operator& (const valarray<T>& x, const valarray<T>& y);
261 template<class T> valarray<T> operator& (const valarray<T>& x, const T& y);
262 template<class T> valarray<T> operator& (const T& x, const valarray<T>& y);
264 template<class T> valarray<T> operator| (const valarray<T>& x, const valarray<T>& y);
265 template<class T> valarray<T> operator| (const valarray<T>& x, const T& y);
266 template<class T> valarray<T> operator| (const T& x, const valarray<T>& y);
268 template<class T> valarray<T> operator<<(const valarray<T>& x, const valarray<T>& y);
269 template<class T> valarray<T> operator<<(const valarray<T>& x, const T& y);
270 template<class T> valarray<T> operator<<(const T& x, const valarray<T>& y);
272 template<class T> valarray<T> operator>>(const valarray<T>& x, const valarray<T>& y);
273 template<class T> valarray<T> operator>>(const valarray<T>& x, const T& y);
274 template<class T> valarray<T> operator>>(const T& x, const valarray<T>& y);
276 template<class T> valarray<bool> operator&&(const valarray<T>& x, const valarray<T>& y);
277 template<class T> valarray<bool> operator&&(const valarray<T>& x, const T& y);
278 template<class T> valarray<bool> operator&&(const T& x, const valarray<T>& y);
280 template<class T> valarray<bool> operator||(const valarray<T>& x, const valarray<T>& y);
281 template<class T> valarray<bool> operator||(const valarray<T>& x, const T& y);
282 template<class T> valarray<bool> operator||(const T& x, const valarray<T>& y);
284 template<class T> valarray<bool> operator==(const valarray<T>& x, const valarray<T>& y);
285 template<class T> valarray<bool> operator==(const valarray<T>& x, const T& y);
286 template<class T> valarray<bool> operator==(const T& x, const valarray<T>& y);
288 template<class T> valarray<bool> operator!=(const valarray<T>& x, const valarray<T>& y);
289 template<class T> valarray<bool> operator!=(const valarray<T>& x, const T& y);
290 template<class T> valarray<bool> operator!=(const T& x, const valarray<T>& y);
292 template<class T> valarray<bool> operator< (const valarray<T>& x, const valarray<T>& y);
293 template<class T> valarray<bool> operator< (const valarray<T>& x, const T& y);
294 template<class T> valarray<bool> operator< (const T& x, const valarray<T>& y);
296 template<class T> valarray<bool> operator> (const valarray<T>& x, const valarray<T>& y);
297 template<class T> valarray<bool> operator> (const valarray<T>& x, const T& y);
298 template<class T> valarray<bool> operator> (const T& x, const valarray<T>& y);
300 template<class T> valarray<bool> operator<=(const valarray<T>& x, const valarray<T>& y);
301 template<class T> valarray<bool> operator<=(const valarray<T>& x, const T& y);
302 template<class T> valarray<bool> operator<=(const T& x, const valarray<T>& y);
304 template<class T> valarray<bool> operator>=(const valarray<T>& x, const valarray<T>& y);
305 template<class T> valarray<bool> operator>=(const valarray<T>& x, const T& y);
306 template<class T> valarray<bool> operator>=(const T& x, const valarray<T>& y);
308 template<class T> valarray<T> abs (const valarray<T>& x);
309 template<class T> valarray<T> acos (const valarray<T>& x);
310 template<class T> valarray<T> asin (const valarray<T>& x);
311 template<class T> valarray<T> atan (const valarray<T>& x);
313 template<class T> valarray<T> atan2(const valarray<T>& x, const valarray<T>& y);
314 template<class T> valarray<T> atan2(const valarray<T>& x, const T& y);
315 template<class T> valarray<T> atan2(const T& x, const valarray<T>& y);
317 template<class T> valarray<T> cos (const valarray<T>& x);
318 template<class T> valarray<T> cosh (const valarray<T>& x);
319 template<class T> valarray<T> exp (const valarray<T>& x);
320 template<class T> valarray<T> log (const valarray<T>& x);
321 template<class T> valarray<T> log10(const valarray<T>& x);
323 template<class T> valarray<T> pow(const valarray<T>& x, const valarray<T>& y);
324 template<class T> valarray<T> pow(const valarray<T>& x, const T& y);
325 template<class T> valarray<T> pow(const T& x, const valarray<T>& y);
327 template<class T> valarray<T> sin (const valarray<T>& x);
328 template<class T> valarray<T> sinh (const valarray<T>& x);
329 template<class T> valarray<T> sqrt (const valarray<T>& x);
330 template<class T> valarray<T> tan (const valarray<T>& x);
331 template<class T> valarray<T> tanh (const valarray<T>& x);
333 template <class T> unspecified1 begin(valarray<T>& v);
334 template <class T> unspecified2 begin(const valarray<T>& v);
335 template <class T> unspecified1 end(valarray<T>& v);
336 template <class T> unspecified2 end(const valarray<T>& v);
345 #include <initializer_list>
347 #include <functional>
350 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
351 #pragma GCC system_header
355 #include <__undef_macros>
358 _LIBCPP_BEGIN_NAMESPACE_STD
360 template<class _Tp> class _LIBCPP_TEMPLATE_VIS valarray;
362 class _LIBCPP_TEMPLATE_VIS slice
368 _LIBCPP_INLINE_VISIBILITY
375 _LIBCPP_INLINE_VISIBILITY
376 slice(size_t __start, size_t __size, size_t __stride)
382 _LIBCPP_INLINE_VISIBILITY size_t start() const {return __start_;}
383 _LIBCPP_INLINE_VISIBILITY size_t size() const {return __size_;}
384 _LIBCPP_INLINE_VISIBILITY size_t stride() const {return __stride_;}
387 template <class _Tp> class _LIBCPP_TEMPLATE_VIS slice_array;
388 class _LIBCPP_TYPE_VIS gslice;
389 template <class _Tp> class _LIBCPP_TEMPLATE_VIS gslice_array;
390 template <class _Tp> class _LIBCPP_TEMPLATE_VIS mask_array;
391 template <class _Tp> class _LIBCPP_TEMPLATE_VIS indirect_array;
394 _LIBCPP_INLINE_VISIBILITY
396 begin(valarray<_Tp>& __v);
399 _LIBCPP_INLINE_VISIBILITY
401 begin(const valarray<_Tp>& __v);
404 _LIBCPP_INLINE_VISIBILITY
406 end(valarray<_Tp>& __v);
409 _LIBCPP_INLINE_VISIBILITY
411 end(const valarray<_Tp>& __v);
413 template <class _Op, class _A0>
416 typedef typename _Op::result_type result_type;
417 typedef typename _A0::value_type value_type;
422 _LIBCPP_INLINE_VISIBILITY
423 _UnaryOp(const _Op& __op, const _A0& __a0) : __op_(__op), __a0_(__a0) {}
425 _LIBCPP_INLINE_VISIBILITY
426 result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
428 _LIBCPP_INLINE_VISIBILITY
429 size_t size() const {return __a0_.size();}
432 template <class _Op, class _A0, class _A1>
435 typedef typename _Op::result_type result_type;
436 typedef typename _A0::value_type value_type;
442 _LIBCPP_INLINE_VISIBILITY
443 _BinaryOp(const _Op& __op, const _A0& __a0, const _A1& __a1)
444 : __op_(__op), __a0_(__a0), __a1_(__a1) {}
446 _LIBCPP_INLINE_VISIBILITY
447 value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
449 _LIBCPP_INLINE_VISIBILITY
450 size_t size() const {return __a0_.size();}
457 typedef _Tp value_type;
458 typedef const _Tp& result_type;
460 const value_type& __t_;
463 _LIBCPP_INLINE_VISIBILITY
464 explicit __scalar_expr(const value_type& __t, size_t __s) : __t_(__t), __s_(__s) {}
466 _LIBCPP_INLINE_VISIBILITY
467 result_type operator[](size_t) const {return __t_;}
469 _LIBCPP_INLINE_VISIBILITY
470 size_t size() const {return __s_;}
474 struct __unary_plus : unary_function<_Tp, _Tp>
476 _LIBCPP_INLINE_VISIBILITY
477 _Tp operator()(const _Tp& __x) const
482 struct __bit_not : unary_function<_Tp, _Tp>
484 _LIBCPP_INLINE_VISIBILITY
485 _Tp operator()(const _Tp& __x) const
490 struct __bit_shift_left : binary_function<_Tp, _Tp, _Tp>
492 _LIBCPP_INLINE_VISIBILITY
493 _Tp operator()(const _Tp& __x, const _Tp& __y) const
498 struct __bit_shift_right : binary_function<_Tp, _Tp, _Tp>
500 _LIBCPP_INLINE_VISIBILITY
501 _Tp operator()(const _Tp& __x, const _Tp& __y) const
505 template <class _Tp, class _Fp>
506 struct __apply_expr : unary_function<_Tp, _Tp>
511 _LIBCPP_INLINE_VISIBILITY
512 explicit __apply_expr(_Fp __f) : __f_(__f) {}
514 _LIBCPP_INLINE_VISIBILITY
515 _Tp operator()(const _Tp& __x) const
520 struct __abs_expr : unary_function<_Tp, _Tp>
522 _LIBCPP_INLINE_VISIBILITY
523 _Tp operator()(const _Tp& __x) const
528 struct __acos_expr : unary_function<_Tp, _Tp>
530 _LIBCPP_INLINE_VISIBILITY
531 _Tp operator()(const _Tp& __x) const
536 struct __asin_expr : unary_function<_Tp, _Tp>
538 _LIBCPP_INLINE_VISIBILITY
539 _Tp operator()(const _Tp& __x) const
544 struct __atan_expr : unary_function<_Tp, _Tp>
546 _LIBCPP_INLINE_VISIBILITY
547 _Tp operator()(const _Tp& __x) const
552 struct __atan2_expr : binary_function<_Tp, _Tp, _Tp>
554 _LIBCPP_INLINE_VISIBILITY
555 _Tp operator()(const _Tp& __x, const _Tp& __y) const
556 {return atan2(__x, __y);}
560 struct __cos_expr : unary_function<_Tp, _Tp>
562 _LIBCPP_INLINE_VISIBILITY
563 _Tp operator()(const _Tp& __x) const
568 struct __cosh_expr : unary_function<_Tp, _Tp>
570 _LIBCPP_INLINE_VISIBILITY
571 _Tp operator()(const _Tp& __x) const
576 struct __exp_expr : unary_function<_Tp, _Tp>
578 _LIBCPP_INLINE_VISIBILITY
579 _Tp operator()(const _Tp& __x) const
584 struct __log_expr : unary_function<_Tp, _Tp>
586 _LIBCPP_INLINE_VISIBILITY
587 _Tp operator()(const _Tp& __x) const
592 struct __log10_expr : unary_function<_Tp, _Tp>
594 _LIBCPP_INLINE_VISIBILITY
595 _Tp operator()(const _Tp& __x) const
600 struct __pow_expr : binary_function<_Tp, _Tp, _Tp>
602 _LIBCPP_INLINE_VISIBILITY
603 _Tp operator()(const _Tp& __x, const _Tp& __y) const
604 {return pow(__x, __y);}
608 struct __sin_expr : unary_function<_Tp, _Tp>
610 _LIBCPP_INLINE_VISIBILITY
611 _Tp operator()(const _Tp& __x) const
616 struct __sinh_expr : unary_function<_Tp, _Tp>
618 _LIBCPP_INLINE_VISIBILITY
619 _Tp operator()(const _Tp& __x) const
624 struct __sqrt_expr : unary_function<_Tp, _Tp>
626 _LIBCPP_INLINE_VISIBILITY
627 _Tp operator()(const _Tp& __x) const
632 struct __tan_expr : unary_function<_Tp, _Tp>
634 _LIBCPP_INLINE_VISIBILITY
635 _Tp operator()(const _Tp& __x) const
640 struct __tanh_expr : unary_function<_Tp, _Tp>
642 _LIBCPP_INLINE_VISIBILITY
643 _Tp operator()(const _Tp& __x) const
647 template <class _ValExpr>
650 typedef typename remove_reference<_ValExpr>::type _RmExpr;
652 typedef typename _RmExpr::value_type value_type;
653 typedef value_type result_type;
661 _LIBCPP_INLINE_VISIBILITY
662 __slice_expr(const slice& __sl, const _RmExpr& __e)
664 __start_(__sl.start()),
665 __size_(__sl.size()),
666 __stride_(__sl.stride())
670 _LIBCPP_INLINE_VISIBILITY
671 result_type operator[](size_t __i) const
672 {return __expr_[__start_ + __i * __stride_];}
674 _LIBCPP_INLINE_VISIBILITY
675 size_t size() const {return __size_;}
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 valarray<size_t>::valarray(size_t))
1063 _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::~valarray())
1064 _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void valarray<size_t>::resize(size_t, size_t))
1066 template <class _Op, class _Tp>
1067 struct _UnaryOp<_Op, valarray<_Tp> >
1069 typedef typename _Op::result_type result_type;
1070 typedef _Tp value_type;
1073 const valarray<_Tp>& __a0_;
1075 _LIBCPP_INLINE_VISIBILITY
1076 _UnaryOp(const _Op& __op, const valarray<_Tp>& __a0) : __op_(__op), __a0_(__a0) {}
1078 _LIBCPP_INLINE_VISIBILITY
1079 result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
1081 _LIBCPP_INLINE_VISIBILITY
1082 size_t size() const {return __a0_.size();}
1085 template <class _Op, class _Tp, class _A1>
1086 struct _BinaryOp<_Op, valarray<_Tp>, _A1>
1088 typedef typename _Op::result_type result_type;
1089 typedef _Tp value_type;
1092 const valarray<_Tp>& __a0_;
1095 _LIBCPP_INLINE_VISIBILITY
1096 _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const _A1& __a1)
1097 : __op_(__op), __a0_(__a0), __a1_(__a1) {}
1099 _LIBCPP_INLINE_VISIBILITY
1100 value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
1102 _LIBCPP_INLINE_VISIBILITY
1103 size_t size() const {return __a0_.size();}
1106 template <class _Op, class _A0, class _Tp>
1107 struct _BinaryOp<_Op, _A0, valarray<_Tp> >
1109 typedef typename _Op::result_type result_type;
1110 typedef _Tp value_type;
1114 const valarray<_Tp>& __a1_;
1116 _LIBCPP_INLINE_VISIBILITY
1117 _BinaryOp(const _Op& __op, const _A0& __a0, const valarray<_Tp>& __a1)
1118 : __op_(__op), __a0_(__a0), __a1_(__a1) {}
1120 _LIBCPP_INLINE_VISIBILITY
1121 value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
1123 _LIBCPP_INLINE_VISIBILITY
1124 size_t size() const {return __a0_.size();}
1127 template <class _Op, class _Tp>
1128 struct _BinaryOp<_Op, valarray<_Tp>, valarray<_Tp> >
1130 typedef typename _Op::result_type result_type;
1131 typedef _Tp value_type;
1134 const valarray<_Tp>& __a0_;
1135 const valarray<_Tp>& __a1_;
1137 _LIBCPP_INLINE_VISIBILITY
1138 _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const valarray<_Tp>& __a1)
1139 : __op_(__op), __a0_(__a0), __a1_(__a1) {}
1141 _LIBCPP_INLINE_VISIBILITY
1142 value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
1144 _LIBCPP_INLINE_VISIBILITY
1145 size_t size() const {return __a0_.size();}
1150 template <class _Tp>
1151 class _LIBCPP_TEMPLATE_VIS slice_array
1154 typedef _Tp value_type;
1162 template <class _Expr>
1165 __is_val_expr<_Expr>::value,
1168 _LIBCPP_INLINE_VISIBILITY
1169 operator=(const _Expr& __v) const;
1171 template <class _Expr>
1174 __is_val_expr<_Expr>::value,
1177 _LIBCPP_INLINE_VISIBILITY
1178 operator*=(const _Expr& __v) const;
1180 template <class _Expr>
1183 __is_val_expr<_Expr>::value,
1186 _LIBCPP_INLINE_VISIBILITY
1187 operator/=(const _Expr& __v) const;
1189 template <class _Expr>
1192 __is_val_expr<_Expr>::value,
1195 _LIBCPP_INLINE_VISIBILITY
1196 operator%=(const _Expr& __v) const;
1198 template <class _Expr>
1201 __is_val_expr<_Expr>::value,
1204 _LIBCPP_INLINE_VISIBILITY
1205 operator+=(const _Expr& __v) const;
1207 template <class _Expr>
1210 __is_val_expr<_Expr>::value,
1213 _LIBCPP_INLINE_VISIBILITY
1214 operator-=(const _Expr& __v) const;
1216 template <class _Expr>
1219 __is_val_expr<_Expr>::value,
1222 _LIBCPP_INLINE_VISIBILITY
1223 operator^=(const _Expr& __v) const;
1225 template <class _Expr>
1228 __is_val_expr<_Expr>::value,
1231 _LIBCPP_INLINE_VISIBILITY
1232 operator&=(const _Expr& __v) const;
1234 template <class _Expr>
1237 __is_val_expr<_Expr>::value,
1240 _LIBCPP_INLINE_VISIBILITY
1241 operator|=(const _Expr& __v) const;
1243 template <class _Expr>
1246 __is_val_expr<_Expr>::value,
1249 _LIBCPP_INLINE_VISIBILITY
1250 operator<<=(const _Expr& __v) const;
1252 template <class _Expr>
1255 __is_val_expr<_Expr>::value,
1258 _LIBCPP_INLINE_VISIBILITY
1259 operator>>=(const _Expr& __v) const;
1261 _LIBCPP_INLINE_VISIBILITY
1262 const slice_array& operator=(const slice_array& __sa) const;
1264 _LIBCPP_INLINE_VISIBILITY
1265 void operator=(const value_type& __x) const;
1268 _LIBCPP_INLINE_VISIBILITY
1269 slice_array(const slice& __sl, const valarray<value_type>& __v)
1270 : __vp_(const_cast<value_type*>(__v.__begin_ + __sl.start())),
1271 __size_(__sl.size()),
1272 __stride_(__sl.stride())
1275 template <class> friend class valarray;
1276 template <class> friend class sliceExpr;
1279 template <class _Tp>
1281 const slice_array<_Tp>&
1282 slice_array<_Tp>::operator=(const slice_array& __sa) const
1284 value_type* __t = __vp_;
1285 const value_type* __s = __sa.__vp_;
1286 for (size_t __n = __size_; __n; --__n, __t += __stride_, __s += __sa.__stride_)
1291 template <class _Tp>
1292 template <class _Expr>
1296 __is_val_expr<_Expr>::value,
1299 slice_array<_Tp>::operator=(const _Expr& __v) const
1301 value_type* __t = __vp_;
1302 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1306 template <class _Tp>
1307 template <class _Expr>
1311 __is_val_expr<_Expr>::value,
1314 slice_array<_Tp>::operator*=(const _Expr& __v) const
1316 value_type* __t = __vp_;
1317 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1321 template <class _Tp>
1322 template <class _Expr>
1326 __is_val_expr<_Expr>::value,
1329 slice_array<_Tp>::operator/=(const _Expr& __v) const
1331 value_type* __t = __vp_;
1332 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1336 template <class _Tp>
1337 template <class _Expr>
1341 __is_val_expr<_Expr>::value,
1344 slice_array<_Tp>::operator%=(const _Expr& __v) const
1346 value_type* __t = __vp_;
1347 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1351 template <class _Tp>
1352 template <class _Expr>
1356 __is_val_expr<_Expr>::value,
1359 slice_array<_Tp>::operator+=(const _Expr& __v) const
1361 value_type* __t = __vp_;
1362 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1366 template <class _Tp>
1367 template <class _Expr>
1371 __is_val_expr<_Expr>::value,
1374 slice_array<_Tp>::operator-=(const _Expr& __v) const
1376 value_type* __t = __vp_;
1377 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1381 template <class _Tp>
1382 template <class _Expr>
1386 __is_val_expr<_Expr>::value,
1389 slice_array<_Tp>::operator^=(const _Expr& __v) const
1391 value_type* __t = __vp_;
1392 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1396 template <class _Tp>
1397 template <class _Expr>
1401 __is_val_expr<_Expr>::value,
1404 slice_array<_Tp>::operator&=(const _Expr& __v) const
1406 value_type* __t = __vp_;
1407 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1411 template <class _Tp>
1412 template <class _Expr>
1416 __is_val_expr<_Expr>::value,
1419 slice_array<_Tp>::operator|=(const _Expr& __v) const
1421 value_type* __t = __vp_;
1422 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1426 template <class _Tp>
1427 template <class _Expr>
1431 __is_val_expr<_Expr>::value,
1434 slice_array<_Tp>::operator<<=(const _Expr& __v) const
1436 value_type* __t = __vp_;
1437 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1441 template <class _Tp>
1442 template <class _Expr>
1446 __is_val_expr<_Expr>::value,
1449 slice_array<_Tp>::operator>>=(const _Expr& __v) const
1451 value_type* __t = __vp_;
1452 for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1456 template <class _Tp>
1459 slice_array<_Tp>::operator=(const value_type& __x) const
1461 value_type* __t = __vp_;
1462 for (size_t __n = __size_; __n; --__n, __t += __stride_)
1468 class _LIBCPP_TYPE_VIS gslice
1470 valarray<size_t> __size_;
1471 valarray<size_t> __stride_;
1472 valarray<size_t> __1d_;
1475 _LIBCPP_INLINE_VISIBILITY
1478 _LIBCPP_INLINE_VISIBILITY
1479 gslice(size_t __start, const valarray<size_t>& __size,
1480 const valarray<size_t>& __stride)
1485 #ifndef _LIBCPP_CXX03_LANG
1487 _LIBCPP_INLINE_VISIBILITY
1488 gslice(size_t __start, const valarray<size_t>& __size,
1489 valarray<size_t>&& __stride)
1491 __stride_(move(__stride))
1494 _LIBCPP_INLINE_VISIBILITY
1495 gslice(size_t __start, valarray<size_t>&& __size,
1496 const valarray<size_t>& __stride)
1497 : __size_(move(__size)),
1501 _LIBCPP_INLINE_VISIBILITY
1502 gslice(size_t __start, valarray<size_t>&& __size,
1503 valarray<size_t>&& __stride)
1504 : __size_(move(__size)),
1505 __stride_(move(__stride))
1508 #endif // _LIBCPP_CXX03_LANG
1510 // gslice(const gslice&) = default;
1511 // gslice(gslice&&) = default;
1512 // gslice& operator=(const gslice&) = default;
1513 // gslice& operator=(gslice&&) = default;
1515 _LIBCPP_INLINE_VISIBILITY
1516 size_t start() const {return __1d_.size() ? __1d_[0] : 0;}
1518 _LIBCPP_INLINE_VISIBILITY
1519 valarray<size_t> size() const {return __size_;}
1521 _LIBCPP_INLINE_VISIBILITY
1522 valarray<size_t> stride() const {return __stride_;}
1525 void __init(size_t __start);
1527 template <class> friend class gslice_array;
1528 template <class> friend class valarray;
1529 template <class> friend class __val_expr;
1534 template <class _Tp>
1535 class _LIBCPP_TEMPLATE_VIS gslice_array
1538 typedef _Tp value_type;
1542 valarray<size_t> __1d_;
1545 template <class _Expr>
1548 __is_val_expr<_Expr>::value,
1551 _LIBCPP_INLINE_VISIBILITY
1552 operator=(const _Expr& __v) const;
1554 template <class _Expr>
1557 __is_val_expr<_Expr>::value,
1560 _LIBCPP_INLINE_VISIBILITY
1561 operator*=(const _Expr& __v) const;
1563 template <class _Expr>
1566 __is_val_expr<_Expr>::value,
1569 _LIBCPP_INLINE_VISIBILITY
1570 operator/=(const _Expr& __v) const;
1572 template <class _Expr>
1575 __is_val_expr<_Expr>::value,
1578 _LIBCPP_INLINE_VISIBILITY
1579 operator%=(const _Expr& __v) const;
1581 template <class _Expr>
1584 __is_val_expr<_Expr>::value,
1587 _LIBCPP_INLINE_VISIBILITY
1588 operator+=(const _Expr& __v) const;
1590 template <class _Expr>
1593 __is_val_expr<_Expr>::value,
1596 _LIBCPP_INLINE_VISIBILITY
1597 operator-=(const _Expr& __v) const;
1599 template <class _Expr>
1602 __is_val_expr<_Expr>::value,
1605 _LIBCPP_INLINE_VISIBILITY
1606 operator^=(const _Expr& __v) const;
1608 template <class _Expr>
1611 __is_val_expr<_Expr>::value,
1614 _LIBCPP_INLINE_VISIBILITY
1615 operator&=(const _Expr& __v) const;
1617 template <class _Expr>
1620 __is_val_expr<_Expr>::value,
1623 _LIBCPP_INLINE_VISIBILITY
1624 operator|=(const _Expr& __v) const;
1626 template <class _Expr>
1629 __is_val_expr<_Expr>::value,
1632 _LIBCPP_INLINE_VISIBILITY
1633 operator<<=(const _Expr& __v) const;
1635 template <class _Expr>
1638 __is_val_expr<_Expr>::value,
1641 _LIBCPP_INLINE_VISIBILITY
1642 operator>>=(const _Expr& __v) const;
1644 _LIBCPP_INLINE_VISIBILITY
1645 const gslice_array& operator=(const gslice_array& __ga) const;
1647 _LIBCPP_INLINE_VISIBILITY
1648 void operator=(const value_type& __x) const;
1650 // gslice_array(const gslice_array&) = default;
1651 // gslice_array(gslice_array&&) = default;
1652 // gslice_array& operator=(const gslice_array&) = default;
1653 // gslice_array& operator=(gslice_array&&) = default;
1656 gslice_array(const gslice& __gs, const valarray<value_type>& __v)
1657 : __vp_(const_cast<value_type*>(__v.__begin_)),
1661 #ifndef _LIBCPP_CXX03_LANG
1662 gslice_array(gslice&& __gs, const valarray<value_type>& __v)
1663 : __vp_(const_cast<value_type*>(__v.__begin_)),
1664 __1d_(move(__gs.__1d_))
1666 #endif // _LIBCPP_CXX03_LANG
1668 template <class> friend class valarray;
1671 template <class _Tp>
1672 template <class _Expr>
1676 __is_val_expr<_Expr>::value,
1679 gslice_array<_Tp>::operator=(const _Expr& __v) const
1681 typedef const size_t* _Ip;
1683 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1684 __vp_[*__i] = __v[__j];
1687 template <class _Tp>
1688 template <class _Expr>
1692 __is_val_expr<_Expr>::value,
1695 gslice_array<_Tp>::operator*=(const _Expr& __v) const
1697 typedef const size_t* _Ip;
1699 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1700 __vp_[*__i] *= __v[__j];
1703 template <class _Tp>
1704 template <class _Expr>
1708 __is_val_expr<_Expr>::value,
1711 gslice_array<_Tp>::operator/=(const _Expr& __v) const
1713 typedef const size_t* _Ip;
1715 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1716 __vp_[*__i] /= __v[__j];
1719 template <class _Tp>
1720 template <class _Expr>
1724 __is_val_expr<_Expr>::value,
1727 gslice_array<_Tp>::operator%=(const _Expr& __v) const
1729 typedef const size_t* _Ip;
1731 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1732 __vp_[*__i] %= __v[__j];
1735 template <class _Tp>
1736 template <class _Expr>
1740 __is_val_expr<_Expr>::value,
1743 gslice_array<_Tp>::operator+=(const _Expr& __v) const
1745 typedef const size_t* _Ip;
1747 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1748 __vp_[*__i] += __v[__j];
1751 template <class _Tp>
1752 template <class _Expr>
1756 __is_val_expr<_Expr>::value,
1759 gslice_array<_Tp>::operator-=(const _Expr& __v) const
1761 typedef const size_t* _Ip;
1763 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1764 __vp_[*__i] -= __v[__j];
1767 template <class _Tp>
1768 template <class _Expr>
1772 __is_val_expr<_Expr>::value,
1775 gslice_array<_Tp>::operator^=(const _Expr& __v) const
1777 typedef const size_t* _Ip;
1779 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1780 __vp_[*__i] ^= __v[__j];
1783 template <class _Tp>
1784 template <class _Expr>
1788 __is_val_expr<_Expr>::value,
1791 gslice_array<_Tp>::operator&=(const _Expr& __v) const
1793 typedef const size_t* _Ip;
1795 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1796 __vp_[*__i] &= __v[__j];
1799 template <class _Tp>
1800 template <class _Expr>
1804 __is_val_expr<_Expr>::value,
1807 gslice_array<_Tp>::operator|=(const _Expr& __v) const
1809 typedef const size_t* _Ip;
1811 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1812 __vp_[*__i] |= __v[__j];
1815 template <class _Tp>
1816 template <class _Expr>
1820 __is_val_expr<_Expr>::value,
1823 gslice_array<_Tp>::operator<<=(const _Expr& __v) const
1825 typedef const size_t* _Ip;
1827 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1828 __vp_[*__i] <<= __v[__j];
1831 template <class _Tp>
1832 template <class _Expr>
1836 __is_val_expr<_Expr>::value,
1839 gslice_array<_Tp>::operator>>=(const _Expr& __v) const
1841 typedef const size_t* _Ip;
1843 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1844 __vp_[*__i] >>= __v[__j];
1847 template <class _Tp>
1849 const gslice_array<_Tp>&
1850 gslice_array<_Tp>::operator=(const gslice_array& __ga) const
1852 typedef const size_t* _Ip;
1853 const value_type* __s = __ga.__vp_;
1854 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ga.__1d_.__begin_;
1855 __i != __e; ++__i, ++__j)
1856 __vp_[*__i] = __s[*__j];
1860 template <class _Tp>
1863 gslice_array<_Tp>::operator=(const value_type& __x) const
1865 typedef const size_t* _Ip;
1866 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
1872 template <class _Tp>
1873 class _LIBCPP_TEMPLATE_VIS mask_array
1876 typedef _Tp value_type;
1880 valarray<size_t> __1d_;
1883 template <class _Expr>
1886 __is_val_expr<_Expr>::value,
1889 _LIBCPP_INLINE_VISIBILITY
1890 operator=(const _Expr& __v) const;
1892 template <class _Expr>
1895 __is_val_expr<_Expr>::value,
1898 _LIBCPP_INLINE_VISIBILITY
1899 operator*=(const _Expr& __v) const;
1901 template <class _Expr>
1904 __is_val_expr<_Expr>::value,
1907 _LIBCPP_INLINE_VISIBILITY
1908 operator/=(const _Expr& __v) const;
1910 template <class _Expr>
1913 __is_val_expr<_Expr>::value,
1916 _LIBCPP_INLINE_VISIBILITY
1917 operator%=(const _Expr& __v) const;
1919 template <class _Expr>
1922 __is_val_expr<_Expr>::value,
1925 _LIBCPP_INLINE_VISIBILITY
1926 operator+=(const _Expr& __v) const;
1928 template <class _Expr>
1931 __is_val_expr<_Expr>::value,
1934 _LIBCPP_INLINE_VISIBILITY
1935 operator-=(const _Expr& __v) const;
1937 template <class _Expr>
1940 __is_val_expr<_Expr>::value,
1943 _LIBCPP_INLINE_VISIBILITY
1944 operator^=(const _Expr& __v) const;
1946 template <class _Expr>
1949 __is_val_expr<_Expr>::value,
1952 _LIBCPP_INLINE_VISIBILITY
1953 operator&=(const _Expr& __v) const;
1955 template <class _Expr>
1958 __is_val_expr<_Expr>::value,
1961 _LIBCPP_INLINE_VISIBILITY
1962 operator|=(const _Expr& __v) const;
1964 template <class _Expr>
1967 __is_val_expr<_Expr>::value,
1970 _LIBCPP_INLINE_VISIBILITY
1971 operator<<=(const _Expr& __v) const;
1973 template <class _Expr>
1976 __is_val_expr<_Expr>::value,
1979 _LIBCPP_INLINE_VISIBILITY
1980 operator>>=(const _Expr& __v) const;
1982 _LIBCPP_INLINE_VISIBILITY
1983 const mask_array& operator=(const mask_array& __ma) const;
1985 _LIBCPP_INLINE_VISIBILITY
1986 void operator=(const value_type& __x) const;
1988 // mask_array(const mask_array&) = default;
1989 // mask_array(mask_array&&) = default;
1990 // mask_array& operator=(const mask_array&) = default;
1991 // mask_array& operator=(mask_array&&) = default;
1994 _LIBCPP_INLINE_VISIBILITY
1995 mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v)
1996 : __vp_(const_cast<value_type*>(__v.__begin_)),
1997 __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
2000 for (size_t __i = 0; __i < __vb.size(); ++__i)
2005 template <class> friend class valarray;
2008 template <class _Tp>
2009 template <class _Expr>
2013 __is_val_expr<_Expr>::value,
2016 mask_array<_Tp>::operator=(const _Expr& __v) const
2018 size_t __n = __1d_.size();
2019 for (size_t __i = 0; __i < __n; ++__i)
2020 __vp_[__1d_[__i]] = __v[__i];
2023 template <class _Tp>
2024 template <class _Expr>
2028 __is_val_expr<_Expr>::value,
2031 mask_array<_Tp>::operator*=(const _Expr& __v) const
2033 size_t __n = __1d_.size();
2034 for (size_t __i = 0; __i < __n; ++__i)
2035 __vp_[__1d_[__i]] *= __v[__i];
2038 template <class _Tp>
2039 template <class _Expr>
2043 __is_val_expr<_Expr>::value,
2046 mask_array<_Tp>::operator/=(const _Expr& __v) const
2048 size_t __n = __1d_.size();
2049 for (size_t __i = 0; __i < __n; ++__i)
2050 __vp_[__1d_[__i]] /= __v[__i];
2053 template <class _Tp>
2054 template <class _Expr>
2058 __is_val_expr<_Expr>::value,
2061 mask_array<_Tp>::operator%=(const _Expr& __v) const
2063 size_t __n = __1d_.size();
2064 for (size_t __i = 0; __i < __n; ++__i)
2065 __vp_[__1d_[__i]] %= __v[__i];
2068 template <class _Tp>
2069 template <class _Expr>
2073 __is_val_expr<_Expr>::value,
2076 mask_array<_Tp>::operator+=(const _Expr& __v) const
2078 size_t __n = __1d_.size();
2079 for (size_t __i = 0; __i < __n; ++__i)
2080 __vp_[__1d_[__i]] += __v[__i];
2083 template <class _Tp>
2084 template <class _Expr>
2088 __is_val_expr<_Expr>::value,
2091 mask_array<_Tp>::operator-=(const _Expr& __v) const
2093 size_t __n = __1d_.size();
2094 for (size_t __i = 0; __i < __n; ++__i)
2095 __vp_[__1d_[__i]] -= __v[__i];
2098 template <class _Tp>
2099 template <class _Expr>
2103 __is_val_expr<_Expr>::value,
2106 mask_array<_Tp>::operator^=(const _Expr& __v) const
2108 size_t __n = __1d_.size();
2109 for (size_t __i = 0; __i < __n; ++__i)
2110 __vp_[__1d_[__i]] ^= __v[__i];
2113 template <class _Tp>
2114 template <class _Expr>
2118 __is_val_expr<_Expr>::value,
2121 mask_array<_Tp>::operator&=(const _Expr& __v) const
2123 size_t __n = __1d_.size();
2124 for (size_t __i = 0; __i < __n; ++__i)
2125 __vp_[__1d_[__i]] &= __v[__i];
2128 template <class _Tp>
2129 template <class _Expr>
2133 __is_val_expr<_Expr>::value,
2136 mask_array<_Tp>::operator|=(const _Expr& __v) const
2138 size_t __n = __1d_.size();
2139 for (size_t __i = 0; __i < __n; ++__i)
2140 __vp_[__1d_[__i]] |= __v[__i];
2143 template <class _Tp>
2144 template <class _Expr>
2148 __is_val_expr<_Expr>::value,
2151 mask_array<_Tp>::operator<<=(const _Expr& __v) const
2153 size_t __n = __1d_.size();
2154 for (size_t __i = 0; __i < __n; ++__i)
2155 __vp_[__1d_[__i]] <<= __v[__i];
2158 template <class _Tp>
2159 template <class _Expr>
2163 __is_val_expr<_Expr>::value,
2166 mask_array<_Tp>::operator>>=(const _Expr& __v) const
2168 size_t __n = __1d_.size();
2169 for (size_t __i = 0; __i < __n; ++__i)
2170 __vp_[__1d_[__i]] >>= __v[__i];
2173 template <class _Tp>
2175 const mask_array<_Tp>&
2176 mask_array<_Tp>::operator=(const mask_array& __ma) const
2178 size_t __n = __1d_.size();
2179 for (size_t __i = 0; __i < __n; ++__i)
2180 __vp_[__1d_[__i]] = __ma.__vp_[__1d_[__i]];
2184 template <class _Tp>
2187 mask_array<_Tp>::operator=(const value_type& __x) const
2189 size_t __n = __1d_.size();
2190 for (size_t __i = 0; __i < __n; ++__i)
2191 __vp_[__1d_[__i]] = __x;
2194 template <class _ValExpr>
2197 typedef typename remove_reference<_ValExpr>::type _RmExpr;
2199 typedef typename _RmExpr::value_type value_type;
2200 typedef value_type result_type;
2204 valarray<size_t> __1d_;
2206 _LIBCPP_INLINE_VISIBILITY
2207 __mask_expr(const valarray<bool>& __vb, const _RmExpr& __e)
2209 __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
2212 for (size_t __i = 0; __i < __vb.size(); ++__i)
2218 _LIBCPP_INLINE_VISIBILITY
2219 result_type operator[](size_t __i) const
2220 {return __expr_[__1d_[__i]];}
2222 _LIBCPP_INLINE_VISIBILITY
2223 size_t size() const {return __1d_.size();}
2225 template <class> friend class valarray;
2230 template <class _Tp>
2231 class _LIBCPP_TEMPLATE_VIS indirect_array
2234 typedef _Tp value_type;
2238 valarray<size_t> __1d_;
2241 template <class _Expr>
2244 __is_val_expr<_Expr>::value,
2247 _LIBCPP_INLINE_VISIBILITY
2248 operator=(const _Expr& __v) const;
2250 template <class _Expr>
2253 __is_val_expr<_Expr>::value,
2256 _LIBCPP_INLINE_VISIBILITY
2257 operator*=(const _Expr& __v) const;
2259 template <class _Expr>
2262 __is_val_expr<_Expr>::value,
2265 _LIBCPP_INLINE_VISIBILITY
2266 operator/=(const _Expr& __v) const;
2268 template <class _Expr>
2271 __is_val_expr<_Expr>::value,
2274 _LIBCPP_INLINE_VISIBILITY
2275 operator%=(const _Expr& __v) const;
2277 template <class _Expr>
2280 __is_val_expr<_Expr>::value,
2283 _LIBCPP_INLINE_VISIBILITY
2284 operator+=(const _Expr& __v) const;
2286 template <class _Expr>
2289 __is_val_expr<_Expr>::value,
2292 _LIBCPP_INLINE_VISIBILITY
2293 operator-=(const _Expr& __v) const;
2295 template <class _Expr>
2298 __is_val_expr<_Expr>::value,
2301 _LIBCPP_INLINE_VISIBILITY
2302 operator^=(const _Expr& __v) const;
2304 template <class _Expr>
2307 __is_val_expr<_Expr>::value,
2310 _LIBCPP_INLINE_VISIBILITY
2311 operator&=(const _Expr& __v) const;
2313 template <class _Expr>
2316 __is_val_expr<_Expr>::value,
2319 _LIBCPP_INLINE_VISIBILITY
2320 operator|=(const _Expr& __v) const;
2322 template <class _Expr>
2325 __is_val_expr<_Expr>::value,
2328 _LIBCPP_INLINE_VISIBILITY
2329 operator<<=(const _Expr& __v) const;
2331 template <class _Expr>
2334 __is_val_expr<_Expr>::value,
2337 _LIBCPP_INLINE_VISIBILITY
2338 operator>>=(const _Expr& __v) const;
2340 _LIBCPP_INLINE_VISIBILITY
2341 const indirect_array& operator=(const indirect_array& __ia) const;
2343 _LIBCPP_INLINE_VISIBILITY
2344 void operator=(const value_type& __x) const;
2346 // indirect_array(const indirect_array&) = default;
2347 // indirect_array(indirect_array&&) = default;
2348 // indirect_array& operator=(const indirect_array&) = default;
2349 // indirect_array& operator=(indirect_array&&) = default;
2352 _LIBCPP_INLINE_VISIBILITY
2353 indirect_array(const valarray<size_t>& __ia, const valarray<value_type>& __v)
2354 : __vp_(const_cast<value_type*>(__v.__begin_)),
2358 #ifndef _LIBCPP_CXX03_LANG
2360 _LIBCPP_INLINE_VISIBILITY
2361 indirect_array(valarray<size_t>&& __ia, const valarray<value_type>& __v)
2362 : __vp_(const_cast<value_type*>(__v.__begin_)),
2366 #endif // _LIBCPP_CXX03_LANG
2368 template <class> friend class valarray;
2371 template <class _Tp>
2372 template <class _Expr>
2376 __is_val_expr<_Expr>::value,
2379 indirect_array<_Tp>::operator=(const _Expr& __v) const
2381 size_t __n = __1d_.size();
2382 for (size_t __i = 0; __i < __n; ++__i)
2383 __vp_[__1d_[__i]] = __v[__i];
2386 template <class _Tp>
2387 template <class _Expr>
2391 __is_val_expr<_Expr>::value,
2394 indirect_array<_Tp>::operator*=(const _Expr& __v) const
2396 size_t __n = __1d_.size();
2397 for (size_t __i = 0; __i < __n; ++__i)
2398 __vp_[__1d_[__i]] *= __v[__i];
2401 template <class _Tp>
2402 template <class _Expr>
2406 __is_val_expr<_Expr>::value,
2409 indirect_array<_Tp>::operator/=(const _Expr& __v) const
2411 size_t __n = __1d_.size();
2412 for (size_t __i = 0; __i < __n; ++__i)
2413 __vp_[__1d_[__i]] /= __v[__i];
2416 template <class _Tp>
2417 template <class _Expr>
2421 __is_val_expr<_Expr>::value,
2424 indirect_array<_Tp>::operator%=(const _Expr& __v) const
2426 size_t __n = __1d_.size();
2427 for (size_t __i = 0; __i < __n; ++__i)
2428 __vp_[__1d_[__i]] %= __v[__i];
2431 template <class _Tp>
2432 template <class _Expr>
2436 __is_val_expr<_Expr>::value,
2439 indirect_array<_Tp>::operator+=(const _Expr& __v) const
2441 size_t __n = __1d_.size();
2442 for (size_t __i = 0; __i < __n; ++__i)
2443 __vp_[__1d_[__i]] += __v[__i];
2446 template <class _Tp>
2447 template <class _Expr>
2451 __is_val_expr<_Expr>::value,
2454 indirect_array<_Tp>::operator-=(const _Expr& __v) const
2456 size_t __n = __1d_.size();
2457 for (size_t __i = 0; __i < __n; ++__i)
2458 __vp_[__1d_[__i]] -= __v[__i];
2461 template <class _Tp>
2462 template <class _Expr>
2466 __is_val_expr<_Expr>::value,
2469 indirect_array<_Tp>::operator^=(const _Expr& __v) const
2471 size_t __n = __1d_.size();
2472 for (size_t __i = 0; __i < __n; ++__i)
2473 __vp_[__1d_[__i]] ^= __v[__i];
2476 template <class _Tp>
2477 template <class _Expr>
2481 __is_val_expr<_Expr>::value,
2484 indirect_array<_Tp>::operator&=(const _Expr& __v) const
2486 size_t __n = __1d_.size();
2487 for (size_t __i = 0; __i < __n; ++__i)
2488 __vp_[__1d_[__i]] &= __v[__i];
2491 template <class _Tp>
2492 template <class _Expr>
2496 __is_val_expr<_Expr>::value,
2499 indirect_array<_Tp>::operator|=(const _Expr& __v) const
2501 size_t __n = __1d_.size();
2502 for (size_t __i = 0; __i < __n; ++__i)
2503 __vp_[__1d_[__i]] |= __v[__i];
2506 template <class _Tp>
2507 template <class _Expr>
2511 __is_val_expr<_Expr>::value,
2514 indirect_array<_Tp>::operator<<=(const _Expr& __v) const
2516 size_t __n = __1d_.size();
2517 for (size_t __i = 0; __i < __n; ++__i)
2518 __vp_[__1d_[__i]] <<= __v[__i];
2521 template <class _Tp>
2522 template <class _Expr>
2526 __is_val_expr<_Expr>::value,
2529 indirect_array<_Tp>::operator>>=(const _Expr& __v) const
2531 size_t __n = __1d_.size();
2532 for (size_t __i = 0; __i < __n; ++__i)
2533 __vp_[__1d_[__i]] >>= __v[__i];
2536 template <class _Tp>
2538 const indirect_array<_Tp>&
2539 indirect_array<_Tp>::operator=(const indirect_array& __ia) const
2541 typedef const size_t* _Ip;
2542 const value_type* __s = __ia.__vp_;
2543 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ia.__1d_.__begin_;
2544 __i != __e; ++__i, ++__j)
2545 __vp_[*__i] = __s[*__j];
2549 template <class _Tp>
2552 indirect_array<_Tp>::operator=(const value_type& __x) const
2554 typedef const size_t* _Ip;
2555 for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
2559 template <class _ValExpr>
2560 class __indirect_expr
2562 typedef typename remove_reference<_ValExpr>::type _RmExpr;
2564 typedef typename _RmExpr::value_type value_type;
2565 typedef value_type result_type;
2569 valarray<size_t> __1d_;
2571 _LIBCPP_INLINE_VISIBILITY
2572 __indirect_expr(const valarray<size_t>& __ia, const _RmExpr& __e)
2577 #ifndef _LIBCPP_CXX03_LANG
2579 _LIBCPP_INLINE_VISIBILITY
2580 __indirect_expr(valarray<size_t>&& __ia, const _RmExpr& __e)
2585 #endif // _LIBCPP_CXX03_LANG
2588 _LIBCPP_INLINE_VISIBILITY
2589 result_type operator[](size_t __i) const
2590 {return __expr_[__1d_[__i]];}
2592 _LIBCPP_INLINE_VISIBILITY
2593 size_t size() const {return __1d_.size();}
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
2617 {return __val_expr<__slice_expr<_ValExpr> >(__expr_, __s);}
2619 _LIBCPP_INLINE_VISIBILITY
2620 __val_expr<__indirect_expr<_ValExpr> > operator[](const gslice& __gs) const
2621 {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __gs.__1d_);}
2623 _LIBCPP_INLINE_VISIBILITY
2624 __val_expr<__mask_expr<_ValExpr> > operator[](const valarray<bool>& __vb) const
2625 {return __val_expr<__mask_expr<_ValExpr> >(__expr_, __vb);}
2627 _LIBCPP_INLINE_VISIBILITY
2628 __val_expr<__indirect_expr<_ValExpr> > operator[](const valarray<size_t>& __vs) const
2629 {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __vs);}
2631 _LIBCPP_INLINE_VISIBILITY
2632 __val_expr<_UnaryOp<__unary_plus<value_type>, _ValExpr> >
2635 typedef _UnaryOp<__unary_plus<value_type>, _ValExpr> _NewExpr;
2636 return __val_expr<_NewExpr>(_NewExpr(__unary_plus<value_type>(), __expr_));
2639 _LIBCPP_INLINE_VISIBILITY
2640 __val_expr<_UnaryOp<negate<value_type>, _ValExpr> >
2643 typedef _UnaryOp<negate<value_type>, _ValExpr> _NewExpr;
2644 return __val_expr<_NewExpr>(_NewExpr(negate<value_type>(), __expr_));
2647 _LIBCPP_INLINE_VISIBILITY
2648 __val_expr<_UnaryOp<__bit_not<value_type>, _ValExpr> >
2651 typedef _UnaryOp<__bit_not<value_type>, _ValExpr> _NewExpr;
2652 return __val_expr<_NewExpr>(_NewExpr(__bit_not<value_type>(), __expr_));
2655 _LIBCPP_INLINE_VISIBILITY
2656 __val_expr<_UnaryOp<logical_not<value_type>, _ValExpr> >
2659 typedef _UnaryOp<logical_not<value_type>, _ValExpr> _NewExpr;
2660 return __val_expr<_NewExpr>(_NewExpr(logical_not<value_type>(), __expr_));
2663 operator valarray<result_type>() const;
2665 _LIBCPP_INLINE_VISIBILITY
2666 size_t size() const {return __expr_.size();}
2668 _LIBCPP_INLINE_VISIBILITY
2669 result_type sum() const
2671 size_t __n = __expr_.size();
2672 result_type __r = __n ? __expr_[0] : result_type();
2673 for (size_t __i = 1; __i < __n; ++__i)
2674 __r += __expr_[__i];
2678 _LIBCPP_INLINE_VISIBILITY
2679 result_type min() const
2681 size_t __n = size();
2682 result_type __r = __n ? (*this)[0] : result_type();
2683 for (size_t __i = 1; __i < __n; ++__i)
2685 result_type __x = __expr_[__i];
2692 _LIBCPP_INLINE_VISIBILITY
2693 result_type max() const
2695 size_t __n = size();
2696 result_type __r = __n ? (*this)[0] : result_type();
2697 for (size_t __i = 1; __i < __n; ++__i)
2699 result_type __x = __expr_[__i];
2706 _LIBCPP_INLINE_VISIBILITY
2707 __val_expr<__shift_expr<_ValExpr> > shift (int __i) const
2708 {return __val_expr<__shift_expr<_ValExpr> >(__shift_expr<_ValExpr>(__i, __expr_));}
2710 _LIBCPP_INLINE_VISIBILITY
2711 __val_expr<__cshift_expr<_ValExpr> > cshift(int __i) const
2712 {return __val_expr<__cshift_expr<_ValExpr> >(__cshift_expr<_ValExpr>(__i, __expr_));}
2714 _LIBCPP_INLINE_VISIBILITY
2715 __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(value_type)>, _ValExpr> >
2716 apply(value_type __f(value_type)) const
2718 typedef __apply_expr<value_type, value_type(*)(value_type)> _Op;
2719 typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
2720 return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
2723 _LIBCPP_INLINE_VISIBILITY
2724 __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(const value_type&)>, _ValExpr> >
2725 apply(value_type __f(const value_type&)) const
2727 typedef __apply_expr<value_type, value_type(*)(const value_type&)> _Op;
2728 typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
2729 return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
2733 template<class _ValExpr>
2734 __val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const
2736 valarray<result_type> __r;
2737 size_t __n = __expr_.size();
2742 static_cast<result_type*>(
2743 _VSTD::__libcpp_allocate(__n * sizeof(result_type), _LIBCPP_ALIGNOF(result_type)));
2744 for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i)
2745 ::new (__r.__end_) result_type(__expr_[__i]);
2752 template <class _Tp>
2754 valarray<_Tp>::valarray(size_t __n)
2760 __begin_ = __end_ = static_cast<value_type*>(
2761 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
2762 #ifndef _LIBCPP_NO_EXCEPTIONS
2765 #endif // _LIBCPP_NO_EXCEPTIONS
2766 for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
2767 ::new (__end_) value_type();
2768 #ifndef _LIBCPP_NO_EXCEPTIONS
2775 #endif // _LIBCPP_NO_EXCEPTIONS
2779 template <class _Tp>
2781 valarray<_Tp>::valarray(const value_type& __x, size_t __n)
2788 template <class _Tp>
2789 valarray<_Tp>::valarray(const value_type* __p, size_t __n)
2795 __begin_ = __end_ = static_cast<value_type*>(
2796 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
2797 #ifndef _LIBCPP_NO_EXCEPTIONS
2800 #endif // _LIBCPP_NO_EXCEPTIONS
2801 for (size_t __n_left = __n; __n_left; ++__end_, ++__p, --__n_left)
2802 ::new (__end_) value_type(*__p);
2803 #ifndef _LIBCPP_NO_EXCEPTIONS
2810 #endif // _LIBCPP_NO_EXCEPTIONS
2814 template <class _Tp>
2815 valarray<_Tp>::valarray(const valarray& __v)
2821 __begin_ = __end_ = static_cast<value_type*>(
2822 _VSTD::__libcpp_allocate(__v.size() * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
2823 #ifndef _LIBCPP_NO_EXCEPTIONS
2826 #endif // _LIBCPP_NO_EXCEPTIONS
2827 for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p)
2828 ::new (__end_) value_type(*__p);
2829 #ifndef _LIBCPP_NO_EXCEPTIONS
2833 __clear(__v.size());
2836 #endif // _LIBCPP_NO_EXCEPTIONS
2840 #ifndef _LIBCPP_CXX03_LANG
2842 template <class _Tp>
2844 valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT
2845 : __begin_(__v.__begin_),
2848 __v.__begin_ = __v.__end_ = nullptr;
2851 template <class _Tp>
2852 valarray<_Tp>::valarray(initializer_list<value_type> __il)
2856 const size_t __n = __il.size();
2859 __begin_ = __end_ = static_cast<value_type*>(
2860 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
2861 #ifndef _LIBCPP_NO_EXCEPTIONS
2864 #endif // _LIBCPP_NO_EXCEPTIONS
2865 size_t __n_left = __n;
2866 for (const value_type* __p = __il.begin(); __n_left; ++__end_, ++__p, --__n_left)
2867 ::new (__end_) value_type(*__p);
2868 #ifndef _LIBCPP_NO_EXCEPTIONS
2875 #endif // _LIBCPP_NO_EXCEPTIONS
2879 #endif // _LIBCPP_CXX03_LANG
2881 template <class _Tp>
2882 valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
2886 const size_t __n = __sa.__size_;
2889 __begin_ = __end_ = static_cast<value_type*>(
2890 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
2891 #ifndef _LIBCPP_NO_EXCEPTIONS
2894 #endif // _LIBCPP_NO_EXCEPTIONS
2895 size_t __n_left = __n;
2896 for (const value_type* __p = __sa.__vp_; __n_left; ++__end_, __p += __sa.__stride_, --__n_left)
2897 ::new (__end_) value_type(*__p);
2898 #ifndef _LIBCPP_NO_EXCEPTIONS
2905 #endif // _LIBCPP_NO_EXCEPTIONS
2909 template <class _Tp>
2910 valarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
2914 const size_t __n = __ga.__1d_.size();
2917 __begin_ = __end_ = static_cast<value_type*>(
2918 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
2919 #ifndef _LIBCPP_NO_EXCEPTIONS
2922 #endif // _LIBCPP_NO_EXCEPTIONS
2923 typedef const size_t* _Ip;
2924 const value_type* __s = __ga.__vp_;
2925 for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
2926 __i != __e; ++__i, ++__end_)
2927 ::new (__end_) value_type(__s[*__i]);
2928 #ifndef _LIBCPP_NO_EXCEPTIONS
2935 #endif // _LIBCPP_NO_EXCEPTIONS
2939 template <class _Tp>
2940 valarray<_Tp>::valarray(const mask_array<value_type>& __ma)
2944 const size_t __n = __ma.__1d_.size();
2947 __begin_ = __end_ = static_cast<value_type*>(
2948 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
2949 #ifndef _LIBCPP_NO_EXCEPTIONS
2952 #endif // _LIBCPP_NO_EXCEPTIONS
2953 typedef const size_t* _Ip;
2954 const value_type* __s = __ma.__vp_;
2955 for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
2956 __i != __e; ++__i, ++__end_)
2957 ::new (__end_) value_type(__s[*__i]);
2958 #ifndef _LIBCPP_NO_EXCEPTIONS
2965 #endif // _LIBCPP_NO_EXCEPTIONS
2969 template <class _Tp>
2970 valarray<_Tp>::valarray(const indirect_array<value_type>& __ia)
2974 const size_t __n = __ia.__1d_.size();
2977 __begin_ = __end_ = static_cast<value_type*>(
2978 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
2979 #ifndef _LIBCPP_NO_EXCEPTIONS
2982 #endif // _LIBCPP_NO_EXCEPTIONS
2983 typedef const size_t* _Ip;
2984 const value_type* __s = __ia.__vp_;
2985 for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
2986 __i != __e; ++__i, ++__end_)
2987 ::new (__end_) value_type(__s[*__i]);
2988 #ifndef _LIBCPP_NO_EXCEPTIONS
2995 #endif // _LIBCPP_NO_EXCEPTIONS
2999 template <class _Tp>
3001 valarray<_Tp>::~valarray()
3006 template <class _Tp>
3008 valarray<_Tp>::__assign_range(const value_type* __f, const value_type* __l)
3010 size_t __n = __l - __f;
3014 __begin_ = static_cast<value_type*>(
3015 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3016 __end_ = __begin_ + __n;
3017 _VSTD::uninitialized_copy(__f, __l, __begin_);
3019 _VSTD::copy(__f, __l, __begin_);
3024 template <class _Tp>
3026 valarray<_Tp>::operator=(const valarray& __v)
3029 return __assign_range(__v.__begin_, __v.__end_);
3033 #ifndef _LIBCPP_CXX03_LANG
3035 template <class _Tp>
3038 valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT
3041 __begin_ = __v.__begin_;
3042 __end_ = __v.__end_;
3043 __v.__begin_ = nullptr;
3044 __v.__end_ = nullptr;
3048 template <class _Tp>
3051 valarray<_Tp>::operator=(initializer_list<value_type> __il)
3053 return __assign_range(__il.begin(), __il.end());
3056 #endif // _LIBCPP_CXX03_LANG
3058 template <class _Tp>
3061 valarray<_Tp>::operator=(const value_type& __x)
3063 _VSTD::fill(__begin_, __end_, __x);
3067 template <class _Tp>
3070 valarray<_Tp>::operator=(const slice_array<value_type>& __sa)
3072 value_type* __t = __begin_;
3073 const value_type* __s = __sa.__vp_;
3074 for (size_t __n = __sa.__size_; __n; --__n, __s += __sa.__stride_, ++__t)
3079 template <class _Tp>
3082 valarray<_Tp>::operator=(const gslice_array<value_type>& __ga)
3084 typedef const size_t* _Ip;
3085 value_type* __t = __begin_;
3086 const value_type* __s = __ga.__vp_;
3087 for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
3088 __i != __e; ++__i, ++__t)
3093 template <class _Tp>
3096 valarray<_Tp>::operator=(const mask_array<value_type>& __ma)
3098 typedef const size_t* _Ip;
3099 value_type* __t = __begin_;
3100 const value_type* __s = __ma.__vp_;
3101 for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
3102 __i != __e; ++__i, ++__t)
3107 template <class _Tp>
3110 valarray<_Tp>::operator=(const indirect_array<value_type>& __ia)
3112 typedef const size_t* _Ip;
3113 value_type* __t = __begin_;
3114 const value_type* __s = __ia.__vp_;
3115 for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
3116 __i != __e; ++__i, ++__t)
3121 template <class _Tp>
3122 template <class _ValExpr>
3125 valarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v)
3127 size_t __n = __v.size();
3130 value_type* __t = __begin_;
3131 for (size_t __i = 0; __i != __n; ++__t, ++__i)
3132 *__t = result_type(__v[__i]);
3136 template <class _Tp>
3138 __val_expr<__slice_expr<const valarray<_Tp>&> >
3139 valarray<_Tp>::operator[](slice __s) const
3141 return __val_expr<__slice_expr<const valarray&> >(__slice_expr<const valarray&>(__s, *this));
3144 template <class _Tp>
3147 valarray<_Tp>::operator[](slice __s)
3149 return slice_array<value_type>(__s, *this);
3152 template <class _Tp>
3154 __val_expr<__indirect_expr<const valarray<_Tp>&> >
3155 valarray<_Tp>::operator[](const gslice& __gs) const
3157 return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__gs.__1d_, *this));
3160 template <class _Tp>
3163 valarray<_Tp>::operator[](const gslice& __gs)
3165 return gslice_array<value_type>(__gs, *this);
3168 #ifndef _LIBCPP_CXX03_LANG
3170 template <class _Tp>
3172 __val_expr<__indirect_expr<const valarray<_Tp>&> >
3173 valarray<_Tp>::operator[](gslice&& __gs) const
3175 return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__gs.__1d_), *this));
3178 template <class _Tp>
3181 valarray<_Tp>::operator[](gslice&& __gs)
3183 return gslice_array<value_type>(move(__gs), *this);
3186 #endif // _LIBCPP_CXX03_LANG
3188 template <class _Tp>
3190 __val_expr<__mask_expr<const valarray<_Tp>&> >
3191 valarray<_Tp>::operator[](const valarray<bool>& __vb) const
3193 return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(__vb, *this));
3196 template <class _Tp>
3199 valarray<_Tp>::operator[](const valarray<bool>& __vb)
3201 return mask_array<value_type>(__vb, *this);
3204 #ifndef _LIBCPP_CXX03_LANG
3206 template <class _Tp>
3208 __val_expr<__mask_expr<const valarray<_Tp>&> >
3209 valarray<_Tp>::operator[](valarray<bool>&& __vb) const
3211 return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(move(__vb), *this));
3214 template <class _Tp>
3217 valarray<_Tp>::operator[](valarray<bool>&& __vb)
3219 return mask_array<value_type>(move(__vb), *this);
3222 #endif // _LIBCPP_CXX03_LANG
3224 template <class _Tp>
3226 __val_expr<__indirect_expr<const valarray<_Tp>&> >
3227 valarray<_Tp>::operator[](const valarray<size_t>& __vs) const
3229 return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__vs, *this));
3232 template <class _Tp>
3235 valarray<_Tp>::operator[](const valarray<size_t>& __vs)
3237 return indirect_array<value_type>(__vs, *this);
3240 #ifndef _LIBCPP_CXX03_LANG
3242 template <class _Tp>
3244 __val_expr<__indirect_expr<const valarray<_Tp>&> >
3245 valarray<_Tp>::operator[](valarray<size_t>&& __vs) const
3247 return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__vs), *this));
3250 template <class _Tp>
3253 valarray<_Tp>::operator[](valarray<size_t>&& __vs)
3255 return indirect_array<value_type>(move(__vs), *this);
3258 #endif // _LIBCPP_CXX03_LANG
3260 template <class _Tp>
3262 valarray<_Tp>::operator+() const
3264 valarray<value_type> __r;
3265 size_t __n = size();
3270 static_cast<value_type*>(
3271 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3272 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3273 ::new (__r.__end_) value_type(+*__p);
3278 template <class _Tp>
3280 valarray<_Tp>::operator-() const
3282 valarray<value_type> __r;
3283 size_t __n = size();
3288 static_cast<value_type*>(
3289 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3290 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3291 ::new (__r.__end_) value_type(-*__p);
3296 template <class _Tp>
3298 valarray<_Tp>::operator~() const
3300 valarray<value_type> __r;
3301 size_t __n = size();
3306 static_cast<value_type*>(
3307 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3308 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3309 ::new (__r.__end_) value_type(~*__p);
3314 template <class _Tp>
3316 valarray<_Tp>::operator!() const
3319 size_t __n = size();
3324 static_cast<bool*>(_VSTD::__libcpp_allocate(__n * sizeof(bool), _LIBCPP_ALIGNOF(bool)));
3325 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3326 ::new (__r.__end_) bool(!*__p);
3331 template <class _Tp>
3334 valarray<_Tp>::operator*=(const value_type& __x)
3336 for (value_type* __p = __begin_; __p != __end_; ++__p)
3341 template <class _Tp>
3344 valarray<_Tp>::operator/=(const value_type& __x)
3346 for (value_type* __p = __begin_; __p != __end_; ++__p)
3351 template <class _Tp>
3354 valarray<_Tp>::operator%=(const value_type& __x)
3356 for (value_type* __p = __begin_; __p != __end_; ++__p)
3361 template <class _Tp>
3364 valarray<_Tp>::operator+=(const value_type& __x)
3366 for (value_type* __p = __begin_; __p != __end_; ++__p)
3371 template <class _Tp>
3374 valarray<_Tp>::operator-=(const value_type& __x)
3376 for (value_type* __p = __begin_; __p != __end_; ++__p)
3381 template <class _Tp>
3384 valarray<_Tp>::operator^=(const value_type& __x)
3386 for (value_type* __p = __begin_; __p != __end_; ++__p)
3391 template <class _Tp>
3394 valarray<_Tp>::operator&=(const value_type& __x)
3396 for (value_type* __p = __begin_; __p != __end_; ++__p)
3401 template <class _Tp>
3404 valarray<_Tp>::operator|=(const value_type& __x)
3406 for (value_type* __p = __begin_; __p != __end_; ++__p)
3411 template <class _Tp>
3414 valarray<_Tp>::operator<<=(const value_type& __x)
3416 for (value_type* __p = __begin_; __p != __end_; ++__p)
3421 template <class _Tp>
3424 valarray<_Tp>::operator>>=(const value_type& __x)
3426 for (value_type* __p = __begin_; __p != __end_; ++__p)
3431 template <class _Tp>
3432 template <class _Expr>
3436 __is_val_expr<_Expr>::value,
3439 valarray<_Tp>::operator*=(const _Expr& __v)
3442 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3447 template <class _Tp>
3448 template <class _Expr>
3452 __is_val_expr<_Expr>::value,
3455 valarray<_Tp>::operator/=(const _Expr& __v)
3458 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3463 template <class _Tp>
3464 template <class _Expr>
3468 __is_val_expr<_Expr>::value,
3471 valarray<_Tp>::operator%=(const _Expr& __v)
3474 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3479 template <class _Tp>
3480 template <class _Expr>
3484 __is_val_expr<_Expr>::value,
3487 valarray<_Tp>::operator+=(const _Expr& __v)
3490 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3495 template <class _Tp>
3496 template <class _Expr>
3500 __is_val_expr<_Expr>::value,
3503 valarray<_Tp>::operator-=(const _Expr& __v)
3506 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3511 template <class _Tp>
3512 template <class _Expr>
3516 __is_val_expr<_Expr>::value,
3519 valarray<_Tp>::operator^=(const _Expr& __v)
3522 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3527 template <class _Tp>
3528 template <class _Expr>
3532 __is_val_expr<_Expr>::value,
3535 valarray<_Tp>::operator|=(const _Expr& __v)
3538 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3543 template <class _Tp>
3544 template <class _Expr>
3548 __is_val_expr<_Expr>::value,
3551 valarray<_Tp>::operator&=(const _Expr& __v)
3554 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3559 template <class _Tp>
3560 template <class _Expr>
3564 __is_val_expr<_Expr>::value,
3567 valarray<_Tp>::operator<<=(const _Expr& __v)
3570 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3575 template <class _Tp>
3576 template <class _Expr>
3580 __is_val_expr<_Expr>::value,
3583 valarray<_Tp>::operator>>=(const _Expr& __v)
3586 for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3591 template <class _Tp>
3594 valarray<_Tp>::swap(valarray& __v) _NOEXCEPT
3596 _VSTD::swap(__begin_, __v.__begin_);
3597 _VSTD::swap(__end_, __v.__end_);
3600 template <class _Tp>
3603 valarray<_Tp>::sum() const
3605 if (__begin_ == __end_)
3606 return value_type();
3607 const value_type* __p = __begin_;
3609 for (++__p; __p != __end_; ++__p)
3614 template <class _Tp>
3617 valarray<_Tp>::min() const
3619 if (__begin_ == __end_)
3620 return value_type();
3621 return *_VSTD::min_element(__begin_, __end_);
3624 template <class _Tp>
3627 valarray<_Tp>::max() const
3629 if (__begin_ == __end_)
3630 return value_type();
3631 return *_VSTD::max_element(__begin_, __end_);
3634 template <class _Tp>
3636 valarray<_Tp>::shift(int __i) const
3638 valarray<value_type> __r;
3639 size_t __n = size();
3644 static_cast<value_type*>(
3645 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3646 const value_type* __sb;
3651 __i = _VSTD::min(__i, static_cast<int>(__n));
3652 __sb = __begin_ + __i;
3653 __tb = __r.__begin_;
3654 __te = __r.__begin_ + (__n - __i);
3658 __i = _VSTD::min(-__i, static_cast<int>(__n));
3660 __tb = __r.__begin_ + __i;
3661 __te = __r.__begin_ + __n;
3663 for (; __r.__end_ != __tb; ++__r.__end_)
3664 ::new (__r.__end_) value_type();
3665 for (; __r.__end_ != __te; ++__r.__end_, ++__sb)
3666 ::new (__r.__end_) value_type(*__sb);
3667 for (__te = __r.__begin_ + __n; __r.__end_ != __te; ++__r.__end_)
3668 ::new (__r.__end_) value_type();
3673 template <class _Tp>
3675 valarray<_Tp>::cshift(int __i) const
3677 valarray<value_type> __r;
3678 size_t __n = size();
3683 static_cast<value_type*>(
3684 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3685 __i %= static_cast<int>(__n);
3686 const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i;
3687 for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s)
3688 ::new (__r.__end_) value_type(*__s);
3689 for (const value_type* __s = __begin_; __s != __m; ++__r.__end_, ++__s)
3690 ::new (__r.__end_) value_type(*__s);
3695 template <class _Tp>
3697 valarray<_Tp>::apply(value_type __f(value_type)) const
3699 valarray<value_type> __r;
3700 size_t __n = size();
3705 static_cast<value_type*>(
3706 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3707 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3708 ::new (__r.__end_) value_type(__f(*__p));
3713 template <class _Tp>
3715 valarray<_Tp>::apply(value_type __f(const value_type&)) const
3717 valarray<value_type> __r;
3718 size_t __n = size();
3723 static_cast<value_type*>(
3724 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3725 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3726 ::new (__r.__end_) value_type(__f(*__p));
3731 template <class _Tp>
3733 void valarray<_Tp>::__clear(size_t __capacity)
3735 if (__begin_ != nullptr)
3737 while (__end_ != __begin_)
3738 (--__end_)->~value_type();
3739 _VSTD::__libcpp_deallocate(__begin_, __capacity * sizeof(value_type), _LIBCPP_ALIGNOF(value_type));
3740 __begin_ = __end_ = nullptr;
3744 template <class _Tp>
3746 valarray<_Tp>::resize(size_t __n, value_type __x)
3751 __begin_ = __end_ = static_cast<value_type*>(
3752 _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
3753 #ifndef _LIBCPP_NO_EXCEPTIONS
3756 #endif // _LIBCPP_NO_EXCEPTIONS
3757 for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
3758 ::new (__end_) value_type(__x);
3759 #ifndef _LIBCPP_NO_EXCEPTIONS
3766 #endif // _LIBCPP_NO_EXCEPTIONS
3771 inline _LIBCPP_INLINE_VISIBILITY
3773 swap(valarray<_Tp>& __x, valarray<_Tp>& __y) _NOEXCEPT
3778 template<class _Expr1, class _Expr2>
3779 inline _LIBCPP_INLINE_VISIBILITY
3782 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3783 __val_expr<_BinaryOp<multiplies<typename _Expr1::value_type>, _Expr1, _Expr2> >
3785 operator*(const _Expr1& __x, const _Expr2& __y)
3787 typedef typename _Expr1::value_type value_type;
3788 typedef _BinaryOp<multiplies<value_type>, _Expr1, _Expr2> _Op;
3789 return __val_expr<_Op>(_Op(multiplies<value_type>(), __x, __y));
3792 template<class _Expr>
3793 inline _LIBCPP_INLINE_VISIBILITY
3796 __is_val_expr<_Expr>::value,
3797 __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
3798 _Expr, __scalar_expr<typename _Expr::value_type> > >
3800 operator*(const _Expr& __x, const typename _Expr::value_type& __y)
3802 typedef typename _Expr::value_type value_type;
3803 typedef _BinaryOp<multiplies<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3804 return __val_expr<_Op>(_Op(multiplies<value_type>(),
3805 __x, __scalar_expr<value_type>(__y, __x.size())));
3808 template<class _Expr>
3809 inline _LIBCPP_INLINE_VISIBILITY
3812 __is_val_expr<_Expr>::value,
3813 __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
3814 __scalar_expr<typename _Expr::value_type>, _Expr> >
3816 operator*(const typename _Expr::value_type& __x, const _Expr& __y)
3818 typedef typename _Expr::value_type value_type;
3819 typedef _BinaryOp<multiplies<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3820 return __val_expr<_Op>(_Op(multiplies<value_type>(),
3821 __scalar_expr<value_type>(__x, __y.size()), __y));
3824 template<class _Expr1, class _Expr2>
3825 inline _LIBCPP_INLINE_VISIBILITY
3828 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3829 __val_expr<_BinaryOp<divides<typename _Expr1::value_type>, _Expr1, _Expr2> >
3831 operator/(const _Expr1& __x, const _Expr2& __y)
3833 typedef typename _Expr1::value_type value_type;
3834 typedef _BinaryOp<divides<value_type>, _Expr1, _Expr2> _Op;
3835 return __val_expr<_Op>(_Op(divides<value_type>(), __x, __y));
3838 template<class _Expr>
3839 inline _LIBCPP_INLINE_VISIBILITY
3842 __is_val_expr<_Expr>::value,
3843 __val_expr<_BinaryOp<divides<typename _Expr::value_type>,
3844 _Expr, __scalar_expr<typename _Expr::value_type> > >
3846 operator/(const _Expr& __x, const typename _Expr::value_type& __y)
3848 typedef typename _Expr::value_type value_type;
3849 typedef _BinaryOp<divides<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3850 return __val_expr<_Op>(_Op(divides<value_type>(),
3851 __x, __scalar_expr<value_type>(__y, __x.size())));
3854 template<class _Expr>
3855 inline _LIBCPP_INLINE_VISIBILITY
3858 __is_val_expr<_Expr>::value,
3859 __val_expr<_BinaryOp<divides<typename _Expr::value_type>,
3860 __scalar_expr<typename _Expr::value_type>, _Expr> >
3862 operator/(const typename _Expr::value_type& __x, const _Expr& __y)
3864 typedef typename _Expr::value_type value_type;
3865 typedef _BinaryOp<divides<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3866 return __val_expr<_Op>(_Op(divides<value_type>(),
3867 __scalar_expr<value_type>(__x, __y.size()), __y));
3870 template<class _Expr1, class _Expr2>
3871 inline _LIBCPP_INLINE_VISIBILITY
3874 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3875 __val_expr<_BinaryOp<modulus<typename _Expr1::value_type>, _Expr1, _Expr2> >
3877 operator%(const _Expr1& __x, const _Expr2& __y)
3879 typedef typename _Expr1::value_type value_type;
3880 typedef _BinaryOp<modulus<value_type>, _Expr1, _Expr2> _Op;
3881 return __val_expr<_Op>(_Op(modulus<value_type>(), __x, __y));
3884 template<class _Expr>
3885 inline _LIBCPP_INLINE_VISIBILITY
3888 __is_val_expr<_Expr>::value,
3889 __val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
3890 _Expr, __scalar_expr<typename _Expr::value_type> > >
3892 operator%(const _Expr& __x, const typename _Expr::value_type& __y)
3894 typedef typename _Expr::value_type value_type;
3895 typedef _BinaryOp<modulus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3896 return __val_expr<_Op>(_Op(modulus<value_type>(),
3897 __x, __scalar_expr<value_type>(__y, __x.size())));
3900 template<class _Expr>
3901 inline _LIBCPP_INLINE_VISIBILITY
3904 __is_val_expr<_Expr>::value,
3905 __val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
3906 __scalar_expr<typename _Expr::value_type>, _Expr> >
3908 operator%(const typename _Expr::value_type& __x, const _Expr& __y)
3910 typedef typename _Expr::value_type value_type;
3911 typedef _BinaryOp<modulus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3912 return __val_expr<_Op>(_Op(modulus<value_type>(),
3913 __scalar_expr<value_type>(__x, __y.size()), __y));
3916 template<class _Expr1, class _Expr2>
3917 inline _LIBCPP_INLINE_VISIBILITY
3920 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3921 __val_expr<_BinaryOp<plus<typename _Expr1::value_type>, _Expr1, _Expr2> >
3923 operator+(const _Expr1& __x, const _Expr2& __y)
3925 typedef typename _Expr1::value_type value_type;
3926 typedef _BinaryOp<plus<value_type>, _Expr1, _Expr2> _Op;
3927 return __val_expr<_Op>(_Op(plus<value_type>(), __x, __y));
3930 template<class _Expr>
3931 inline _LIBCPP_INLINE_VISIBILITY
3934 __is_val_expr<_Expr>::value,
3935 __val_expr<_BinaryOp<plus<typename _Expr::value_type>,
3936 _Expr, __scalar_expr<typename _Expr::value_type> > >
3938 operator+(const _Expr& __x, const typename _Expr::value_type& __y)
3940 typedef typename _Expr::value_type value_type;
3941 typedef _BinaryOp<plus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3942 return __val_expr<_Op>(_Op(plus<value_type>(),
3943 __x, __scalar_expr<value_type>(__y, __x.size())));
3946 template<class _Expr>
3947 inline _LIBCPP_INLINE_VISIBILITY
3950 __is_val_expr<_Expr>::value,
3951 __val_expr<_BinaryOp<plus<typename _Expr::value_type>,
3952 __scalar_expr<typename _Expr::value_type>, _Expr> >
3954 operator+(const typename _Expr::value_type& __x, const _Expr& __y)
3956 typedef typename _Expr::value_type value_type;
3957 typedef _BinaryOp<plus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3958 return __val_expr<_Op>(_Op(plus<value_type>(),
3959 __scalar_expr<value_type>(__x, __y.size()), __y));
3962 template<class _Expr1, class _Expr2>
3963 inline _LIBCPP_INLINE_VISIBILITY
3966 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3967 __val_expr<_BinaryOp<minus<typename _Expr1::value_type>, _Expr1, _Expr2> >
3969 operator-(const _Expr1& __x, const _Expr2& __y)
3971 typedef typename _Expr1::value_type value_type;
3972 typedef _BinaryOp<minus<value_type>, _Expr1, _Expr2> _Op;
3973 return __val_expr<_Op>(_Op(minus<value_type>(), __x, __y));
3976 template<class _Expr>
3977 inline _LIBCPP_INLINE_VISIBILITY
3980 __is_val_expr<_Expr>::value,
3981 __val_expr<_BinaryOp<minus<typename _Expr::value_type>,
3982 _Expr, __scalar_expr<typename _Expr::value_type> > >
3984 operator-(const _Expr& __x, const typename _Expr::value_type& __y)
3986 typedef typename _Expr::value_type value_type;
3987 typedef _BinaryOp<minus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3988 return __val_expr<_Op>(_Op(minus<value_type>(),
3989 __x, __scalar_expr<value_type>(__y, __x.size())));
3992 template<class _Expr>
3993 inline _LIBCPP_INLINE_VISIBILITY
3996 __is_val_expr<_Expr>::value,
3997 __val_expr<_BinaryOp<minus<typename _Expr::value_type>,
3998 __scalar_expr<typename _Expr::value_type>, _Expr> >
4000 operator-(const typename _Expr::value_type& __x, const _Expr& __y)
4002 typedef typename _Expr::value_type value_type;
4003 typedef _BinaryOp<minus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4004 return __val_expr<_Op>(_Op(minus<value_type>(),
4005 __scalar_expr<value_type>(__x, __y.size()), __y));
4008 template<class _Expr1, class _Expr2>
4009 inline _LIBCPP_INLINE_VISIBILITY
4012 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4013 __val_expr<_BinaryOp<bit_xor<typename _Expr1::value_type>, _Expr1, _Expr2> >
4015 operator^(const _Expr1& __x, const _Expr2& __y)
4017 typedef typename _Expr1::value_type value_type;
4018 typedef _BinaryOp<bit_xor<value_type>, _Expr1, _Expr2> _Op;
4019 return __val_expr<_Op>(_Op(bit_xor<value_type>(), __x, __y));
4022 template<class _Expr>
4023 inline _LIBCPP_INLINE_VISIBILITY
4026 __is_val_expr<_Expr>::value,
4027 __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
4028 _Expr, __scalar_expr<typename _Expr::value_type> > >
4030 operator^(const _Expr& __x, const typename _Expr::value_type& __y)
4032 typedef typename _Expr::value_type value_type;
4033 typedef _BinaryOp<bit_xor<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4034 return __val_expr<_Op>(_Op(bit_xor<value_type>(),
4035 __x, __scalar_expr<value_type>(__y, __x.size())));
4038 template<class _Expr>
4039 inline _LIBCPP_INLINE_VISIBILITY
4042 __is_val_expr<_Expr>::value,
4043 __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
4044 __scalar_expr<typename _Expr::value_type>, _Expr> >
4046 operator^(const typename _Expr::value_type& __x, const _Expr& __y)
4048 typedef typename _Expr::value_type value_type;
4049 typedef _BinaryOp<bit_xor<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4050 return __val_expr<_Op>(_Op(bit_xor<value_type>(),
4051 __scalar_expr<value_type>(__x, __y.size()), __y));
4054 template<class _Expr1, class _Expr2>
4055 inline _LIBCPP_INLINE_VISIBILITY
4058 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4059 __val_expr<_BinaryOp<bit_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
4061 operator&(const _Expr1& __x, const _Expr2& __y)
4063 typedef typename _Expr1::value_type value_type;
4064 typedef _BinaryOp<bit_and<value_type>, _Expr1, _Expr2> _Op;
4065 return __val_expr<_Op>(_Op(bit_and<value_type>(), __x, __y));
4068 template<class _Expr>
4069 inline _LIBCPP_INLINE_VISIBILITY
4072 __is_val_expr<_Expr>::value,
4073 __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
4074 _Expr, __scalar_expr<typename _Expr::value_type> > >
4076 operator&(const _Expr& __x, const typename _Expr::value_type& __y)
4078 typedef typename _Expr::value_type value_type;
4079 typedef _BinaryOp<bit_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4080 return __val_expr<_Op>(_Op(bit_and<value_type>(),
4081 __x, __scalar_expr<value_type>(__y, __x.size())));
4084 template<class _Expr>
4085 inline _LIBCPP_INLINE_VISIBILITY
4088 __is_val_expr<_Expr>::value,
4089 __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
4090 __scalar_expr<typename _Expr::value_type>, _Expr> >
4092 operator&(const typename _Expr::value_type& __x, const _Expr& __y)
4094 typedef typename _Expr::value_type value_type;
4095 typedef _BinaryOp<bit_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4096 return __val_expr<_Op>(_Op(bit_and<value_type>(),
4097 __scalar_expr<value_type>(__x, __y.size()), __y));
4100 template<class _Expr1, class _Expr2>
4101 inline _LIBCPP_INLINE_VISIBILITY
4104 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4105 __val_expr<_BinaryOp<bit_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
4107 operator|(const _Expr1& __x, const _Expr2& __y)
4109 typedef typename _Expr1::value_type value_type;
4110 typedef _BinaryOp<bit_or<value_type>, _Expr1, _Expr2> _Op;
4111 return __val_expr<_Op>(_Op(bit_or<value_type>(), __x, __y));
4114 template<class _Expr>
4115 inline _LIBCPP_INLINE_VISIBILITY
4118 __is_val_expr<_Expr>::value,
4119 __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
4120 _Expr, __scalar_expr<typename _Expr::value_type> > >
4122 operator|(const _Expr& __x, const typename _Expr::value_type& __y)
4124 typedef typename _Expr::value_type value_type;
4125 typedef _BinaryOp<bit_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4126 return __val_expr<_Op>(_Op(bit_or<value_type>(),
4127 __x, __scalar_expr<value_type>(__y, __x.size())));
4130 template<class _Expr>
4131 inline _LIBCPP_INLINE_VISIBILITY
4134 __is_val_expr<_Expr>::value,
4135 __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
4136 __scalar_expr<typename _Expr::value_type>, _Expr> >
4138 operator|(const typename _Expr::value_type& __x, const _Expr& __y)
4140 typedef typename _Expr::value_type value_type;
4141 typedef _BinaryOp<bit_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4142 return __val_expr<_Op>(_Op(bit_or<value_type>(),
4143 __scalar_expr<value_type>(__x, __y.size()), __y));
4146 template<class _Expr1, class _Expr2>
4147 inline _LIBCPP_INLINE_VISIBILITY
4150 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4151 __val_expr<_BinaryOp<__bit_shift_left<typename _Expr1::value_type>, _Expr1, _Expr2> >
4153 operator<<(const _Expr1& __x, const _Expr2& __y)
4155 typedef typename _Expr1::value_type value_type;
4156 typedef _BinaryOp<__bit_shift_left<value_type>, _Expr1, _Expr2> _Op;
4157 return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), __x, __y));
4160 template<class _Expr>
4161 inline _LIBCPP_INLINE_VISIBILITY
4164 __is_val_expr<_Expr>::value,
4165 __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
4166 _Expr, __scalar_expr<typename _Expr::value_type> > >
4168 operator<<(const _Expr& __x, const typename _Expr::value_type& __y)
4170 typedef typename _Expr::value_type value_type;
4171 typedef _BinaryOp<__bit_shift_left<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4172 return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
4173 __x, __scalar_expr<value_type>(__y, __x.size())));
4176 template<class _Expr>
4177 inline _LIBCPP_INLINE_VISIBILITY
4180 __is_val_expr<_Expr>::value,
4181 __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
4182 __scalar_expr<typename _Expr::value_type>, _Expr> >
4184 operator<<(const typename _Expr::value_type& __x, const _Expr& __y)
4186 typedef typename _Expr::value_type value_type;
4187 typedef _BinaryOp<__bit_shift_left<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4188 return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
4189 __scalar_expr<value_type>(__x, __y.size()), __y));
4192 template<class _Expr1, class _Expr2>
4193 inline _LIBCPP_INLINE_VISIBILITY
4196 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4197 __val_expr<_BinaryOp<__bit_shift_right<typename _Expr1::value_type>, _Expr1, _Expr2> >
4199 operator>>(const _Expr1& __x, const _Expr2& __y)
4201 typedef typename _Expr1::value_type value_type;
4202 typedef _BinaryOp<__bit_shift_right<value_type>, _Expr1, _Expr2> _Op;
4203 return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), __x, __y));
4206 template<class _Expr>
4207 inline _LIBCPP_INLINE_VISIBILITY
4210 __is_val_expr<_Expr>::value,
4211 __val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
4212 _Expr, __scalar_expr<typename _Expr::value_type> > >
4214 operator>>(const _Expr& __x, const typename _Expr::value_type& __y)
4216 typedef typename _Expr::value_type value_type;
4217 typedef _BinaryOp<__bit_shift_right<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4218 return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
4219 __x, __scalar_expr<value_type>(__y, __x.size())));
4222 template<class _Expr>
4223 inline _LIBCPP_INLINE_VISIBILITY
4226 __is_val_expr<_Expr>::value,
4227 __val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
4228 __scalar_expr<typename _Expr::value_type>, _Expr> >
4230 operator>>(const typename _Expr::value_type& __x, const _Expr& __y)
4232 typedef typename _Expr::value_type value_type;
4233 typedef _BinaryOp<__bit_shift_right<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4234 return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
4235 __scalar_expr<value_type>(__x, __y.size()), __y));
4238 template<class _Expr1, class _Expr2>
4239 inline _LIBCPP_INLINE_VISIBILITY
4242 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4243 __val_expr<_BinaryOp<logical_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
4245 operator&&(const _Expr1& __x, const _Expr2& __y)
4247 typedef typename _Expr1::value_type value_type;
4248 typedef _BinaryOp<logical_and<value_type>, _Expr1, _Expr2> _Op;
4249 return __val_expr<_Op>(_Op(logical_and<value_type>(), __x, __y));
4252 template<class _Expr>
4253 inline _LIBCPP_INLINE_VISIBILITY
4256 __is_val_expr<_Expr>::value,
4257 __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
4258 _Expr, __scalar_expr<typename _Expr::value_type> > >
4260 operator&&(const _Expr& __x, const typename _Expr::value_type& __y)
4262 typedef typename _Expr::value_type value_type;
4263 typedef _BinaryOp<logical_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4264 return __val_expr<_Op>(_Op(logical_and<value_type>(),
4265 __x, __scalar_expr<value_type>(__y, __x.size())));
4268 template<class _Expr>
4269 inline _LIBCPP_INLINE_VISIBILITY
4272 __is_val_expr<_Expr>::value,
4273 __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
4274 __scalar_expr<typename _Expr::value_type>, _Expr> >
4276 operator&&(const typename _Expr::value_type& __x, const _Expr& __y)
4278 typedef typename _Expr::value_type value_type;
4279 typedef _BinaryOp<logical_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4280 return __val_expr<_Op>(_Op(logical_and<value_type>(),
4281 __scalar_expr<value_type>(__x, __y.size()), __y));
4284 template<class _Expr1, class _Expr2>
4285 inline _LIBCPP_INLINE_VISIBILITY
4288 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4289 __val_expr<_BinaryOp<logical_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
4291 operator||(const _Expr1& __x, const _Expr2& __y)
4293 typedef typename _Expr1::value_type value_type;
4294 typedef _BinaryOp<logical_or<value_type>, _Expr1, _Expr2> _Op;
4295 return __val_expr<_Op>(_Op(logical_or<value_type>(), __x, __y));
4298 template<class _Expr>
4299 inline _LIBCPP_INLINE_VISIBILITY
4302 __is_val_expr<_Expr>::value,
4303 __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
4304 _Expr, __scalar_expr<typename _Expr::value_type> > >
4306 operator||(const _Expr& __x, const typename _Expr::value_type& __y)
4308 typedef typename _Expr::value_type value_type;
4309 typedef _BinaryOp<logical_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4310 return __val_expr<_Op>(_Op(logical_or<value_type>(),
4311 __x, __scalar_expr<value_type>(__y, __x.size())));
4314 template<class _Expr>
4315 inline _LIBCPP_INLINE_VISIBILITY
4318 __is_val_expr<_Expr>::value,
4319 __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
4320 __scalar_expr<typename _Expr::value_type>, _Expr> >
4322 operator||(const typename _Expr::value_type& __x, const _Expr& __y)
4324 typedef typename _Expr::value_type value_type;
4325 typedef _BinaryOp<logical_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4326 return __val_expr<_Op>(_Op(logical_or<value_type>(),
4327 __scalar_expr<value_type>(__x, __y.size()), __y));
4330 template<class _Expr1, class _Expr2>
4331 inline _LIBCPP_INLINE_VISIBILITY
4334 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4335 __val_expr<_BinaryOp<equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
4337 operator==(const _Expr1& __x, const _Expr2& __y)
4339 typedef typename _Expr1::value_type value_type;
4340 typedef _BinaryOp<equal_to<value_type>, _Expr1, _Expr2> _Op;
4341 return __val_expr<_Op>(_Op(equal_to<value_type>(), __x, __y));
4344 template<class _Expr>
4345 inline _LIBCPP_INLINE_VISIBILITY
4348 __is_val_expr<_Expr>::value,
4349 __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
4350 _Expr, __scalar_expr<typename _Expr::value_type> > >
4352 operator==(const _Expr& __x, const typename _Expr::value_type& __y)
4354 typedef typename _Expr::value_type value_type;
4355 typedef _BinaryOp<equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4356 return __val_expr<_Op>(_Op(equal_to<value_type>(),
4357 __x, __scalar_expr<value_type>(__y, __x.size())));
4360 template<class _Expr>
4361 inline _LIBCPP_INLINE_VISIBILITY
4364 __is_val_expr<_Expr>::value,
4365 __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
4366 __scalar_expr<typename _Expr::value_type>, _Expr> >
4368 operator==(const typename _Expr::value_type& __x, const _Expr& __y)
4370 typedef typename _Expr::value_type value_type;
4371 typedef _BinaryOp<equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4372 return __val_expr<_Op>(_Op(equal_to<value_type>(),
4373 __scalar_expr<value_type>(__x, __y.size()), __y));
4376 template<class _Expr1, class _Expr2>
4377 inline _LIBCPP_INLINE_VISIBILITY
4380 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4381 __val_expr<_BinaryOp<not_equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
4383 operator!=(const _Expr1& __x, const _Expr2& __y)
4385 typedef typename _Expr1::value_type value_type;
4386 typedef _BinaryOp<not_equal_to<value_type>, _Expr1, _Expr2> _Op;
4387 return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __x, __y));
4390 template<class _Expr>
4391 inline _LIBCPP_INLINE_VISIBILITY
4394 __is_val_expr<_Expr>::value,
4395 __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
4396 _Expr, __scalar_expr<typename _Expr::value_type> > >
4398 operator!=(const _Expr& __x, const typename _Expr::value_type& __y)
4400 typedef typename _Expr::value_type value_type;
4401 typedef _BinaryOp<not_equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4402 return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
4403 __x, __scalar_expr<value_type>(__y, __x.size())));
4406 template<class _Expr>
4407 inline _LIBCPP_INLINE_VISIBILITY
4410 __is_val_expr<_Expr>::value,
4411 __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
4412 __scalar_expr<typename _Expr::value_type>, _Expr> >
4414 operator!=(const typename _Expr::value_type& __x, const _Expr& __y)
4416 typedef typename _Expr::value_type value_type;
4417 typedef _BinaryOp<not_equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4418 return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
4419 __scalar_expr<value_type>(__x, __y.size()), __y));
4422 template<class _Expr1, class _Expr2>
4423 inline _LIBCPP_INLINE_VISIBILITY
4426 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4427 __val_expr<_BinaryOp<less<typename _Expr1::value_type>, _Expr1, _Expr2> >
4429 operator<(const _Expr1& __x, const _Expr2& __y)
4431 typedef typename _Expr1::value_type value_type;
4432 typedef _BinaryOp<less<value_type>, _Expr1, _Expr2> _Op;
4433 return __val_expr<_Op>(_Op(less<value_type>(), __x, __y));
4436 template<class _Expr>
4437 inline _LIBCPP_INLINE_VISIBILITY
4440 __is_val_expr<_Expr>::value,
4441 __val_expr<_BinaryOp<less<typename _Expr::value_type>,
4442 _Expr, __scalar_expr<typename _Expr::value_type> > >
4444 operator<(const _Expr& __x, const typename _Expr::value_type& __y)
4446 typedef typename _Expr::value_type value_type;
4447 typedef _BinaryOp<less<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4448 return __val_expr<_Op>(_Op(less<value_type>(),
4449 __x, __scalar_expr<value_type>(__y, __x.size())));
4452 template<class _Expr>
4453 inline _LIBCPP_INLINE_VISIBILITY
4456 __is_val_expr<_Expr>::value,
4457 __val_expr<_BinaryOp<less<typename _Expr::value_type>,
4458 __scalar_expr<typename _Expr::value_type>, _Expr> >
4460 operator<(const typename _Expr::value_type& __x, const _Expr& __y)
4462 typedef typename _Expr::value_type value_type;
4463 typedef _BinaryOp<less<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4464 return __val_expr<_Op>(_Op(less<value_type>(),
4465 __scalar_expr<value_type>(__x, __y.size()), __y));
4468 template<class _Expr1, class _Expr2>
4469 inline _LIBCPP_INLINE_VISIBILITY
4472 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4473 __val_expr<_BinaryOp<greater<typename _Expr1::value_type>, _Expr1, _Expr2> >
4475 operator>(const _Expr1& __x, const _Expr2& __y)
4477 typedef typename _Expr1::value_type value_type;
4478 typedef _BinaryOp<greater<value_type>, _Expr1, _Expr2> _Op;
4479 return __val_expr<_Op>(_Op(greater<value_type>(), __x, __y));
4482 template<class _Expr>
4483 inline _LIBCPP_INLINE_VISIBILITY
4486 __is_val_expr<_Expr>::value,
4487 __val_expr<_BinaryOp<greater<typename _Expr::value_type>,
4488 _Expr, __scalar_expr<typename _Expr::value_type> > >
4490 operator>(const _Expr& __x, const typename _Expr::value_type& __y)
4492 typedef typename _Expr::value_type value_type;
4493 typedef _BinaryOp<greater<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4494 return __val_expr<_Op>(_Op(greater<value_type>(),
4495 __x, __scalar_expr<value_type>(__y, __x.size())));
4498 template<class _Expr>
4499 inline _LIBCPP_INLINE_VISIBILITY
4502 __is_val_expr<_Expr>::value,
4503 __val_expr<_BinaryOp<greater<typename _Expr::value_type>,
4504 __scalar_expr<typename _Expr::value_type>, _Expr> >
4506 operator>(const typename _Expr::value_type& __x, const _Expr& __y)
4508 typedef typename _Expr::value_type value_type;
4509 typedef _BinaryOp<greater<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4510 return __val_expr<_Op>(_Op(greater<value_type>(),
4511 __scalar_expr<value_type>(__x, __y.size()), __y));
4514 template<class _Expr1, class _Expr2>
4515 inline _LIBCPP_INLINE_VISIBILITY
4518 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4519 __val_expr<_BinaryOp<less_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
4521 operator<=(const _Expr1& __x, const _Expr2& __y)
4523 typedef typename _Expr1::value_type value_type;
4524 typedef _BinaryOp<less_equal<value_type>, _Expr1, _Expr2> _Op;
4525 return __val_expr<_Op>(_Op(less_equal<value_type>(), __x, __y));
4528 template<class _Expr>
4529 inline _LIBCPP_INLINE_VISIBILITY
4532 __is_val_expr<_Expr>::value,
4533 __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
4534 _Expr, __scalar_expr<typename _Expr::value_type> > >
4536 operator<=(const _Expr& __x, const typename _Expr::value_type& __y)
4538 typedef typename _Expr::value_type value_type;
4539 typedef _BinaryOp<less_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4540 return __val_expr<_Op>(_Op(less_equal<value_type>(),
4541 __x, __scalar_expr<value_type>(__y, __x.size())));
4544 template<class _Expr>
4545 inline _LIBCPP_INLINE_VISIBILITY
4548 __is_val_expr<_Expr>::value,
4549 __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
4550 __scalar_expr<typename _Expr::value_type>, _Expr> >
4552 operator<=(const typename _Expr::value_type& __x, const _Expr& __y)
4554 typedef typename _Expr::value_type value_type;
4555 typedef _BinaryOp<less_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4556 return __val_expr<_Op>(_Op(less_equal<value_type>(),
4557 __scalar_expr<value_type>(__x, __y.size()), __y));
4560 template<class _Expr1, class _Expr2>
4561 inline _LIBCPP_INLINE_VISIBILITY
4564 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4565 __val_expr<_BinaryOp<greater_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
4567 operator>=(const _Expr1& __x, const _Expr2& __y)
4569 typedef typename _Expr1::value_type value_type;
4570 typedef _BinaryOp<greater_equal<value_type>, _Expr1, _Expr2> _Op;
4571 return __val_expr<_Op>(_Op(greater_equal<value_type>(), __x, __y));
4574 template<class _Expr>
4575 inline _LIBCPP_INLINE_VISIBILITY
4578 __is_val_expr<_Expr>::value,
4579 __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
4580 _Expr, __scalar_expr<typename _Expr::value_type> > >
4582 operator>=(const _Expr& __x, const typename _Expr::value_type& __y)
4584 typedef typename _Expr::value_type value_type;
4585 typedef _BinaryOp<greater_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4586 return __val_expr<_Op>(_Op(greater_equal<value_type>(),
4587 __x, __scalar_expr<value_type>(__y, __x.size())));
4590 template<class _Expr>
4591 inline _LIBCPP_INLINE_VISIBILITY
4594 __is_val_expr<_Expr>::value,
4595 __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
4596 __scalar_expr<typename _Expr::value_type>, _Expr> >
4598 operator>=(const typename _Expr::value_type& __x, const _Expr& __y)
4600 typedef typename _Expr::value_type value_type;
4601 typedef _BinaryOp<greater_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4602 return __val_expr<_Op>(_Op(greater_equal<value_type>(),
4603 __scalar_expr<value_type>(__x, __y.size()), __y));
4606 template<class _Expr>
4607 inline _LIBCPP_INLINE_VISIBILITY
4610 __is_val_expr<_Expr>::value,
4611 __val_expr<_UnaryOp<__abs_expr<typename _Expr::value_type>, _Expr> >
4613 abs(const _Expr& __x)
4615 typedef typename _Expr::value_type value_type;
4616 typedef _UnaryOp<__abs_expr<value_type>, _Expr> _Op;
4617 return __val_expr<_Op>(_Op(__abs_expr<value_type>(), __x));
4620 template<class _Expr>
4621 inline _LIBCPP_INLINE_VISIBILITY
4624 __is_val_expr<_Expr>::value,
4625 __val_expr<_UnaryOp<__acos_expr<typename _Expr::value_type>, _Expr> >
4627 acos(const _Expr& __x)
4629 typedef typename _Expr::value_type value_type;
4630 typedef _UnaryOp<__acos_expr<value_type>, _Expr> _Op;
4631 return __val_expr<_Op>(_Op(__acos_expr<value_type>(), __x));
4634 template<class _Expr>
4635 inline _LIBCPP_INLINE_VISIBILITY
4638 __is_val_expr<_Expr>::value,
4639 __val_expr<_UnaryOp<__asin_expr<typename _Expr::value_type>, _Expr> >
4641 asin(const _Expr& __x)
4643 typedef typename _Expr::value_type value_type;
4644 typedef _UnaryOp<__asin_expr<value_type>, _Expr> _Op;
4645 return __val_expr<_Op>(_Op(__asin_expr<value_type>(), __x));
4648 template<class _Expr>
4649 inline _LIBCPP_INLINE_VISIBILITY
4652 __is_val_expr<_Expr>::value,
4653 __val_expr<_UnaryOp<__atan_expr<typename _Expr::value_type>, _Expr> >
4655 atan(const _Expr& __x)
4657 typedef typename _Expr::value_type value_type;
4658 typedef _UnaryOp<__atan_expr<value_type>, _Expr> _Op;
4659 return __val_expr<_Op>(_Op(__atan_expr<value_type>(), __x));
4662 template<class _Expr1, class _Expr2>
4663 inline _LIBCPP_INLINE_VISIBILITY
4666 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4667 __val_expr<_BinaryOp<__atan2_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
4669 atan2(const _Expr1& __x, const _Expr2& __y)
4671 typedef typename _Expr1::value_type value_type;
4672 typedef _BinaryOp<__atan2_expr<value_type>, _Expr1, _Expr2> _Op;
4673 return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __x, __y));
4676 template<class _Expr>
4677 inline _LIBCPP_INLINE_VISIBILITY
4680 __is_val_expr<_Expr>::value,
4681 __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
4682 _Expr, __scalar_expr<typename _Expr::value_type> > >
4684 atan2(const _Expr& __x, const typename _Expr::value_type& __y)
4686 typedef typename _Expr::value_type value_type;
4687 typedef _BinaryOp<__atan2_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4688 return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
4689 __x, __scalar_expr<value_type>(__y, __x.size())));
4692 template<class _Expr>
4693 inline _LIBCPP_INLINE_VISIBILITY
4696 __is_val_expr<_Expr>::value,
4697 __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
4698 __scalar_expr<typename _Expr::value_type>, _Expr> >
4700 atan2(const typename _Expr::value_type& __x, const _Expr& __y)
4702 typedef typename _Expr::value_type value_type;
4703 typedef _BinaryOp<__atan2_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4704 return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
4705 __scalar_expr<value_type>(__x, __y.size()), __y));
4708 template<class _Expr>
4709 inline _LIBCPP_INLINE_VISIBILITY
4712 __is_val_expr<_Expr>::value,
4713 __val_expr<_UnaryOp<__cos_expr<typename _Expr::value_type>, _Expr> >
4715 cos(const _Expr& __x)
4717 typedef typename _Expr::value_type value_type;
4718 typedef _UnaryOp<__cos_expr<value_type>, _Expr> _Op;
4719 return __val_expr<_Op>(_Op(__cos_expr<value_type>(), __x));
4722 template<class _Expr>
4723 inline _LIBCPP_INLINE_VISIBILITY
4726 __is_val_expr<_Expr>::value,
4727 __val_expr<_UnaryOp<__cosh_expr<typename _Expr::value_type>, _Expr> >
4729 cosh(const _Expr& __x)
4731 typedef typename _Expr::value_type value_type;
4732 typedef _UnaryOp<__cosh_expr<value_type>, _Expr> _Op;
4733 return __val_expr<_Op>(_Op(__cosh_expr<value_type>(), __x));
4736 template<class _Expr>
4737 inline _LIBCPP_INLINE_VISIBILITY
4740 __is_val_expr<_Expr>::value,
4741 __val_expr<_UnaryOp<__exp_expr<typename _Expr::value_type>, _Expr> >
4743 exp(const _Expr& __x)
4745 typedef typename _Expr::value_type value_type;
4746 typedef _UnaryOp<__exp_expr<value_type>, _Expr> _Op;
4747 return __val_expr<_Op>(_Op(__exp_expr<value_type>(), __x));
4750 template<class _Expr>
4751 inline _LIBCPP_INLINE_VISIBILITY
4754 __is_val_expr<_Expr>::value,
4755 __val_expr<_UnaryOp<__log_expr<typename _Expr::value_type>, _Expr> >
4757 log(const _Expr& __x)
4759 typedef typename _Expr::value_type value_type;
4760 typedef _UnaryOp<__log_expr<value_type>, _Expr> _Op;
4761 return __val_expr<_Op>(_Op(__log_expr<value_type>(), __x));
4764 template<class _Expr>
4765 inline _LIBCPP_INLINE_VISIBILITY
4768 __is_val_expr<_Expr>::value,
4769 __val_expr<_UnaryOp<__log10_expr<typename _Expr::value_type>, _Expr> >
4771 log10(const _Expr& __x)
4773 typedef typename _Expr::value_type value_type;
4774 typedef _UnaryOp<__log10_expr<value_type>, _Expr> _Op;
4775 return __val_expr<_Op>(_Op(__log10_expr<value_type>(), __x));
4778 template<class _Expr1, class _Expr2>
4779 inline _LIBCPP_INLINE_VISIBILITY
4782 __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4783 __val_expr<_BinaryOp<__pow_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
4785 pow(const _Expr1& __x, const _Expr2& __y)
4787 typedef typename _Expr1::value_type value_type;
4788 typedef _BinaryOp<__pow_expr<value_type>, _Expr1, _Expr2> _Op;
4789 return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __x, __y));
4792 template<class _Expr>
4793 inline _LIBCPP_INLINE_VISIBILITY
4796 __is_val_expr<_Expr>::value,
4797 __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
4798 _Expr, __scalar_expr<typename _Expr::value_type> > >
4800 pow(const _Expr& __x, const typename _Expr::value_type& __y)
4802 typedef typename _Expr::value_type value_type;
4803 typedef _BinaryOp<__pow_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4804 return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
4805 __x, __scalar_expr<value_type>(__y, __x.size())));
4808 template<class _Expr>
4809 inline _LIBCPP_INLINE_VISIBILITY
4812 __is_val_expr<_Expr>::value,
4813 __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
4814 __scalar_expr<typename _Expr::value_type>, _Expr> >
4816 pow(const typename _Expr::value_type& __x, const _Expr& __y)
4818 typedef typename _Expr::value_type value_type;
4819 typedef _BinaryOp<__pow_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4820 return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
4821 __scalar_expr<value_type>(__x, __y.size()), __y));
4824 template<class _Expr>
4825 inline _LIBCPP_INLINE_VISIBILITY
4828 __is_val_expr<_Expr>::value,
4829 __val_expr<_UnaryOp<__sin_expr<typename _Expr::value_type>, _Expr> >
4831 sin(const _Expr& __x)
4833 typedef typename _Expr::value_type value_type;
4834 typedef _UnaryOp<__sin_expr<value_type>, _Expr> _Op;
4835 return __val_expr<_Op>(_Op(__sin_expr<value_type>(), __x));
4838 template<class _Expr>
4839 inline _LIBCPP_INLINE_VISIBILITY
4842 __is_val_expr<_Expr>::value,
4843 __val_expr<_UnaryOp<__sinh_expr<typename _Expr::value_type>, _Expr> >
4845 sinh(const _Expr& __x)
4847 typedef typename _Expr::value_type value_type;
4848 typedef _UnaryOp<__sinh_expr<value_type>, _Expr> _Op;
4849 return __val_expr<_Op>(_Op(__sinh_expr<value_type>(), __x));
4852 template<class _Expr>
4853 inline _LIBCPP_INLINE_VISIBILITY
4856 __is_val_expr<_Expr>::value,
4857 __val_expr<_UnaryOp<__sqrt_expr<typename _Expr::value_type>, _Expr> >
4859 sqrt(const _Expr& __x)
4861 typedef typename _Expr::value_type value_type;
4862 typedef _UnaryOp<__sqrt_expr<value_type>, _Expr> _Op;
4863 return __val_expr<_Op>(_Op(__sqrt_expr<value_type>(), __x));
4866 template<class _Expr>
4867 inline _LIBCPP_INLINE_VISIBILITY
4870 __is_val_expr<_Expr>::value,
4871 __val_expr<_UnaryOp<__tan_expr<typename _Expr::value_type>, _Expr> >
4873 tan(const _Expr& __x)
4875 typedef typename _Expr::value_type value_type;
4876 typedef _UnaryOp<__tan_expr<value_type>, _Expr> _Op;
4877 return __val_expr<_Op>(_Op(__tan_expr<value_type>(), __x));
4880 template<class _Expr>
4881 inline _LIBCPP_INLINE_VISIBILITY
4884 __is_val_expr<_Expr>::value,
4885 __val_expr<_UnaryOp<__tanh_expr<typename _Expr::value_type>, _Expr> >
4887 tanh(const _Expr& __x)
4889 typedef typename _Expr::value_type value_type;
4890 typedef _UnaryOp<__tanh_expr<value_type>, _Expr> _Op;
4891 return __val_expr<_Op>(_Op(__tanh_expr<value_type>(), __x));
4894 template <class _Tp>
4895 inline _LIBCPP_INLINE_VISIBILITY
4897 begin(valarray<_Tp>& __v)
4899 return __v.__begin_;
4902 template <class _Tp>
4903 inline _LIBCPP_INLINE_VISIBILITY
4905 begin(const valarray<_Tp>& __v)
4907 return __v.__begin_;
4910 template <class _Tp>
4911 inline _LIBCPP_INLINE_VISIBILITY
4913 end(valarray<_Tp>& __v)
4918 template <class _Tp>
4919 inline _LIBCPP_INLINE_VISIBILITY
4921 end(const valarray<_Tp>& __v)
4926 _LIBCPP_END_NAMESPACE_STD
4930 #endif // _LIBCPP_VALARRAY