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);
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);
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);
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);
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>
349
#include <__undef_min_max>
351
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
352
#pragma GCC system_header
355
_LIBCPP_BEGIN_NAMESPACE_STD
357
template<class _Tp> class valarray;
359
class _LIBCPP_VISIBLE slice
365
_LIBCPP_INLINE_VISIBILITY
372
_LIBCPP_INLINE_VISIBILITY
373
slice(size_t __start, size_t __size, size_t __stride)
379
_LIBCPP_INLINE_VISIBILITY size_t start() const {return __start_;}
380
_LIBCPP_INLINE_VISIBILITY size_t size() const {return __size_;}
381
_LIBCPP_INLINE_VISIBILITY size_t stride() const {return __stride_;}
384
template <class _Tp> class slice_array;
386
template <class _Tp> class gslice_array;
387
template <class _Tp> class mask_array;
388
template <class _Tp> class indirect_array;
392
begin(valarray<_Tp>& __v);
396
begin(const valarray<_Tp>& __v);
400
end(valarray<_Tp>& __v);
404
end(const valarray<_Tp>& __v);
406
template <class _Op, class _A0>
409
typedef typename _Op::result_type result_type;
410
typedef typename _A0::value_type value_type;
415
_LIBCPP_INLINE_VISIBILITY
416
_UnaryOp(const _Op& __op, const _A0& __a0) : __op_(__op), __a0_(__a0) {}
418
_LIBCPP_INLINE_VISIBILITY
419
result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
421
_LIBCPP_INLINE_VISIBILITY
422
size_t size() const {return __a0_.size();}
425
template <class _Op, class _A0, class _A1>
428
typedef typename _Op::result_type result_type;
429
typedef typename _A0::value_type value_type;
435
_LIBCPP_INLINE_VISIBILITY
436
_BinaryOp(const _Op& __op, const _A0& __a0, const _A1& __a1)
437
: __op_(__op), __a0_(__a0), __a1_(__a1) {}
439
_LIBCPP_INLINE_VISIBILITY
440
value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
442
_LIBCPP_INLINE_VISIBILITY
443
size_t size() const {return __a0_.size();}
450
typedef _Tp value_type;
451
typedef const _Tp& result_type;
453
const value_type& __t_;
456
_LIBCPP_INLINE_VISIBILITY
457
explicit __scalar_expr(const value_type& __t, size_t __s) : __t_(__t), __s_(__s) {}
459
_LIBCPP_INLINE_VISIBILITY
460
result_type operator[](size_t) const {return __t_;}
462
_LIBCPP_INLINE_VISIBILITY
463
size_t size() const {return __s_;}
467
struct __unary_plus : unary_function<_Tp, _Tp>
469
_LIBCPP_INLINE_VISIBILITY
470
_Tp operator()(const _Tp& __x) const
475
struct __bit_not : unary_function<_Tp, _Tp>
477
_LIBCPP_INLINE_VISIBILITY
478
_Tp operator()(const _Tp& __x) const
483
struct __bit_shift_left : binary_function<_Tp, _Tp, _Tp>
485
_LIBCPP_INLINE_VISIBILITY
486
_Tp operator()(const _Tp& __x, const _Tp& __y) const
491
struct __bit_shift_right : binary_function<_Tp, _Tp, _Tp>
493
_LIBCPP_INLINE_VISIBILITY
494
_Tp operator()(const _Tp& __x, const _Tp& __y) const
498
template <class _Tp, class _Fp>
499
struct __apply_expr : unary_function<_Tp, _Tp>
504
_LIBCPP_INLINE_VISIBILITY
505
explicit __apply_expr(_Fp __f) : __f_(__f) {}
507
_LIBCPP_INLINE_VISIBILITY
508
_Tp operator()(const _Tp& __x) const
513
struct __abs_expr : unary_function<_Tp, _Tp>
515
_LIBCPP_INLINE_VISIBILITY
516
_Tp operator()(const _Tp& __x) const
521
struct __acos_expr : unary_function<_Tp, _Tp>
523
_LIBCPP_INLINE_VISIBILITY
524
_Tp operator()(const _Tp& __x) const
529
struct __asin_expr : unary_function<_Tp, _Tp>
531
_LIBCPP_INLINE_VISIBILITY
532
_Tp operator()(const _Tp& __x) const
537
struct __atan_expr : unary_function<_Tp, _Tp>
539
_LIBCPP_INLINE_VISIBILITY
540
_Tp operator()(const _Tp& __x) const
545
struct __atan2_expr : binary_function<_Tp, _Tp, _Tp>
547
_LIBCPP_INLINE_VISIBILITY
548
_Tp operator()(const _Tp& __x, const _Tp& __y) const
549
{return atan2(__x, __y);}
553
struct __cos_expr : unary_function<_Tp, _Tp>
555
_LIBCPP_INLINE_VISIBILITY
556
_Tp operator()(const _Tp& __x) const
561
struct __cosh_expr : unary_function<_Tp, _Tp>
563
_LIBCPP_INLINE_VISIBILITY
564
_Tp operator()(const _Tp& __x) const
569
struct __exp_expr : unary_function<_Tp, _Tp>
571
_LIBCPP_INLINE_VISIBILITY
572
_Tp operator()(const _Tp& __x) const
577
struct __log_expr : unary_function<_Tp, _Tp>
579
_LIBCPP_INLINE_VISIBILITY
580
_Tp operator()(const _Tp& __x) const
585
struct __log10_expr : unary_function<_Tp, _Tp>
587
_LIBCPP_INLINE_VISIBILITY
588
_Tp operator()(const _Tp& __x) const
593
struct __pow_expr : binary_function<_Tp, _Tp, _Tp>
595
_LIBCPP_INLINE_VISIBILITY
596
_Tp operator()(const _Tp& __x, const _Tp& __y) const
597
{return pow(__x, __y);}
601
struct __sin_expr : unary_function<_Tp, _Tp>
603
_LIBCPP_INLINE_VISIBILITY
604
_Tp operator()(const _Tp& __x) const
609
struct __sinh_expr : unary_function<_Tp, _Tp>
611
_LIBCPP_INLINE_VISIBILITY
612
_Tp operator()(const _Tp& __x) const
617
struct __sqrt_expr : unary_function<_Tp, _Tp>
619
_LIBCPP_INLINE_VISIBILITY
620
_Tp operator()(const _Tp& __x) const
625
struct __tan_expr : unary_function<_Tp, _Tp>
627
_LIBCPP_INLINE_VISIBILITY
628
_Tp operator()(const _Tp& __x) const
633
struct __tanh_expr : unary_function<_Tp, _Tp>
635
_LIBCPP_INLINE_VISIBILITY
636
_Tp operator()(const _Tp& __x) const
640
template <class _ValExpr>
643
typedef typename remove_reference<_ValExpr>::type _RmExpr;
645
typedef typename _RmExpr::value_type value_type;
646
typedef value_type result_type;
654
_LIBCPP_INLINE_VISIBILITY
655
__slice_expr(const slice& __sl, const _RmExpr& __e)
657
__start_(__sl.start()),
658
__size_(__sl.size()),
659
__stride_(__sl.stride())
663
_LIBCPP_INLINE_VISIBILITY
664
result_type operator[](size_t __i) const
665
{return __expr_[__start_ + __i * __stride_];}
667
_LIBCPP_INLINE_VISIBILITY
668
size_t size() const {return __size_;}
670
template <class> friend class _LIBCPP_VISIBLE valarray;
673
template <class _ValExpr>
676
template <class _ValExpr>
677
class __indirect_expr;
679
template <class _ValExpr>
682
typedef typename remove_reference<_ValExpr>::type _RmExpr;
684
typedef typename _RmExpr::value_type value_type;
685
typedef value_type result_type;
693
static const ptrdiff_t _Np = static_cast<ptrdiff_t>(
694
sizeof(ptrdiff_t) * __CHAR_BIT__ - 1);
696
_LIBCPP_INLINE_VISIBILITY
697
__shift_expr(int __n, const _RmExpr& __e)
702
ptrdiff_t __neg_n = static_cast<ptrdiff_t>(__n_ >> _Np);
703
__sn_ = __neg_n | static_cast<ptrdiff_t>(static_cast<size_t>(-__n_) >> _Np);
704
__ul_ = ((__size_ - __n_) & ~__neg_n) | ((__n_ + 1) & __neg_n);
708
_LIBCPP_INLINE_VISIBILITY
709
result_type operator[](size_t __j) const
711
ptrdiff_t __i = static_cast<ptrdiff_t>(__j);
712
ptrdiff_t __m = (__sn_ * __i - __ul_) >> _Np;
713
return (__expr_[(__i + __n_) & __m] & __m) | (value_type() & ~__m);
716
_LIBCPP_INLINE_VISIBILITY
717
size_t size() const {return __size_;}
719
template <class> friend class __val_expr;
722
template <class _ValExpr>
725
typedef typename remove_reference<_ValExpr>::type _RmExpr;
727
typedef typename _RmExpr::value_type value_type;
728
typedef value_type result_type;
737
_LIBCPP_INLINE_VISIBILITY
738
__cshift_expr(int __n, const _RmExpr& __e)
742
__n %= static_cast<int>(__size_);
745
__m_ = __size_ - __n;
747
__o2_ = __n - __size_;
752
__o1_ = __n + __size_;
758
_LIBCPP_INLINE_VISIBILITY
759
result_type operator[](size_t __i) const
762
return __expr_[__i + __o1_];
763
return __expr_[__i + __o2_];
766
_LIBCPP_INLINE_VISIBILITY
767
size_t size() const {return __size_;}
769
template <class> friend class __val_expr;
772
template<class _ValExpr>
775
template<class _ValExpr>
776
struct __is_val_expr : false_type {};
778
template<class _ValExpr>
779
struct __is_val_expr<__val_expr<_ValExpr> > : true_type {};
782
struct __is_val_expr<valarray<_Tp> > : true_type {};
785
class _LIBCPP_VISIBLE valarray
788
typedef _Tp value_type;
789
typedef _Tp result_type;
792
value_type* __begin_;
796
// construct/destroy:
797
_LIBCPP_INLINE_VISIBILITY
798
valarray() : __begin_(0), __end_(0) {}
799
explicit valarray(size_t __n);
800
valarray(const value_type& __x, size_t __n);
801
valarray(const value_type* __p, size_t __n);
802
valarray(const valarray& __v);
803
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
804
valarray(valarray&& __v);
805
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
806
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
807
valarray(initializer_list<value_type> __il);
808
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
809
valarray(const slice_array<value_type>& __sa);
810
valarray(const gslice_array<value_type>& __ga);
811
valarray(const mask_array<value_type>& __ma);
812
valarray(const indirect_array<value_type>& __ia);
816
valarray& operator=(const valarray& __v);
817
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
818
valarray& operator=(valarray&& __v);
819
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
820
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
821
valarray& operator=(initializer_list<value_type>);
822
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
823
valarray& operator=(const value_type& __x);
824
valarray& operator=(const slice_array<value_type>& __sa);
825
valarray& operator=(const gslice_array<value_type>& __ga);
826
valarray& operator=(const mask_array<value_type>& __ma);
827
valarray& operator=(const indirect_array<value_type>& __ia);
828
template <class _ValExpr>
829
valarray& operator=(const __val_expr<_ValExpr>& __v);
832
_LIBCPP_INLINE_VISIBILITY
833
const value_type& operator[](size_t __i) const {return __begin_[__i];}
835
_LIBCPP_INLINE_VISIBILITY
836
value_type& operator[](size_t __i) {return __begin_[__i];}
838
// subset operations:
839
__val_expr<__slice_expr<const valarray&> > operator[](slice __s) const;
840
slice_array<value_type> operator[](slice __s);
841
__val_expr<__indirect_expr<const valarray&> > operator[](const gslice& __gs) const;
842
gslice_array<value_type> operator[](const gslice& __gs);
843
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
844
__val_expr<__indirect_expr<const valarray&> > operator[](gslice&& __gs) const;
845
gslice_array<value_type> operator[](gslice&& __gs);
846
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
847
__val_expr<__mask_expr<const valarray&> > operator[](const valarray<bool>& __vb) const;
848
mask_array<value_type> operator[](const valarray<bool>& __vb);
849
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
850
__val_expr<__mask_expr<const valarray&> > operator[](valarray<bool>&& __vb) const;
851
mask_array<value_type> operator[](valarray<bool>&& __vb);
852
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
853
__val_expr<__indirect_expr<const valarray&> > operator[](const valarray<size_t>& __vs) const;
854
indirect_array<value_type> operator[](const valarray<size_t>& __vs);
855
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
856
__val_expr<__indirect_expr<const valarray&> > operator[](valarray<size_t>&& __vs) const;
857
indirect_array<value_type> operator[](valarray<size_t>&& __vs);
858
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
861
valarray operator+() const;
862
valarray operator-() const;
863
valarray operator~() const;
864
valarray<bool> operator!() const;
866
// computed assignment:
867
valarray& operator*= (const value_type& __x);
868
valarray& operator/= (const value_type& __x);
869
valarray& operator%= (const value_type& __x);
870
valarray& operator+= (const value_type& __x);
871
valarray& operator-= (const value_type& __x);
872
valarray& operator^= (const value_type& __x);
873
valarray& operator&= (const value_type& __x);
874
valarray& operator|= (const value_type& __x);
875
valarray& operator<<=(const value_type& __x);
876
valarray& operator>>=(const value_type& __x);
878
template <class _Expr>
881
__is_val_expr<_Expr>::value,
884
operator*= (const _Expr& __v);
886
template <class _Expr>
889
__is_val_expr<_Expr>::value,
892
operator/= (const _Expr& __v);
894
template <class _Expr>
897
__is_val_expr<_Expr>::value,
900
operator%= (const _Expr& __v);
902
template <class _Expr>
905
__is_val_expr<_Expr>::value,
908
operator+= (const _Expr& __v);
910
template <class _Expr>
913
__is_val_expr<_Expr>::value,
916
operator-= (const _Expr& __v);
918
template <class _Expr>
921
__is_val_expr<_Expr>::value,
924
operator^= (const _Expr& __v);
926
template <class _Expr>
929
__is_val_expr<_Expr>::value,
932
operator|= (const _Expr& __v);
934
template <class _Expr>
937
__is_val_expr<_Expr>::value,
940
operator&= (const _Expr& __v);
942
template <class _Expr>
945
__is_val_expr<_Expr>::value,
948
operator<<= (const _Expr& __v);
950
template <class _Expr>
953
__is_val_expr<_Expr>::value,
956
operator>>= (const _Expr& __v);
959
void swap(valarray& __v);
961
_LIBCPP_INLINE_VISIBILITY
962
size_t size() const {return static_cast<size_t>(__end_ - __begin_);}
964
value_type sum() const;
965
value_type min() const;
966
value_type max() const;
968
valarray shift (int __i) const;
969
valarray cshift(int __i) const;
970
valarray apply(value_type __f(value_type)) const;
971
valarray apply(value_type __f(const value_type&)) const;
972
void resize(size_t __n, value_type __x = value_type());
975
template <class> friend class _LIBCPP_VISIBLE valarray;
976
template <class> friend class _LIBCPP_VISIBLE slice_array;
977
template <class> friend class _LIBCPP_VISIBLE gslice_array;
978
template <class> friend class _LIBCPP_VISIBLE mask_array;
979
template <class> friend class __mask_expr;
980
template <class> friend class _LIBCPP_VISIBLE indirect_array;
981
template <class> friend class __indirect_expr;
982
template <class> friend class __val_expr;
987
begin(valarray<_Up>& __v);
992
begin(const valarray<_Up>& __v);
997
end(valarray<_Up>& __v);
1002
end(const valarray<_Up>& __v);
1005
template <class _Op, class _Tp>
1006
struct _UnaryOp<_Op, valarray<_Tp> >
1008
typedef typename _Op::result_type result_type;
1009
typedef _Tp value_type;
1012
const valarray<_Tp>& __a0_;
1014
_LIBCPP_INLINE_VISIBILITY
1015
_UnaryOp(const _Op& __op, const valarray<_Tp>& __a0) : __op_(__op), __a0_(__a0) {}
1017
_LIBCPP_INLINE_VISIBILITY
1018
result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
1020
_LIBCPP_INLINE_VISIBILITY
1021
size_t size() const {return __a0_.size();}
1024
template <class _Op, class _Tp, class _A1>
1025
struct _BinaryOp<_Op, valarray<_Tp>, _A1>
1027
typedef typename _Op::result_type result_type;
1028
typedef _Tp value_type;
1031
const valarray<_Tp>& __a0_;
1034
_LIBCPP_INLINE_VISIBILITY
1035
_BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const _A1& __a1)
1036
: __op_(__op), __a0_(__a0), __a1_(__a1) {}
1038
_LIBCPP_INLINE_VISIBILITY
1039
value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
1041
_LIBCPP_INLINE_VISIBILITY
1042
size_t size() const {return __a0_.size();}
1045
template <class _Op, class _A0, class _Tp>
1046
struct _BinaryOp<_Op, _A0, valarray<_Tp> >
1048
typedef typename _Op::result_type result_type;
1049
typedef _Tp value_type;
1053
const valarray<_Tp>& __a1_;
1055
_LIBCPP_INLINE_VISIBILITY
1056
_BinaryOp(const _Op& __op, const _A0& __a0, const valarray<_Tp>& __a1)
1057
: __op_(__op), __a0_(__a0), __a1_(__a1) {}
1059
_LIBCPP_INLINE_VISIBILITY
1060
value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
1062
_LIBCPP_INLINE_VISIBILITY
1063
size_t size() const {return __a0_.size();}
1066
template <class _Op, class _Tp>
1067
struct _BinaryOp<_Op, valarray<_Tp>, valarray<_Tp> >
1069
typedef typename _Op::result_type result_type;
1070
typedef _Tp value_type;
1073
const valarray<_Tp>& __a0_;
1074
const valarray<_Tp>& __a1_;
1076
_LIBCPP_INLINE_VISIBILITY
1077
_BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const valarray<_Tp>& __a1)
1078
: __op_(__op), __a0_(__a0), __a1_(__a1) {}
1080
_LIBCPP_INLINE_VISIBILITY
1081
value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
1083
_LIBCPP_INLINE_VISIBILITY
1084
size_t size() const {return __a0_.size();}
1089
template <class _Tp>
1090
class _LIBCPP_VISIBLE slice_array
1093
typedef _Tp value_type;
1101
template <class _Expr>
1104
__is_val_expr<_Expr>::value,
1107
operator=(const _Expr& __v) const;
1109
template <class _Expr>
1112
__is_val_expr<_Expr>::value,
1115
operator*=(const _Expr& __v) const;
1117
template <class _Expr>
1120
__is_val_expr<_Expr>::value,
1123
operator/=(const _Expr& __v) const;
1125
template <class _Expr>
1128
__is_val_expr<_Expr>::value,
1131
operator%=(const _Expr& __v) const;
1133
template <class _Expr>
1136
__is_val_expr<_Expr>::value,
1139
operator+=(const _Expr& __v) const;
1141
template <class _Expr>
1144
__is_val_expr<_Expr>::value,
1147
operator-=(const _Expr& __v) const;
1149
template <class _Expr>
1152
__is_val_expr<_Expr>::value,
1155
operator^=(const _Expr& __v) const;
1157
template <class _Expr>
1160
__is_val_expr<_Expr>::value,
1163
operator&=(const _Expr& __v) const;
1165
template <class _Expr>
1168
__is_val_expr<_Expr>::value,
1171
operator|=(const _Expr& __v) const;
1173
template <class _Expr>
1176
__is_val_expr<_Expr>::value,
1179
operator<<=(const _Expr& __v) const;
1181
template <class _Expr>
1184
__is_val_expr<_Expr>::value,
1187
operator>>=(const _Expr& __v) const;
1189
const slice_array& operator=(const slice_array& __sa) const;
1191
void operator=(const value_type& __x) const;
1194
_LIBCPP_INLINE_VISIBILITY
1195
slice_array(const slice& __sl, const valarray<value_type>& __v)
1196
: __vp_(const_cast<value_type*>(__v.__begin_ + __sl.start())),
1197
__size_(__sl.size()),
1198
__stride_(__sl.stride())
1201
template <class> friend class valarray;
1202
template <class> friend class sliceExpr;
1205
template <class _Tp>
1206
inline _LIBCPP_INLINE_VISIBILITY
1207
const slice_array<_Tp>&
1208
slice_array<_Tp>::operator=(const slice_array& __sa) const
1210
value_type* __t = __vp_;
1211
const value_type* __s = __sa.__vp_;
1212
for (size_t __n = __size_; __n; --__n, __t += __stride_, __s += __sa.__stride_)
1216
template <class _Tp>
1217
template <class _Expr>
1218
inline _LIBCPP_INLINE_VISIBILITY
1221
__is_val_expr<_Expr>::value,
1224
slice_array<_Tp>::operator=(const _Expr& __v) const
1226
value_type* __t = __vp_;
1227
for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1231
template <class _Tp>
1232
template <class _Expr>
1233
inline _LIBCPP_INLINE_VISIBILITY
1236
__is_val_expr<_Expr>::value,
1239
slice_array<_Tp>::operator*=(const _Expr& __v) const
1241
value_type* __t = __vp_;
1242
for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1246
template <class _Tp>
1247
template <class _Expr>
1248
inline _LIBCPP_INLINE_VISIBILITY
1251
__is_val_expr<_Expr>::value,
1254
slice_array<_Tp>::operator/=(const _Expr& __v) const
1256
value_type* __t = __vp_;
1257
for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1261
template <class _Tp>
1262
template <class _Expr>
1263
inline _LIBCPP_INLINE_VISIBILITY
1266
__is_val_expr<_Expr>::value,
1269
slice_array<_Tp>::operator%=(const _Expr& __v) const
1271
value_type* __t = __vp_;
1272
for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1276
template <class _Tp>
1277
template <class _Expr>
1278
inline _LIBCPP_INLINE_VISIBILITY
1281
__is_val_expr<_Expr>::value,
1284
slice_array<_Tp>::operator+=(const _Expr& __v) const
1286
value_type* __t = __vp_;
1287
for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
1291
template <class _Tp>
1292
template <class _Expr>
1293
inline _LIBCPP_INLINE_VISIBILITY
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>
1308
inline _LIBCPP_INLINE_VISIBILITY
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>
1323
inline _LIBCPP_INLINE_VISIBILITY
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>
1338
inline _LIBCPP_INLINE_VISIBILITY
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>
1353
inline _LIBCPP_INLINE_VISIBILITY
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>
1368
inline _LIBCPP_INLINE_VISIBILITY
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
inline _LIBCPP_INLINE_VISIBILITY
1384
slice_array<_Tp>::operator=(const value_type& __x) const
1386
value_type* __t = __vp_;
1387
for (size_t __n = __size_; __n; --__n, __t += __stride_)
1393
class _LIBCPP_VISIBLE gslice
1395
valarray<size_t> __size_;
1396
valarray<size_t> __stride_;
1397
valarray<size_t> __1d_;
1400
_LIBCPP_INLINE_VISIBILITY
1403
_LIBCPP_INLINE_VISIBILITY
1404
gslice(size_t __start, const valarray<size_t>& __size,
1405
const valarray<size_t>& __stride)
1410
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1412
_LIBCPP_INLINE_VISIBILITY
1413
gslice(size_t __start, const valarray<size_t>& __size,
1414
valarray<size_t>&& __stride)
1416
__stride_(move(__stride))
1419
_LIBCPP_INLINE_VISIBILITY
1420
gslice(size_t __start, valarray<size_t>&& __size,
1421
const valarray<size_t>& __stride)
1422
: __size_(move(__size)),
1426
_LIBCPP_INLINE_VISIBILITY
1427
gslice(size_t __start, valarray<size_t>&& __size,
1428
valarray<size_t>&& __stride)
1429
: __size_(move(__size)),
1430
__stride_(move(__stride))
1433
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1435
// gslice(const gslice&) = default;
1436
// gslice(gslice&&) = default;
1437
// gslice& operator=(const gslice&) = default;
1438
// gslice& operator=(gslice&&) = default;
1440
_LIBCPP_INLINE_VISIBILITY
1441
size_t start() const {return __1d_.size() ? __1d_[0] : 0;}
1443
_LIBCPP_INLINE_VISIBILITY
1444
valarray<size_t> size() const {return __size_;}
1446
_LIBCPP_INLINE_VISIBILITY
1447
valarray<size_t> stride() const {return __stride_;}
1450
void __init(size_t __start);
1452
template <class> friend class gslice_array;
1453
template <class> friend class valarray;
1454
template <class> friend class __val_expr;
1459
template <class _Tp>
1460
class _LIBCPP_VISIBLE gslice_array
1463
typedef _Tp value_type;
1467
valarray<size_t> __1d_;
1470
template <class _Expr>
1473
__is_val_expr<_Expr>::value,
1476
operator=(const _Expr& __v) const;
1478
template <class _Expr>
1481
__is_val_expr<_Expr>::value,
1484
operator*=(const _Expr& __v) const;
1486
template <class _Expr>
1489
__is_val_expr<_Expr>::value,
1492
operator/=(const _Expr& __v) const;
1494
template <class _Expr>
1497
__is_val_expr<_Expr>::value,
1500
operator%=(const _Expr& __v) const;
1502
template <class _Expr>
1505
__is_val_expr<_Expr>::value,
1508
operator+=(const _Expr& __v) const;
1510
template <class _Expr>
1513
__is_val_expr<_Expr>::value,
1516
operator-=(const _Expr& __v) const;
1518
template <class _Expr>
1521
__is_val_expr<_Expr>::value,
1524
operator^=(const _Expr& __v) const;
1526
template <class _Expr>
1529
__is_val_expr<_Expr>::value,
1532
operator&=(const _Expr& __v) const;
1534
template <class _Expr>
1537
__is_val_expr<_Expr>::value,
1540
operator|=(const _Expr& __v) const;
1542
template <class _Expr>
1545
__is_val_expr<_Expr>::value,
1548
operator<<=(const _Expr& __v) const;
1550
template <class _Expr>
1553
__is_val_expr<_Expr>::value,
1556
operator>>=(const _Expr& __v) const;
1558
const gslice_array& operator=(const gslice_array& __ga) const;
1560
void operator=(const value_type& __x) const;
1562
// gslice_array(const gslice_array&) = default;
1563
// gslice_array(gslice_array&&) = default;
1564
// gslice_array& operator=(const gslice_array&) = default;
1565
// gslice_array& operator=(gslice_array&&) = default;
1568
_LIBCPP_INLINE_VISIBILITY
1569
gslice_array(const gslice& __gs, const valarray<value_type>& __v)
1570
: __vp_(const_cast<value_type*>(__v.__begin_)),
1574
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1576
_LIBCPP_INLINE_VISIBILITY
1577
gslice_array(gslice&& __gs, const valarray<value_type>& __v)
1578
: __vp_(const_cast<value_type*>(__v.__begin_)),
1579
__1d_(move(__gs.__1d_))
1582
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1584
template <class> friend class valarray;
1587
template <class _Tp>
1588
template <class _Expr>
1589
inline _LIBCPP_INLINE_VISIBILITY
1592
__is_val_expr<_Expr>::value,
1595
gslice_array<_Tp>::operator=(const _Expr& __v) const
1597
typedef const size_t* _Ip;
1599
for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1600
__vp_[*__i] = __v[__j];
1603
template <class _Tp>
1604
template <class _Expr>
1605
inline _LIBCPP_INLINE_VISIBILITY
1608
__is_val_expr<_Expr>::value,
1611
gslice_array<_Tp>::operator*=(const _Expr& __v) const
1613
typedef const size_t* _Ip;
1615
for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1616
__vp_[*__i] *= __v[__j];
1619
template <class _Tp>
1620
template <class _Expr>
1621
inline _LIBCPP_INLINE_VISIBILITY
1624
__is_val_expr<_Expr>::value,
1627
gslice_array<_Tp>::operator/=(const _Expr& __v) const
1629
typedef const size_t* _Ip;
1631
for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1632
__vp_[*__i] /= __v[__j];
1635
template <class _Tp>
1636
template <class _Expr>
1637
inline _LIBCPP_INLINE_VISIBILITY
1640
__is_val_expr<_Expr>::value,
1643
gslice_array<_Tp>::operator%=(const _Expr& __v) const
1645
typedef const size_t* _Ip;
1647
for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1648
__vp_[*__i] %= __v[__j];
1651
template <class _Tp>
1652
template <class _Expr>
1653
inline _LIBCPP_INLINE_VISIBILITY
1656
__is_val_expr<_Expr>::value,
1659
gslice_array<_Tp>::operator+=(const _Expr& __v) const
1661
typedef const size_t* _Ip;
1663
for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1664
__vp_[*__i] += __v[__j];
1667
template <class _Tp>
1668
template <class _Expr>
1669
inline _LIBCPP_INLINE_VISIBILITY
1672
__is_val_expr<_Expr>::value,
1675
gslice_array<_Tp>::operator-=(const _Expr& __v) const
1677
typedef const size_t* _Ip;
1679
for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1680
__vp_[*__i] -= __v[__j];
1683
template <class _Tp>
1684
template <class _Expr>
1685
inline _LIBCPP_INLINE_VISIBILITY
1688
__is_val_expr<_Expr>::value,
1691
gslice_array<_Tp>::operator^=(const _Expr& __v) const
1693
typedef const size_t* _Ip;
1695
for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1696
__vp_[*__i] ^= __v[__j];
1699
template <class _Tp>
1700
template <class _Expr>
1701
inline _LIBCPP_INLINE_VISIBILITY
1704
__is_val_expr<_Expr>::value,
1707
gslice_array<_Tp>::operator&=(const _Expr& __v) const
1709
typedef const size_t* _Ip;
1711
for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1712
__vp_[*__i] &= __v[__j];
1715
template <class _Tp>
1716
template <class _Expr>
1717
inline _LIBCPP_INLINE_VISIBILITY
1720
__is_val_expr<_Expr>::value,
1723
gslice_array<_Tp>::operator|=(const _Expr& __v) const
1725
typedef const size_t* _Ip;
1727
for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1728
__vp_[*__i] |= __v[__j];
1731
template <class _Tp>
1732
template <class _Expr>
1733
inline _LIBCPP_INLINE_VISIBILITY
1736
__is_val_expr<_Expr>::value,
1739
gslice_array<_Tp>::operator<<=(const _Expr& __v) const
1741
typedef const size_t* _Ip;
1743
for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1744
__vp_[*__i] <<= __v[__j];
1747
template <class _Tp>
1748
template <class _Expr>
1749
inline _LIBCPP_INLINE_VISIBILITY
1752
__is_val_expr<_Expr>::value,
1755
gslice_array<_Tp>::operator>>=(const _Expr& __v) const
1757
typedef const size_t* _Ip;
1759
for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
1760
__vp_[*__i] >>= __v[__j];
1763
template <class _Tp>
1764
inline _LIBCPP_INLINE_VISIBILITY
1765
const gslice_array<_Tp>&
1766
gslice_array<_Tp>::operator=(const gslice_array& __ga) const
1768
typedef const size_t* _Ip;
1769
const value_type* __s = __ga.__vp_;
1770
for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ga.__1d_.__begin_;
1771
__i != __e; ++__i, ++__j)
1772
__vp_[*__i] = __s[*__j];
1776
template <class _Tp>
1777
inline _LIBCPP_INLINE_VISIBILITY
1779
gslice_array<_Tp>::operator=(const value_type& __x) const
1781
typedef const size_t* _Ip;
1782
for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
1788
template <class _Tp>
1789
class _LIBCPP_VISIBLE mask_array
1792
typedef _Tp value_type;
1796
valarray<size_t> __1d_;
1799
template <class _Expr>
1802
__is_val_expr<_Expr>::value,
1805
operator=(const _Expr& __v) const;
1807
template <class _Expr>
1810
__is_val_expr<_Expr>::value,
1813
operator*=(const _Expr& __v) const;
1815
template <class _Expr>
1818
__is_val_expr<_Expr>::value,
1821
operator/=(const _Expr& __v) const;
1823
template <class _Expr>
1826
__is_val_expr<_Expr>::value,
1829
operator%=(const _Expr& __v) const;
1831
template <class _Expr>
1834
__is_val_expr<_Expr>::value,
1837
operator+=(const _Expr& __v) const;
1839
template <class _Expr>
1842
__is_val_expr<_Expr>::value,
1845
operator-=(const _Expr& __v) const;
1847
template <class _Expr>
1850
__is_val_expr<_Expr>::value,
1853
operator^=(const _Expr& __v) const;
1855
template <class _Expr>
1858
__is_val_expr<_Expr>::value,
1861
operator&=(const _Expr& __v) const;
1863
template <class _Expr>
1866
__is_val_expr<_Expr>::value,
1869
operator|=(const _Expr& __v) const;
1871
template <class _Expr>
1874
__is_val_expr<_Expr>::value,
1877
operator<<=(const _Expr& __v) const;
1879
template <class _Expr>
1882
__is_val_expr<_Expr>::value,
1885
operator>>=(const _Expr& __v) const;
1887
const mask_array& operator=(const mask_array& __ma) const;
1889
void operator=(const value_type& __x) const;
1891
// mask_array(const mask_array&) = default;
1892
// mask_array(mask_array&&) = default;
1893
// mask_array& operator=(const mask_array&) = default;
1894
// mask_array& operator=(mask_array&&) = default;
1897
_LIBCPP_INLINE_VISIBILITY
1898
mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v)
1899
: __vp_(const_cast<value_type*>(__v.__begin_)),
1900
__1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
1903
for (size_t __i = 0; __i < __vb.size(); ++__i)
1908
template <class> friend class valarray;
1911
template <class _Tp>
1912
template <class _Expr>
1913
inline _LIBCPP_INLINE_VISIBILITY
1916
__is_val_expr<_Expr>::value,
1919
mask_array<_Tp>::operator=(const _Expr& __v) const
1921
size_t __n = __1d_.size();
1922
for (size_t __i = 0; __i < __n; ++__i)
1923
__vp_[__1d_[__i]] = __v[__i];
1926
template <class _Tp>
1927
template <class _Expr>
1928
inline _LIBCPP_INLINE_VISIBILITY
1931
__is_val_expr<_Expr>::value,
1934
mask_array<_Tp>::operator*=(const _Expr& __v) const
1936
size_t __n = __1d_.size();
1937
for (size_t __i = 0; __i < __n; ++__i)
1938
__vp_[__1d_[__i]] *= __v[__i];
1941
template <class _Tp>
1942
template <class _Expr>
1943
inline _LIBCPP_INLINE_VISIBILITY
1946
__is_val_expr<_Expr>::value,
1949
mask_array<_Tp>::operator/=(const _Expr& __v) const
1951
size_t __n = __1d_.size();
1952
for (size_t __i = 0; __i < __n; ++__i)
1953
__vp_[__1d_[__i]] /= __v[__i];
1956
template <class _Tp>
1957
template <class _Expr>
1958
inline _LIBCPP_INLINE_VISIBILITY
1961
__is_val_expr<_Expr>::value,
1964
mask_array<_Tp>::operator%=(const _Expr& __v) const
1966
size_t __n = __1d_.size();
1967
for (size_t __i = 0; __i < __n; ++__i)
1968
__vp_[__1d_[__i]] %= __v[__i];
1971
template <class _Tp>
1972
template <class _Expr>
1973
inline _LIBCPP_INLINE_VISIBILITY
1976
__is_val_expr<_Expr>::value,
1979
mask_array<_Tp>::operator+=(const _Expr& __v) const
1981
size_t __n = __1d_.size();
1982
for (size_t __i = 0; __i < __n; ++__i)
1983
__vp_[__1d_[__i]] += __v[__i];
1986
template <class _Tp>
1987
template <class _Expr>
1988
inline _LIBCPP_INLINE_VISIBILITY
1991
__is_val_expr<_Expr>::value,
1994
mask_array<_Tp>::operator-=(const _Expr& __v) const
1996
size_t __n = __1d_.size();
1997
for (size_t __i = 0; __i < __n; ++__i)
1998
__vp_[__1d_[__i]] -= __v[__i];
2001
template <class _Tp>
2002
template <class _Expr>
2003
inline _LIBCPP_INLINE_VISIBILITY
2006
__is_val_expr<_Expr>::value,
2009
mask_array<_Tp>::operator^=(const _Expr& __v) const
2011
size_t __n = __1d_.size();
2012
for (size_t __i = 0; __i < __n; ++__i)
2013
__vp_[__1d_[__i]] ^= __v[__i];
2016
template <class _Tp>
2017
template <class _Expr>
2018
inline _LIBCPP_INLINE_VISIBILITY
2021
__is_val_expr<_Expr>::value,
2024
mask_array<_Tp>::operator&=(const _Expr& __v) const
2026
size_t __n = __1d_.size();
2027
for (size_t __i = 0; __i < __n; ++__i)
2028
__vp_[__1d_[__i]] &= __v[__i];
2031
template <class _Tp>
2032
template <class _Expr>
2033
inline _LIBCPP_INLINE_VISIBILITY
2036
__is_val_expr<_Expr>::value,
2039
mask_array<_Tp>::operator|=(const _Expr& __v) const
2041
size_t __n = __1d_.size();
2042
for (size_t __i = 0; __i < __n; ++__i)
2043
__vp_[__1d_[__i]] |= __v[__i];
2046
template <class _Tp>
2047
template <class _Expr>
2048
inline _LIBCPP_INLINE_VISIBILITY
2051
__is_val_expr<_Expr>::value,
2054
mask_array<_Tp>::operator<<=(const _Expr& __v) const
2056
size_t __n = __1d_.size();
2057
for (size_t __i = 0; __i < __n; ++__i)
2058
__vp_[__1d_[__i]] <<= __v[__i];
2061
template <class _Tp>
2062
template <class _Expr>
2063
inline _LIBCPP_INLINE_VISIBILITY
2066
__is_val_expr<_Expr>::value,
2069
mask_array<_Tp>::operator>>=(const _Expr& __v) const
2071
size_t __n = __1d_.size();
2072
for (size_t __i = 0; __i < __n; ++__i)
2073
__vp_[__1d_[__i]] >>= __v[__i];
2076
template <class _Tp>
2077
inline _LIBCPP_INLINE_VISIBILITY
2078
const mask_array<_Tp>&
2079
mask_array<_Tp>::operator=(const mask_array& __ma) const
2081
size_t __n = __1d_.size();
2082
for (size_t __i = 0; __i < __n; ++__i)
2083
__vp_[__1d_[__i]] = __ma.__vp_[__1d_[__i]];
2086
template <class _Tp>
2087
inline _LIBCPP_INLINE_VISIBILITY
2089
mask_array<_Tp>::operator=(const value_type& __x) const
2091
size_t __n = __1d_.size();
2092
for (size_t __i = 0; __i < __n; ++__i)
2093
__vp_[__1d_[__i]] = __x;
2096
template <class _ValExpr>
2099
typedef typename remove_reference<_ValExpr>::type _RmExpr;
2101
typedef typename _RmExpr::value_type value_type;
2102
typedef value_type result_type;
2106
valarray<size_t> __1d_;
2108
_LIBCPP_INLINE_VISIBILITY
2109
__mask_expr(const valarray<bool>& __vb, const _RmExpr& __e)
2111
__1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
2114
for (size_t __i = 0; __i < __vb.size(); ++__i)
2120
_LIBCPP_INLINE_VISIBILITY
2121
result_type operator[](size_t __i) const
2122
{return __expr_[__1d_[__i]];}
2124
_LIBCPP_INLINE_VISIBILITY
2125
size_t size() const {return __1d_.size();}
2127
template <class> friend class valarray;
2132
template <class _Tp>
2133
class _LIBCPP_VISIBLE indirect_array
2136
typedef _Tp value_type;
2140
valarray<size_t> __1d_;
2143
template <class _Expr>
2146
__is_val_expr<_Expr>::value,
2149
operator=(const _Expr& __v) const;
2151
template <class _Expr>
2154
__is_val_expr<_Expr>::value,
2157
operator*=(const _Expr& __v) const;
2159
template <class _Expr>
2162
__is_val_expr<_Expr>::value,
2165
operator/=(const _Expr& __v) const;
2167
template <class _Expr>
2170
__is_val_expr<_Expr>::value,
2173
operator%=(const _Expr& __v) const;
2175
template <class _Expr>
2178
__is_val_expr<_Expr>::value,
2181
operator+=(const _Expr& __v) const;
2183
template <class _Expr>
2186
__is_val_expr<_Expr>::value,
2189
operator-=(const _Expr& __v) const;
2191
template <class _Expr>
2194
__is_val_expr<_Expr>::value,
2197
operator^=(const _Expr& __v) const;
2199
template <class _Expr>
2202
__is_val_expr<_Expr>::value,
2205
operator&=(const _Expr& __v) const;
2207
template <class _Expr>
2210
__is_val_expr<_Expr>::value,
2213
operator|=(const _Expr& __v) const;
2215
template <class _Expr>
2218
__is_val_expr<_Expr>::value,
2221
operator<<=(const _Expr& __v) const;
2223
template <class _Expr>
2226
__is_val_expr<_Expr>::value,
2229
operator>>=(const _Expr& __v) const;
2231
const indirect_array& operator=(const indirect_array& __ia) const;
2233
void operator=(const value_type& __x) const;
2235
// indirect_array(const indirect_array&) = default;
2236
// indirect_array(indirect_array&&) = default;
2237
// indirect_array& operator=(const indirect_array&) = default;
2238
// indirect_array& operator=(indirect_array&&) = default;
2241
_LIBCPP_INLINE_VISIBILITY
2242
indirect_array(const valarray<size_t>& __ia, const valarray<value_type>& __v)
2243
: __vp_(const_cast<value_type*>(__v.__begin_)),
2247
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2249
_LIBCPP_INLINE_VISIBILITY
2250
indirect_array(valarray<size_t>&& __ia, const valarray<value_type>& __v)
2251
: __vp_(const_cast<value_type*>(__v.__begin_)),
2255
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2257
template <class> friend class valarray;
2260
template <class _Tp>
2261
template <class _Expr>
2262
inline _LIBCPP_INLINE_VISIBILITY
2265
__is_val_expr<_Expr>::value,
2268
indirect_array<_Tp>::operator=(const _Expr& __v) const
2270
size_t __n = __1d_.size();
2271
for (size_t __i = 0; __i < __n; ++__i)
2272
__vp_[__1d_[__i]] = __v[__i];
2275
template <class _Tp>
2276
template <class _Expr>
2277
inline _LIBCPP_INLINE_VISIBILITY
2280
__is_val_expr<_Expr>::value,
2283
indirect_array<_Tp>::operator*=(const _Expr& __v) const
2285
size_t __n = __1d_.size();
2286
for (size_t __i = 0; __i < __n; ++__i)
2287
__vp_[__1d_[__i]] *= __v[__i];
2290
template <class _Tp>
2291
template <class _Expr>
2292
inline _LIBCPP_INLINE_VISIBILITY
2295
__is_val_expr<_Expr>::value,
2298
indirect_array<_Tp>::operator/=(const _Expr& __v) const
2300
size_t __n = __1d_.size();
2301
for (size_t __i = 0; __i < __n; ++__i)
2302
__vp_[__1d_[__i]] /= __v[__i];
2305
template <class _Tp>
2306
template <class _Expr>
2307
inline _LIBCPP_INLINE_VISIBILITY
2310
__is_val_expr<_Expr>::value,
2313
indirect_array<_Tp>::operator%=(const _Expr& __v) const
2315
size_t __n = __1d_.size();
2316
for (size_t __i = 0; __i < __n; ++__i)
2317
__vp_[__1d_[__i]] %= __v[__i];
2320
template <class _Tp>
2321
template <class _Expr>
2322
inline _LIBCPP_INLINE_VISIBILITY
2325
__is_val_expr<_Expr>::value,
2328
indirect_array<_Tp>::operator+=(const _Expr& __v) const
2330
size_t __n = __1d_.size();
2331
for (size_t __i = 0; __i < __n; ++__i)
2332
__vp_[__1d_[__i]] += __v[__i];
2335
template <class _Tp>
2336
template <class _Expr>
2337
inline _LIBCPP_INLINE_VISIBILITY
2340
__is_val_expr<_Expr>::value,
2343
indirect_array<_Tp>::operator-=(const _Expr& __v) const
2345
size_t __n = __1d_.size();
2346
for (size_t __i = 0; __i < __n; ++__i)
2347
__vp_[__1d_[__i]] -= __v[__i];
2350
template <class _Tp>
2351
template <class _Expr>
2352
inline _LIBCPP_INLINE_VISIBILITY
2355
__is_val_expr<_Expr>::value,
2358
indirect_array<_Tp>::operator^=(const _Expr& __v) const
2360
size_t __n = __1d_.size();
2361
for (size_t __i = 0; __i < __n; ++__i)
2362
__vp_[__1d_[__i]] ^= __v[__i];
2365
template <class _Tp>
2366
template <class _Expr>
2367
inline _LIBCPP_INLINE_VISIBILITY
2370
__is_val_expr<_Expr>::value,
2373
indirect_array<_Tp>::operator&=(const _Expr& __v) const
2375
size_t __n = __1d_.size();
2376
for (size_t __i = 0; __i < __n; ++__i)
2377
__vp_[__1d_[__i]] &= __v[__i];
2380
template <class _Tp>
2381
template <class _Expr>
2382
inline _LIBCPP_INLINE_VISIBILITY
2385
__is_val_expr<_Expr>::value,
2388
indirect_array<_Tp>::operator|=(const _Expr& __v) const
2390
size_t __n = __1d_.size();
2391
for (size_t __i = 0; __i < __n; ++__i)
2392
__vp_[__1d_[__i]] |= __v[__i];
2395
template <class _Tp>
2396
template <class _Expr>
2397
inline _LIBCPP_INLINE_VISIBILITY
2400
__is_val_expr<_Expr>::value,
2403
indirect_array<_Tp>::operator<<=(const _Expr& __v) const
2405
size_t __n = __1d_.size();
2406
for (size_t __i = 0; __i < __n; ++__i)
2407
__vp_[__1d_[__i]] <<= __v[__i];
2410
template <class _Tp>
2411
template <class _Expr>
2412
inline _LIBCPP_INLINE_VISIBILITY
2415
__is_val_expr<_Expr>::value,
2418
indirect_array<_Tp>::operator>>=(const _Expr& __v) const
2420
size_t __n = __1d_.size();
2421
for (size_t __i = 0; __i < __n; ++__i)
2422
__vp_[__1d_[__i]] >>= __v[__i];
2425
template <class _Tp>
2426
inline _LIBCPP_INLINE_VISIBILITY
2427
const indirect_array<_Tp>&
2428
indirect_array<_Tp>::operator=(const indirect_array& __ia) const
2430
typedef const size_t* _Ip;
2431
const value_type* __s = __ia.__vp_;
2432
for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ia.__1d_.__begin_;
2433
__i != __e; ++__i, ++__j)
2434
__vp_[*__i] = __s[*__j];
2438
template <class _Tp>
2439
inline _LIBCPP_INLINE_VISIBILITY
2441
indirect_array<_Tp>::operator=(const value_type& __x) const
2443
typedef const size_t* _Ip;
2444
for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
2448
template <class _ValExpr>
2449
class __indirect_expr
2451
typedef typename remove_reference<_ValExpr>::type _RmExpr;
2453
typedef typename _RmExpr::value_type value_type;
2454
typedef value_type result_type;
2458
valarray<size_t> __1d_;
2460
_LIBCPP_INLINE_VISIBILITY
2461
__indirect_expr(const valarray<size_t>& __ia, const _RmExpr& __e)
2466
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2468
_LIBCPP_INLINE_VISIBILITY
2469
__indirect_expr(valarray<size_t>&& __ia, const _RmExpr& __e)
2474
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2477
_LIBCPP_INLINE_VISIBILITY
2478
result_type operator[](size_t __i) const
2479
{return __expr_[__1d_[__i]];}
2481
_LIBCPP_INLINE_VISIBILITY
2482
size_t size() const {return __1d_.size();}
2484
template <class> friend class _LIBCPP_VISIBLE valarray;
2487
template<class _ValExpr>
2490
typedef typename remove_reference<_ValExpr>::type _RmExpr;
2494
typedef typename _RmExpr::value_type value_type;
2495
typedef typename _RmExpr::result_type result_type;
2497
_LIBCPP_INLINE_VISIBILITY
2498
explicit __val_expr(const _RmExpr& __e) : __expr_(__e) {}
2500
_LIBCPP_INLINE_VISIBILITY
2501
result_type operator[](size_t __i) const
2502
{return __expr_[__i];}
2504
_LIBCPP_INLINE_VISIBILITY
2505
__val_expr<__slice_expr<_ValExpr> > operator[](slice __s) const
2506
{return __val_expr<__slice_expr<_ValExpr> >(__expr_, __s);}
2508
_LIBCPP_INLINE_VISIBILITY
2509
__val_expr<__indirect_expr<_ValExpr> > operator[](const gslice& __gs) const
2510
{return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __gs.__1d_);}
2512
_LIBCPP_INLINE_VISIBILITY
2513
__val_expr<__mask_expr<_ValExpr> > operator[](const valarray<bool>& __vb) const
2514
{return __val_expr<__mask_expr<_ValExpr> >(__expr_, __vb);}
2516
_LIBCPP_INLINE_VISIBILITY
2517
__val_expr<__indirect_expr<_ValExpr> > operator[](const valarray<size_t>& __vs) const
2518
{return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __vs);}
2520
_LIBCPP_INLINE_VISIBILITY
2521
__val_expr<_UnaryOp<__unary_plus<value_type>, _ValExpr> >
2524
typedef _UnaryOp<__unary_plus<value_type>, _ValExpr> _NewExpr;
2525
return __val_expr<_NewExpr>(_NewExpr(__unary_plus<value_type>(), __expr_));
2528
_LIBCPP_INLINE_VISIBILITY
2529
__val_expr<_UnaryOp<negate<value_type>, _ValExpr> >
2532
typedef _UnaryOp<negate<value_type>, _ValExpr> _NewExpr;
2533
return __val_expr<_NewExpr>(_NewExpr(negate<value_type>(), __expr_));
2536
_LIBCPP_INLINE_VISIBILITY
2537
__val_expr<_UnaryOp<__bit_not<value_type>, _ValExpr> >
2540
typedef _UnaryOp<__bit_not<value_type>, _ValExpr> _NewExpr;
2541
return __val_expr<_NewExpr>(_NewExpr(__bit_not<value_type>(), __expr_));
2544
_LIBCPP_INLINE_VISIBILITY
2545
__val_expr<_UnaryOp<logical_not<value_type>, _ValExpr> >
2548
typedef _UnaryOp<logical_not<value_type>, _ValExpr> _NewExpr;
2549
return __val_expr<_NewExpr>(_NewExpr(logical_not<value_type>(), __expr_));
2552
operator valarray<result_type>() const;
2554
_LIBCPP_INLINE_VISIBILITY
2555
size_t size() const {return __expr_.size();}
2557
_LIBCPP_INLINE_VISIBILITY
2558
result_type sum() const
2560
size_t __n = __expr_.size();
2561
result_type __r = __n ? __expr_[0] : result_type();
2562
for (size_t __i = 1; __i < __n; ++__i)
2563
__r += __expr_[__i];
2567
_LIBCPP_INLINE_VISIBILITY
2568
result_type min() const
2570
size_t __n = size();
2571
result_type __r = __n ? (*this)[0] : result_type();
2572
for (size_t __i = 1; __i < __n; ++__i)
2574
result_type __x = __expr_[__i];
2581
_LIBCPP_INLINE_VISIBILITY
2582
result_type max() const
2584
size_t __n = size();
2585
result_type __r = __n ? (*this)[0] : result_type();
2586
for (size_t __i = 1; __i < __n; ++__i)
2588
result_type __x = __expr_[__i];
2595
_LIBCPP_INLINE_VISIBILITY
2596
__val_expr<__shift_expr<_ValExpr> > shift (int __i) const
2597
{return __val_expr<__shift_expr<_ValExpr> >(__shift_expr<_ValExpr>(__i, __expr_));}
2599
_LIBCPP_INLINE_VISIBILITY
2600
__val_expr<__cshift_expr<_ValExpr> > cshift(int __i) const
2601
{return __val_expr<__cshift_expr<_ValExpr> >(__cshift_expr<_ValExpr>(__i, __expr_));}
2603
_LIBCPP_INLINE_VISIBILITY
2604
__val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(value_type)>, _ValExpr> >
2605
apply(value_type __f(value_type)) const
2607
typedef __apply_expr<value_type, value_type(*)(value_type)> _Op;
2608
typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
2609
return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
2612
_LIBCPP_INLINE_VISIBILITY
2613
__val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(const value_type&)>, _ValExpr> >
2614
apply(value_type __f(const value_type&)) const
2616
typedef __apply_expr<value_type, value_type(*)(const value_type&)> _Op;
2617
typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
2618
return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
2622
template<class _ValExpr>
2623
__val_expr<_ValExpr>::operator valarray<result_type>() const
2625
valarray<result_type> __r;
2626
size_t __n = __expr_.size();
2631
static_cast<result_type*>(::operator new(__n * sizeof(result_type)));
2632
for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i)
2633
::new (__r.__end_) result_type(__expr_[__i]);
2640
template <class _Tp>
2641
inline _LIBCPP_INLINE_VISIBILITY
2642
valarray<_Tp>::valarray(size_t __n)
2649
template <class _Tp>
2650
inline _LIBCPP_INLINE_VISIBILITY
2651
valarray<_Tp>::valarray(const value_type& __x, size_t __n)
2658
template <class _Tp>
2659
valarray<_Tp>::valarray(const value_type* __p, size_t __n)
2665
__begin_ = __end_ = static_cast<value_type*>(::operator new(__n * sizeof(value_type)));
2666
#ifndef _LIBCPP_NO_EXCEPTIONS
2669
#endif // _LIBCPP_NO_EXCEPTIONS
2670
for (; __n; ++__end_, ++__p, --__n)
2671
::new (__end_) value_type(*__p);
2672
#ifndef _LIBCPP_NO_EXCEPTIONS
2679
#endif // _LIBCPP_NO_EXCEPTIONS
2683
template <class _Tp>
2684
valarray<_Tp>::valarray(const valarray& __v)
2690
__begin_ = __end_ = static_cast<value_type*>(::operator new(__v.size() * sizeof(value_type)));
2691
#ifndef _LIBCPP_NO_EXCEPTIONS
2694
#endif // _LIBCPP_NO_EXCEPTIONS
2695
for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p)
2696
::new (__end_) value_type(*__p);
2697
#ifndef _LIBCPP_NO_EXCEPTIONS
2704
#endif // _LIBCPP_NO_EXCEPTIONS
2708
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2710
template <class _Tp>
2711
inline _LIBCPP_INLINE_VISIBILITY
2712
valarray<_Tp>::valarray(valarray&& __v)
2713
: __begin_(__v.__begin_),
2716
__v.__begin_ = __v.__end_ = nullptr;
2719
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2721
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
2723
template <class _Tp>
2724
valarray<_Tp>::valarray(initializer_list<value_type> __il)
2728
size_t __n = __il.size();
2731
__begin_ = __end_ = static_cast<value_type*>(::operator new(__n * sizeof(value_type)));
2732
#ifndef _LIBCPP_NO_EXCEPTIONS
2735
#endif // _LIBCPP_NO_EXCEPTIONS
2736
for (const value_type* __p = __il.begin(); __n; ++__end_, ++__p, --__n)
2737
::new (__end_) value_type(*__p);
2738
#ifndef _LIBCPP_NO_EXCEPTIONS
2745
#endif // _LIBCPP_NO_EXCEPTIONS
2749
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
2751
template <class _Tp>
2752
valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
2756
size_t __n = __sa.__size_;
2759
__begin_ = __end_ = static_cast<value_type*>(::operator new(__n * sizeof(value_type)));
2760
#ifndef _LIBCPP_NO_EXCEPTIONS
2763
#endif // _LIBCPP_NO_EXCEPTIONS
2764
for (const value_type* __p = __sa.__vp_; __n; ++__end_, __p += __sa.__stride_, --__n)
2765
::new (__end_) value_type(*__p);
2766
#ifndef _LIBCPP_NO_EXCEPTIONS
2773
#endif // _LIBCPP_NO_EXCEPTIONS
2777
template <class _Tp>
2778
valarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
2782
size_t __n = __ga.__1d_.size();
2785
__begin_ = __end_ = static_cast<value_type*>(::operator new(__n * sizeof(value_type)));
2786
#ifndef _LIBCPP_NO_EXCEPTIONS
2789
#endif // _LIBCPP_NO_EXCEPTIONS
2790
typedef const size_t* _Ip;
2791
const value_type* __s = __ga.__vp_;
2792
for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
2793
__i != __e; ++__i, ++__end_)
2794
::new (__end_) value_type(__s[*__i]);
2795
#ifndef _LIBCPP_NO_EXCEPTIONS
2802
#endif // _LIBCPP_NO_EXCEPTIONS
2806
template <class _Tp>
2807
valarray<_Tp>::valarray(const mask_array<value_type>& __ma)
2811
size_t __n = __ma.__1d_.size();
2814
__begin_ = __end_ = static_cast<value_type*>(::operator new(__n * sizeof(value_type)));
2815
#ifndef _LIBCPP_NO_EXCEPTIONS
2818
#endif // _LIBCPP_NO_EXCEPTIONS
2819
typedef const size_t* _Ip;
2820
const value_type* __s = __ma.__vp_;
2821
for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
2822
__i != __e; ++__i, ++__end_)
2823
::new (__end_) value_type(__s[*__i]);
2824
#ifndef _LIBCPP_NO_EXCEPTIONS
2831
#endif // _LIBCPP_NO_EXCEPTIONS
2835
template <class _Tp>
2836
valarray<_Tp>::valarray(const indirect_array<value_type>& __ia)
2840
size_t __n = __ia.__1d_.size();
2843
__begin_ = __end_ = static_cast<value_type*>(::operator new(__n * sizeof(value_type)));
2844
#ifndef _LIBCPP_NO_EXCEPTIONS
2847
#endif // _LIBCPP_NO_EXCEPTIONS
2848
typedef const size_t* _Ip;
2849
const value_type* __s = __ia.__vp_;
2850
for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
2851
__i != __e; ++__i, ++__end_)
2852
::new (__end_) value_type(__s[*__i]);
2853
#ifndef _LIBCPP_NO_EXCEPTIONS
2860
#endif // _LIBCPP_NO_EXCEPTIONS
2864
template <class _Tp>
2865
inline _LIBCPP_INLINE_VISIBILITY
2866
valarray<_Tp>::~valarray()
2871
template <class _Tp>
2873
valarray<_Tp>::operator=(const valarray& __v)
2877
if (size() != __v.size())
2879
_VSTD::copy(__v.__begin_, __v.__end_, __begin_);
2884
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2886
template <class _Tp>
2887
inline _LIBCPP_INLINE_VISIBILITY
2889
valarray<_Tp>::operator=(valarray&& __v)
2892
__begin_ = __v.__begin_;
2893
__end_ = __v.__end_;
2894
__v.__begin_ = nullptr;
2895
__v.__end_ = nullptr;
2899
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2901
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
2903
template <class _Tp>
2904
inline _LIBCPP_INLINE_VISIBILITY
2906
valarray<_Tp>::operator=(initializer_list<value_type> __il)
2908
if (size() != __il.size())
2909
resize(__il.size());
2910
_VSTD::copy(__il.begin(), __il.end(), __begin_);
2914
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
2916
template <class _Tp>
2917
inline _LIBCPP_INLINE_VISIBILITY
2919
valarray<_Tp>::operator=(const value_type& __x)
2921
_VSTD::fill(__begin_, __end_, __x);
2925
template <class _Tp>
2926
inline _LIBCPP_INLINE_VISIBILITY
2928
valarray<_Tp>::operator=(const slice_array<value_type>& __sa)
2930
value_type* __t = __begin_;
2931
const value_type* __s = __sa.__vp_;
2932
for (size_t __n = __sa.__size_; __n; --__n, __s += __sa.__stride_, ++__t)
2937
template <class _Tp>
2938
inline _LIBCPP_INLINE_VISIBILITY
2940
valarray<_Tp>::operator=(const gslice_array<value_type>& __ga)
2942
typedef const size_t* _Ip;
2943
value_type* __t = __begin_;
2944
const value_type* __s = __ga.__vp_;
2945
for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
2946
__i != __e; ++__i, ++__t)
2951
template <class _Tp>
2952
inline _LIBCPP_INLINE_VISIBILITY
2954
valarray<_Tp>::operator=(const mask_array<value_type>& __ma)
2956
typedef const size_t* _Ip;
2957
value_type* __t = __begin_;
2958
const value_type* __s = __ma.__vp_;
2959
for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
2960
__i != __e; ++__i, ++__t)
2965
template <class _Tp>
2966
inline _LIBCPP_INLINE_VISIBILITY
2968
valarray<_Tp>::operator=(const indirect_array<value_type>& __ia)
2970
typedef const size_t* _Ip;
2971
value_type* __t = __begin_;
2972
const value_type* __s = __ia.__vp_;
2973
for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
2974
__i != __e; ++__i, ++__t)
2979
template <class _Tp>
2980
template <class _ValExpr>
2981
inline _LIBCPP_INLINE_VISIBILITY
2983
valarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v)
2985
size_t __n = __v.size();
2988
value_type* __t = __begin_;
2989
for (size_t __i = 0; __i != __n; ++__t, ++__i)
2990
*__t = result_type(__v[__i]);
2994
template <class _Tp>
2995
inline _LIBCPP_INLINE_VISIBILITY
2996
__val_expr<__slice_expr<const valarray<_Tp>&> >
2997
valarray<_Tp>::operator[](slice __s) const
2999
return __val_expr<__slice_expr<const valarray&> >(__slice_expr<const valarray&>(__s, *this));
3002
template <class _Tp>
3003
inline _LIBCPP_INLINE_VISIBILITY
3005
valarray<_Tp>::operator[](slice __s)
3007
return slice_array<value_type>(__s, *this);
3010
template <class _Tp>
3011
inline _LIBCPP_INLINE_VISIBILITY
3012
__val_expr<__indirect_expr<const valarray<_Tp>&> >
3013
valarray<_Tp>::operator[](const gslice& __gs) const
3015
return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__gs.__1d_, *this));
3018
template <class _Tp>
3019
inline _LIBCPP_INLINE_VISIBILITY
3021
valarray<_Tp>::operator[](const gslice& __gs)
3023
return gslice_array<value_type>(__gs, *this);
3026
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3028
template <class _Tp>
3029
inline _LIBCPP_INLINE_VISIBILITY
3030
__val_expr<__indirect_expr<const valarray<_Tp>&> >
3031
valarray<_Tp>::operator[](gslice&& __gs) const
3033
return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__gs.__1d_), *this));
3036
template <class _Tp>
3037
inline _LIBCPP_INLINE_VISIBILITY
3039
valarray<_Tp>::operator[](gslice&& __gs)
3041
return gslice_array<value_type>(move(__gs), *this);
3044
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
3046
template <class _Tp>
3047
inline _LIBCPP_INLINE_VISIBILITY
3048
__val_expr<__mask_expr<const valarray<_Tp>&> >
3049
valarray<_Tp>::operator[](const valarray<bool>& __vb) const
3051
return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(__vb, *this));
3054
template <class _Tp>
3055
inline _LIBCPP_INLINE_VISIBILITY
3057
valarray<_Tp>::operator[](const valarray<bool>& __vb)
3059
return mask_array<value_type>(__vb, *this);
3062
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3064
template <class _Tp>
3065
inline _LIBCPP_INLINE_VISIBILITY
3066
__val_expr<__mask_expr<const valarray<_Tp>&> >
3067
valarray<_Tp>::operator[](valarray<bool>&& __vb) const
3069
return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(move(__vb), *this));
3072
template <class _Tp>
3073
inline _LIBCPP_INLINE_VISIBILITY
3075
valarray<_Tp>::operator[](valarray<bool>&& __vb)
3077
return mask_array<value_type>(move(__vb), *this);
3080
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
3082
template <class _Tp>
3083
inline _LIBCPP_INLINE_VISIBILITY
3084
__val_expr<__indirect_expr<const valarray<_Tp>&> >
3085
valarray<_Tp>::operator[](const valarray<size_t>& __vs) const
3087
return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__vs, *this));
3090
template <class _Tp>
3091
inline _LIBCPP_INLINE_VISIBILITY
3093
valarray<_Tp>::operator[](const valarray<size_t>& __vs)
3095
return indirect_array<value_type>(__vs, *this);
3098
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3100
template <class _Tp>
3101
inline _LIBCPP_INLINE_VISIBILITY
3102
__val_expr<__indirect_expr<const valarray<_Tp>&> >
3103
valarray<_Tp>::operator[](valarray<size_t>&& __vs) const
3105
return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__vs), *this));
3108
template <class _Tp>
3109
inline _LIBCPP_INLINE_VISIBILITY
3111
valarray<_Tp>::operator[](valarray<size_t>&& __vs)
3113
return indirect_array<value_type>(move(__vs), *this);
3116
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
3118
template <class _Tp>
3120
valarray<_Tp>::operator+() const
3122
valarray<value_type> __r;
3123
size_t __n = size();
3128
static_cast<value_type*>(::operator new(__n * sizeof(value_type)));
3129
for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3130
::new (__r.__end_) value_type(+*__p);
3135
template <class _Tp>
3137
valarray<_Tp>::operator-() const
3139
valarray<value_type> __r;
3140
size_t __n = size();
3145
static_cast<value_type*>(::operator new(__n * sizeof(value_type)));
3146
for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3147
::new (__r.__end_) value_type(-*__p);
3152
template <class _Tp>
3154
valarray<_Tp>::operator~() const
3156
valarray<value_type> __r;
3157
size_t __n = size();
3162
static_cast<value_type*>(::operator new(__n * sizeof(value_type)));
3163
for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3164
::new (__r.__end_) value_type(~*__p);
3169
template <class _Tp>
3171
valarray<_Tp>::operator!() const
3174
size_t __n = size();
3179
static_cast<bool*>(::operator new(__n * sizeof(bool)));
3180
for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3181
::new (__r.__end_) bool(!*__p);
3186
template <class _Tp>
3187
inline _LIBCPP_INLINE_VISIBILITY
3189
valarray<_Tp>::operator*=(const value_type& __x)
3191
for (value_type* __p = __begin_; __p != __end_; ++__p)
3196
template <class _Tp>
3197
inline _LIBCPP_INLINE_VISIBILITY
3199
valarray<_Tp>::operator/=(const value_type& __x)
3201
for (value_type* __p = __begin_; __p != __end_; ++__p)
3206
template <class _Tp>
3207
inline _LIBCPP_INLINE_VISIBILITY
3209
valarray<_Tp>::operator%=(const value_type& __x)
3211
for (value_type* __p = __begin_; __p != __end_; ++__p)
3216
template <class _Tp>
3217
inline _LIBCPP_INLINE_VISIBILITY
3219
valarray<_Tp>::operator+=(const value_type& __x)
3221
for (value_type* __p = __begin_; __p != __end_; ++__p)
3226
template <class _Tp>
3227
inline _LIBCPP_INLINE_VISIBILITY
3229
valarray<_Tp>::operator-=(const value_type& __x)
3231
for (value_type* __p = __begin_; __p != __end_; ++__p)
3236
template <class _Tp>
3237
inline _LIBCPP_INLINE_VISIBILITY
3239
valarray<_Tp>::operator^=(const value_type& __x)
3241
for (value_type* __p = __begin_; __p != __end_; ++__p)
3246
template <class _Tp>
3247
inline _LIBCPP_INLINE_VISIBILITY
3249
valarray<_Tp>::operator&=(const value_type& __x)
3251
for (value_type* __p = __begin_; __p != __end_; ++__p)
3256
template <class _Tp>
3257
inline _LIBCPP_INLINE_VISIBILITY
3259
valarray<_Tp>::operator|=(const value_type& __x)
3261
for (value_type* __p = __begin_; __p != __end_; ++__p)
3266
template <class _Tp>
3267
inline _LIBCPP_INLINE_VISIBILITY
3269
valarray<_Tp>::operator<<=(const value_type& __x)
3271
for (value_type* __p = __begin_; __p != __end_; ++__p)
3276
template <class _Tp>
3277
inline _LIBCPP_INLINE_VISIBILITY
3279
valarray<_Tp>::operator>>=(const value_type& __x)
3281
for (value_type* __p = __begin_; __p != __end_; ++__p)
3286
template <class _Tp>
3287
template <class _Expr>
3288
inline _LIBCPP_INLINE_VISIBILITY
3291
__is_val_expr<_Expr>::value,
3294
valarray<_Tp>::operator*=(const _Expr& __v)
3297
for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3302
template <class _Tp>
3303
template <class _Expr>
3304
inline _LIBCPP_INLINE_VISIBILITY
3307
__is_val_expr<_Expr>::value,
3310
valarray<_Tp>::operator/=(const _Expr& __v)
3313
for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3318
template <class _Tp>
3319
template <class _Expr>
3320
inline _LIBCPP_INLINE_VISIBILITY
3323
__is_val_expr<_Expr>::value,
3326
valarray<_Tp>::operator%=(const _Expr& __v)
3329
for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3334
template <class _Tp>
3335
template <class _Expr>
3336
inline _LIBCPP_INLINE_VISIBILITY
3339
__is_val_expr<_Expr>::value,
3342
valarray<_Tp>::operator+=(const _Expr& __v)
3345
for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3350
template <class _Tp>
3351
template <class _Expr>
3352
inline _LIBCPP_INLINE_VISIBILITY
3355
__is_val_expr<_Expr>::value,
3358
valarray<_Tp>::operator-=(const _Expr& __v)
3361
for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3366
template <class _Tp>
3367
template <class _Expr>
3368
inline _LIBCPP_INLINE_VISIBILITY
3371
__is_val_expr<_Expr>::value,
3374
valarray<_Tp>::operator^=(const _Expr& __v)
3377
for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3382
template <class _Tp>
3383
template <class _Expr>
3384
inline _LIBCPP_INLINE_VISIBILITY
3387
__is_val_expr<_Expr>::value,
3390
valarray<_Tp>::operator|=(const _Expr& __v)
3393
for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3398
template <class _Tp>
3399
template <class _Expr>
3400
inline _LIBCPP_INLINE_VISIBILITY
3403
__is_val_expr<_Expr>::value,
3406
valarray<_Tp>::operator&=(const _Expr& __v)
3409
for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3414
template <class _Tp>
3415
template <class _Expr>
3416
inline _LIBCPP_INLINE_VISIBILITY
3419
__is_val_expr<_Expr>::value,
3422
valarray<_Tp>::operator<<=(const _Expr& __v)
3425
for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3430
template <class _Tp>
3431
template <class _Expr>
3432
inline _LIBCPP_INLINE_VISIBILITY
3435
__is_val_expr<_Expr>::value,
3438
valarray<_Tp>::operator>>=(const _Expr& __v)
3441
for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
3446
template <class _Tp>
3447
inline _LIBCPP_INLINE_VISIBILITY
3449
valarray<_Tp>::swap(valarray& __v)
3451
_VSTD::swap(__begin_, __v.__begin_);
3452
_VSTD::swap(__end_, __v.__end_);
3455
template <class _Tp>
3456
inline _LIBCPP_INLINE_VISIBILITY
3458
valarray<_Tp>::sum() const
3460
if (__begin_ == __end_)
3461
return value_type();
3462
const value_type* __p = __begin_;
3464
for (++__p; __p != __end_; ++__p)
3469
template <class _Tp>
3470
inline _LIBCPP_INLINE_VISIBILITY
3472
valarray<_Tp>::min() const
3474
if (__begin_ == __end_)
3475
return value_type();
3476
return *_VSTD::min_element(__begin_, __end_);
3479
template <class _Tp>
3480
inline _LIBCPP_INLINE_VISIBILITY
3482
valarray<_Tp>::max() const
3484
if (__begin_ == __end_)
3485
return value_type();
3486
return *_VSTD::max_element(__begin_, __end_);
3489
template <class _Tp>
3491
valarray<_Tp>::shift(int __i) const
3493
valarray<value_type> __r;
3494
size_t __n = size();
3499
static_cast<value_type*>(::operator new(__n * sizeof(value_type)));
3500
const value_type* __sb;
3505
__i = _VSTD::min(__i, static_cast<int>(__n));
3506
__sb = __begin_ + __i;
3507
__tb = __r.__begin_;
3508
__te = __r.__begin_ + (__n - __i);
3512
__i = _VSTD::min(-__i, static_cast<int>(__n));
3514
__tb = __r.__begin_ + __i;
3515
__te = __r.__begin_ + __n;
3517
for (; __r.__end_ != __tb; ++__r.__end_)
3518
::new (__r.__end_) value_type();
3519
for (; __r.__end_ != __te; ++__r.__end_, ++__sb)
3520
::new (__r.__end_) value_type(*__sb);
3521
for (__te = __r.__begin_ + __n; __r.__end_ != __te; ++__r.__end_)
3522
::new (__r.__end_) value_type();
3527
template <class _Tp>
3529
valarray<_Tp>::cshift(int __i) const
3531
valarray<value_type> __r;
3532
size_t __n = size();
3537
static_cast<value_type*>(::operator new(__n * sizeof(value_type)));
3538
__i %= static_cast<int>(__n);
3539
const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i;
3540
for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s)
3541
::new (__r.__end_) value_type(*__s);
3542
for (const value_type* __s = __begin_; __s != __m; ++__r.__end_, ++__s)
3543
::new (__r.__end_) value_type(*__s);
3548
template <class _Tp>
3550
valarray<_Tp>::apply(value_type __f(value_type)) const
3552
valarray<value_type> __r;
3553
size_t __n = size();
3558
static_cast<value_type*>(::operator new(__n * sizeof(value_type)));
3559
for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3560
::new (__r.__end_) value_type(__f(*__p));
3565
template <class _Tp>
3567
valarray<_Tp>::apply(value_type __f(const value_type&)) const
3569
valarray<value_type> __r;
3570
size_t __n = size();
3575
static_cast<value_type*>(::operator new(__n * sizeof(value_type)));
3576
for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3577
::new (__r.__end_) value_type(__f(*__p));
3582
template <class _Tp>
3584
valarray<_Tp>::resize(size_t __n, value_type __x)
3586
if (__begin_ != nullptr)
3588
while (__end_ != __begin_)
3589
(--__end_)->~value_type();
3590
::operator delete(__begin_);
3591
__begin_ = __end_ = nullptr;
3595
__begin_ = __end_ = static_cast<value_type*>(::operator new(__n * sizeof(value_type)));
3596
#ifndef _LIBCPP_NO_EXCEPTIONS
3599
#endif // _LIBCPP_NO_EXCEPTIONS
3600
for (; __n; --__n, ++__end_)
3601
::new (__end_) value_type(__x);
3602
#ifndef _LIBCPP_NO_EXCEPTIONS
3609
#endif // _LIBCPP_NO_EXCEPTIONS
3614
inline _LIBCPP_INLINE_VISIBILITY
3616
swap(valarray<_Tp>& __x, valarray<_Tp>& __y)
3621
template<class _Expr1, class _Expr2>
3622
inline _LIBCPP_INLINE_VISIBILITY
3625
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3626
__val_expr<_BinaryOp<multiplies<typename _Expr1::value_type>, _Expr1, _Expr2> >
3628
operator*(const _Expr1& __x, const _Expr2& __y)
3630
typedef typename _Expr1::value_type value_type;
3631
typedef _BinaryOp<multiplies<value_type>, _Expr1, _Expr2> _Op;
3632
return __val_expr<_Op>(_Op(multiplies<value_type>(), __x, __y));
3635
template<class _Expr>
3636
inline _LIBCPP_INLINE_VISIBILITY
3639
__is_val_expr<_Expr>::value,
3640
__val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
3641
_Expr, __scalar_expr<typename _Expr::value_type> > >
3643
operator*(const _Expr& __x, const typename _Expr::value_type& __y)
3645
typedef typename _Expr::value_type value_type;
3646
typedef _BinaryOp<multiplies<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3647
return __val_expr<_Op>(_Op(multiplies<value_type>(),
3648
__x, __scalar_expr<value_type>(__y, __x.size())));
3651
template<class _Expr>
3652
inline _LIBCPP_INLINE_VISIBILITY
3655
__is_val_expr<_Expr>::value,
3656
__val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
3657
__scalar_expr<typename _Expr::value_type>, _Expr> >
3659
operator*(const typename _Expr::value_type& __x, const _Expr& __y)
3661
typedef typename _Expr::value_type value_type;
3662
typedef _BinaryOp<multiplies<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3663
return __val_expr<_Op>(_Op(multiplies<value_type>(),
3664
__scalar_expr<value_type>(__x, __y.size()), __y));
3667
template<class _Expr1, class _Expr2>
3668
inline _LIBCPP_INLINE_VISIBILITY
3671
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3672
__val_expr<_BinaryOp<divides<typename _Expr1::value_type>, _Expr1, _Expr2> >
3674
operator/(const _Expr1& __x, const _Expr2& __y)
3676
typedef typename _Expr1::value_type value_type;
3677
typedef _BinaryOp<divides<value_type>, _Expr1, _Expr2> _Op;
3678
return __val_expr<_Op>(_Op(divides<value_type>(), __x, __y));
3681
template<class _Expr>
3682
inline _LIBCPP_INLINE_VISIBILITY
3685
__is_val_expr<_Expr>::value,
3686
__val_expr<_BinaryOp<divides<typename _Expr::value_type>,
3687
_Expr, __scalar_expr<typename _Expr::value_type> > >
3689
operator/(const _Expr& __x, const typename _Expr::value_type& __y)
3691
typedef typename _Expr::value_type value_type;
3692
typedef _BinaryOp<divides<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3693
return __val_expr<_Op>(_Op(divides<value_type>(),
3694
__x, __scalar_expr<value_type>(__y, __x.size())));
3697
template<class _Expr>
3698
inline _LIBCPP_INLINE_VISIBILITY
3701
__is_val_expr<_Expr>::value,
3702
__val_expr<_BinaryOp<divides<typename _Expr::value_type>,
3703
__scalar_expr<typename _Expr::value_type>, _Expr> >
3705
operator/(const typename _Expr::value_type& __x, const _Expr& __y)
3707
typedef typename _Expr::value_type value_type;
3708
typedef _BinaryOp<divides<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3709
return __val_expr<_Op>(_Op(divides<value_type>(),
3710
__scalar_expr<value_type>(__x, __y.size()), __y));
3713
template<class _Expr1, class _Expr2>
3714
inline _LIBCPP_INLINE_VISIBILITY
3717
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3718
__val_expr<_BinaryOp<modulus<typename _Expr1::value_type>, _Expr1, _Expr2> >
3720
operator%(const _Expr1& __x, const _Expr2& __y)
3722
typedef typename _Expr1::value_type value_type;
3723
typedef _BinaryOp<modulus<value_type>, _Expr1, _Expr2> _Op;
3724
return __val_expr<_Op>(_Op(modulus<value_type>(), __x, __y));
3727
template<class _Expr>
3728
inline _LIBCPP_INLINE_VISIBILITY
3731
__is_val_expr<_Expr>::value,
3732
__val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
3733
_Expr, __scalar_expr<typename _Expr::value_type> > >
3735
operator%(const _Expr& __x, const typename _Expr::value_type& __y)
3737
typedef typename _Expr::value_type value_type;
3738
typedef _BinaryOp<modulus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3739
return __val_expr<_Op>(_Op(modulus<value_type>(),
3740
__x, __scalar_expr<value_type>(__y, __x.size())));
3743
template<class _Expr>
3744
inline _LIBCPP_INLINE_VISIBILITY
3747
__is_val_expr<_Expr>::value,
3748
__val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
3749
__scalar_expr<typename _Expr::value_type>, _Expr> >
3751
operator%(const typename _Expr::value_type& __x, const _Expr& __y)
3753
typedef typename _Expr::value_type value_type;
3754
typedef _BinaryOp<modulus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3755
return __val_expr<_Op>(_Op(modulus<value_type>(),
3756
__scalar_expr<value_type>(__x, __y.size()), __y));
3759
template<class _Expr1, class _Expr2>
3760
inline _LIBCPP_INLINE_VISIBILITY
3763
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3764
__val_expr<_BinaryOp<plus<typename _Expr1::value_type>, _Expr1, _Expr2> >
3766
operator+(const _Expr1& __x, const _Expr2& __y)
3768
typedef typename _Expr1::value_type value_type;
3769
typedef _BinaryOp<plus<value_type>, _Expr1, _Expr2> _Op;
3770
return __val_expr<_Op>(_Op(plus<value_type>(), __x, __y));
3773
template<class _Expr>
3774
inline _LIBCPP_INLINE_VISIBILITY
3777
__is_val_expr<_Expr>::value,
3778
__val_expr<_BinaryOp<plus<typename _Expr::value_type>,
3779
_Expr, __scalar_expr<typename _Expr::value_type> > >
3781
operator+(const _Expr& __x, const typename _Expr::value_type& __y)
3783
typedef typename _Expr::value_type value_type;
3784
typedef _BinaryOp<plus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3785
return __val_expr<_Op>(_Op(plus<value_type>(),
3786
__x, __scalar_expr<value_type>(__y, __x.size())));
3789
template<class _Expr>
3790
inline _LIBCPP_INLINE_VISIBILITY
3793
__is_val_expr<_Expr>::value,
3794
__val_expr<_BinaryOp<plus<typename _Expr::value_type>,
3795
__scalar_expr<typename _Expr::value_type>, _Expr> >
3797
operator+(const typename _Expr::value_type& __x, const _Expr& __y)
3799
typedef typename _Expr::value_type value_type;
3800
typedef _BinaryOp<plus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3801
return __val_expr<_Op>(_Op(plus<value_type>(),
3802
__scalar_expr<value_type>(__x, __y.size()), __y));
3805
template<class _Expr1, class _Expr2>
3806
inline _LIBCPP_INLINE_VISIBILITY
3809
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3810
__val_expr<_BinaryOp<minus<typename _Expr1::value_type>, _Expr1, _Expr2> >
3812
operator-(const _Expr1& __x, const _Expr2& __y)
3814
typedef typename _Expr1::value_type value_type;
3815
typedef _BinaryOp<minus<value_type>, _Expr1, _Expr2> _Op;
3816
return __val_expr<_Op>(_Op(minus<value_type>(), __x, __y));
3819
template<class _Expr>
3820
inline _LIBCPP_INLINE_VISIBILITY
3823
__is_val_expr<_Expr>::value,
3824
__val_expr<_BinaryOp<minus<typename _Expr::value_type>,
3825
_Expr, __scalar_expr<typename _Expr::value_type> > >
3827
operator-(const _Expr& __x, const typename _Expr::value_type& __y)
3829
typedef typename _Expr::value_type value_type;
3830
typedef _BinaryOp<minus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3831
return __val_expr<_Op>(_Op(minus<value_type>(),
3832
__x, __scalar_expr<value_type>(__y, __x.size())));
3835
template<class _Expr>
3836
inline _LIBCPP_INLINE_VISIBILITY
3839
__is_val_expr<_Expr>::value,
3840
__val_expr<_BinaryOp<minus<typename _Expr::value_type>,
3841
__scalar_expr<typename _Expr::value_type>, _Expr> >
3843
operator-(const typename _Expr::value_type& __x, const _Expr& __y)
3845
typedef typename _Expr::value_type value_type;
3846
typedef _BinaryOp<minus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3847
return __val_expr<_Op>(_Op(minus<value_type>(),
3848
__scalar_expr<value_type>(__x, __y.size()), __y));
3851
template<class _Expr1, class _Expr2>
3852
inline _LIBCPP_INLINE_VISIBILITY
3855
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3856
__val_expr<_BinaryOp<bit_xor<typename _Expr1::value_type>, _Expr1, _Expr2> >
3858
operator^(const _Expr1& __x, const _Expr2& __y)
3860
typedef typename _Expr1::value_type value_type;
3861
typedef _BinaryOp<bit_xor<value_type>, _Expr1, _Expr2> _Op;
3862
return __val_expr<_Op>(_Op(bit_xor<value_type>(), __x, __y));
3865
template<class _Expr>
3866
inline _LIBCPP_INLINE_VISIBILITY
3869
__is_val_expr<_Expr>::value,
3870
__val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
3871
_Expr, __scalar_expr<typename _Expr::value_type> > >
3873
operator^(const _Expr& __x, const typename _Expr::value_type& __y)
3875
typedef typename _Expr::value_type value_type;
3876
typedef _BinaryOp<bit_xor<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3877
return __val_expr<_Op>(_Op(bit_xor<value_type>(),
3878
__x, __scalar_expr<value_type>(__y, __x.size())));
3881
template<class _Expr>
3882
inline _LIBCPP_INLINE_VISIBILITY
3885
__is_val_expr<_Expr>::value,
3886
__val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
3887
__scalar_expr<typename _Expr::value_type>, _Expr> >
3889
operator^(const typename _Expr::value_type& __x, const _Expr& __y)
3891
typedef typename _Expr::value_type value_type;
3892
typedef _BinaryOp<bit_xor<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3893
return __val_expr<_Op>(_Op(bit_xor<value_type>(),
3894
__scalar_expr<value_type>(__x, __y.size()), __y));
3897
template<class _Expr1, class _Expr2>
3898
inline _LIBCPP_INLINE_VISIBILITY
3901
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3902
__val_expr<_BinaryOp<bit_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
3904
operator&(const _Expr1& __x, const _Expr2& __y)
3906
typedef typename _Expr1::value_type value_type;
3907
typedef _BinaryOp<bit_and<value_type>, _Expr1, _Expr2> _Op;
3908
return __val_expr<_Op>(_Op(bit_and<value_type>(), __x, __y));
3911
template<class _Expr>
3912
inline _LIBCPP_INLINE_VISIBILITY
3915
__is_val_expr<_Expr>::value,
3916
__val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
3917
_Expr, __scalar_expr<typename _Expr::value_type> > >
3919
operator&(const _Expr& __x, const typename _Expr::value_type& __y)
3921
typedef typename _Expr::value_type value_type;
3922
typedef _BinaryOp<bit_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3923
return __val_expr<_Op>(_Op(bit_and<value_type>(),
3924
__x, __scalar_expr<value_type>(__y, __x.size())));
3927
template<class _Expr>
3928
inline _LIBCPP_INLINE_VISIBILITY
3931
__is_val_expr<_Expr>::value,
3932
__val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
3933
__scalar_expr<typename _Expr::value_type>, _Expr> >
3935
operator&(const typename _Expr::value_type& __x, const _Expr& __y)
3937
typedef typename _Expr::value_type value_type;
3938
typedef _BinaryOp<bit_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3939
return __val_expr<_Op>(_Op(bit_and<value_type>(),
3940
__scalar_expr<value_type>(__x, __y.size()), __y));
3943
template<class _Expr1, class _Expr2>
3944
inline _LIBCPP_INLINE_VISIBILITY
3947
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3948
__val_expr<_BinaryOp<bit_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
3950
operator|(const _Expr1& __x, const _Expr2& __y)
3952
typedef typename _Expr1::value_type value_type;
3953
typedef _BinaryOp<bit_or<value_type>, _Expr1, _Expr2> _Op;
3954
return __val_expr<_Op>(_Op(bit_or<value_type>(), __x, __y));
3957
template<class _Expr>
3958
inline _LIBCPP_INLINE_VISIBILITY
3961
__is_val_expr<_Expr>::value,
3962
__val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
3963
_Expr, __scalar_expr<typename _Expr::value_type> > >
3965
operator|(const _Expr& __x, const typename _Expr::value_type& __y)
3967
typedef typename _Expr::value_type value_type;
3968
typedef _BinaryOp<bit_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
3969
return __val_expr<_Op>(_Op(bit_or<value_type>(),
3970
__x, __scalar_expr<value_type>(__y, __x.size())));
3973
template<class _Expr>
3974
inline _LIBCPP_INLINE_VISIBILITY
3977
__is_val_expr<_Expr>::value,
3978
__val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
3979
__scalar_expr<typename _Expr::value_type>, _Expr> >
3981
operator|(const typename _Expr::value_type& __x, const _Expr& __y)
3983
typedef typename _Expr::value_type value_type;
3984
typedef _BinaryOp<bit_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
3985
return __val_expr<_Op>(_Op(bit_or<value_type>(),
3986
__scalar_expr<value_type>(__x, __y.size()), __y));
3989
template<class _Expr1, class _Expr2>
3990
inline _LIBCPP_INLINE_VISIBILITY
3993
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
3994
__val_expr<_BinaryOp<__bit_shift_left<typename _Expr1::value_type>, _Expr1, _Expr2> >
3996
operator<<(const _Expr1& __x, const _Expr2& __y)
3998
typedef typename _Expr1::value_type value_type;
3999
typedef _BinaryOp<__bit_shift_left<value_type>, _Expr1, _Expr2> _Op;
4000
return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), __x, __y));
4003
template<class _Expr>
4004
inline _LIBCPP_INLINE_VISIBILITY
4007
__is_val_expr<_Expr>::value,
4008
__val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
4009
_Expr, __scalar_expr<typename _Expr::value_type> > >
4011
operator<<(const _Expr& __x, const typename _Expr::value_type& __y)
4013
typedef typename _Expr::value_type value_type;
4014
typedef _BinaryOp<__bit_shift_left<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4015
return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
4016
__x, __scalar_expr<value_type>(__y, __x.size())));
4019
template<class _Expr>
4020
inline _LIBCPP_INLINE_VISIBILITY
4023
__is_val_expr<_Expr>::value,
4024
__val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
4025
__scalar_expr<typename _Expr::value_type>, _Expr> >
4027
operator<<(const typename _Expr::value_type& __x, const _Expr& __y)
4029
typedef typename _Expr::value_type value_type;
4030
typedef _BinaryOp<__bit_shift_left<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4031
return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
4032
__scalar_expr<value_type>(__x, __y.size()), __y));
4035
template<class _Expr1, class _Expr2>
4036
inline _LIBCPP_INLINE_VISIBILITY
4039
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4040
__val_expr<_BinaryOp<__bit_shift_right<typename _Expr1::value_type>, _Expr1, _Expr2> >
4042
operator>>(const _Expr1& __x, const _Expr2& __y)
4044
typedef typename _Expr1::value_type value_type;
4045
typedef _BinaryOp<__bit_shift_right<value_type>, _Expr1, _Expr2> _Op;
4046
return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), __x, __y));
4049
template<class _Expr>
4050
inline _LIBCPP_INLINE_VISIBILITY
4053
__is_val_expr<_Expr>::value,
4054
__val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
4055
_Expr, __scalar_expr<typename _Expr::value_type> > >
4057
operator>>(const _Expr& __x, const typename _Expr::value_type& __y)
4059
typedef typename _Expr::value_type value_type;
4060
typedef _BinaryOp<__bit_shift_right<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4061
return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
4062
__x, __scalar_expr<value_type>(__y, __x.size())));
4065
template<class _Expr>
4066
inline _LIBCPP_INLINE_VISIBILITY
4069
__is_val_expr<_Expr>::value,
4070
__val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
4071
__scalar_expr<typename _Expr::value_type>, _Expr> >
4073
operator>>(const typename _Expr::value_type& __x, const _Expr& __y)
4075
typedef typename _Expr::value_type value_type;
4076
typedef _BinaryOp<__bit_shift_right<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4077
return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
4078
__scalar_expr<value_type>(__x, __y.size()), __y));
4081
template<class _Expr1, class _Expr2>
4082
inline _LIBCPP_INLINE_VISIBILITY
4085
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4086
__val_expr<_BinaryOp<logical_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
4088
operator&&(const _Expr1& __x, const _Expr2& __y)
4090
typedef typename _Expr1::value_type value_type;
4091
typedef _BinaryOp<logical_and<value_type>, _Expr1, _Expr2> _Op;
4092
return __val_expr<_Op>(_Op(logical_and<value_type>(), __x, __y));
4095
template<class _Expr>
4096
inline _LIBCPP_INLINE_VISIBILITY
4099
__is_val_expr<_Expr>::value,
4100
__val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
4101
_Expr, __scalar_expr<typename _Expr::value_type> > >
4103
operator&&(const _Expr& __x, const typename _Expr::value_type& __y)
4105
typedef typename _Expr::value_type value_type;
4106
typedef _BinaryOp<logical_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4107
return __val_expr<_Op>(_Op(logical_and<value_type>(),
4108
__x, __scalar_expr<value_type>(__y, __x.size())));
4111
template<class _Expr>
4112
inline _LIBCPP_INLINE_VISIBILITY
4115
__is_val_expr<_Expr>::value,
4116
__val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
4117
__scalar_expr<typename _Expr::value_type>, _Expr> >
4119
operator&&(const typename _Expr::value_type& __x, const _Expr& __y)
4121
typedef typename _Expr::value_type value_type;
4122
typedef _BinaryOp<logical_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4123
return __val_expr<_Op>(_Op(logical_and<value_type>(),
4124
__scalar_expr<value_type>(__x, __y.size()), __y));
4127
template<class _Expr1, class _Expr2>
4128
inline _LIBCPP_INLINE_VISIBILITY
4131
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4132
__val_expr<_BinaryOp<logical_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
4134
operator||(const _Expr1& __x, const _Expr2& __y)
4136
typedef typename _Expr1::value_type value_type;
4137
typedef _BinaryOp<logical_or<value_type>, _Expr1, _Expr2> _Op;
4138
return __val_expr<_Op>(_Op(logical_or<value_type>(), __x, __y));
4141
template<class _Expr>
4142
inline _LIBCPP_INLINE_VISIBILITY
4145
__is_val_expr<_Expr>::value,
4146
__val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
4147
_Expr, __scalar_expr<typename _Expr::value_type> > >
4149
operator||(const _Expr& __x, const typename _Expr::value_type& __y)
4151
typedef typename _Expr::value_type value_type;
4152
typedef _BinaryOp<logical_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4153
return __val_expr<_Op>(_Op(logical_or<value_type>(),
4154
__x, __scalar_expr<value_type>(__y, __x.size())));
4157
template<class _Expr>
4158
inline _LIBCPP_INLINE_VISIBILITY
4161
__is_val_expr<_Expr>::value,
4162
__val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
4163
__scalar_expr<typename _Expr::value_type>, _Expr> >
4165
operator||(const typename _Expr::value_type& __x, const _Expr& __y)
4167
typedef typename _Expr::value_type value_type;
4168
typedef _BinaryOp<logical_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4169
return __val_expr<_Op>(_Op(logical_or<value_type>(),
4170
__scalar_expr<value_type>(__x, __y.size()), __y));
4173
template<class _Expr1, class _Expr2>
4174
inline _LIBCPP_INLINE_VISIBILITY
4177
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4178
__val_expr<_BinaryOp<equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
4180
operator==(const _Expr1& __x, const _Expr2& __y)
4182
typedef typename _Expr1::value_type value_type;
4183
typedef _BinaryOp<equal_to<value_type>, _Expr1, _Expr2> _Op;
4184
return __val_expr<_Op>(_Op(equal_to<value_type>(), __x, __y));
4187
template<class _Expr>
4188
inline _LIBCPP_INLINE_VISIBILITY
4191
__is_val_expr<_Expr>::value,
4192
__val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
4193
_Expr, __scalar_expr<typename _Expr::value_type> > >
4195
operator==(const _Expr& __x, const typename _Expr::value_type& __y)
4197
typedef typename _Expr::value_type value_type;
4198
typedef _BinaryOp<equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4199
return __val_expr<_Op>(_Op(equal_to<value_type>(),
4200
__x, __scalar_expr<value_type>(__y, __x.size())));
4203
template<class _Expr>
4204
inline _LIBCPP_INLINE_VISIBILITY
4207
__is_val_expr<_Expr>::value,
4208
__val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
4209
__scalar_expr<typename _Expr::value_type>, _Expr> >
4211
operator==(const typename _Expr::value_type& __x, const _Expr& __y)
4213
typedef typename _Expr::value_type value_type;
4214
typedef _BinaryOp<equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4215
return __val_expr<_Op>(_Op(equal_to<value_type>(),
4216
__scalar_expr<value_type>(__x, __y.size()), __y));
4219
template<class _Expr1, class _Expr2>
4220
inline _LIBCPP_INLINE_VISIBILITY
4223
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4224
__val_expr<_BinaryOp<not_equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
4226
operator!=(const _Expr1& __x, const _Expr2& __y)
4228
typedef typename _Expr1::value_type value_type;
4229
typedef _BinaryOp<not_equal_to<value_type>, _Expr1, _Expr2> _Op;
4230
return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __x, __y));
4233
template<class _Expr>
4234
inline _LIBCPP_INLINE_VISIBILITY
4237
__is_val_expr<_Expr>::value,
4238
__val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
4239
_Expr, __scalar_expr<typename _Expr::value_type> > >
4241
operator!=(const _Expr& __x, const typename _Expr::value_type& __y)
4243
typedef typename _Expr::value_type value_type;
4244
typedef _BinaryOp<not_equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4245
return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
4246
__x, __scalar_expr<value_type>(__y, __x.size())));
4249
template<class _Expr>
4250
inline _LIBCPP_INLINE_VISIBILITY
4253
__is_val_expr<_Expr>::value,
4254
__val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
4255
__scalar_expr<typename _Expr::value_type>, _Expr> >
4257
operator!=(const typename _Expr::value_type& __x, const _Expr& __y)
4259
typedef typename _Expr::value_type value_type;
4260
typedef _BinaryOp<not_equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4261
return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
4262
__scalar_expr<value_type>(__x, __y.size()), __y));
4265
template<class _Expr1, class _Expr2>
4266
inline _LIBCPP_INLINE_VISIBILITY
4269
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4270
__val_expr<_BinaryOp<less<typename _Expr1::value_type>, _Expr1, _Expr2> >
4272
operator<(const _Expr1& __x, const _Expr2& __y)
4274
typedef typename _Expr1::value_type value_type;
4275
typedef _BinaryOp<less<value_type>, _Expr1, _Expr2> _Op;
4276
return __val_expr<_Op>(_Op(less<value_type>(), __x, __y));
4279
template<class _Expr>
4280
inline _LIBCPP_INLINE_VISIBILITY
4283
__is_val_expr<_Expr>::value,
4284
__val_expr<_BinaryOp<less<typename _Expr::value_type>,
4285
_Expr, __scalar_expr<typename _Expr::value_type> > >
4287
operator<(const _Expr& __x, const typename _Expr::value_type& __y)
4289
typedef typename _Expr::value_type value_type;
4290
typedef _BinaryOp<less<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4291
return __val_expr<_Op>(_Op(less<value_type>(),
4292
__x, __scalar_expr<value_type>(__y, __x.size())));
4295
template<class _Expr>
4296
inline _LIBCPP_INLINE_VISIBILITY
4299
__is_val_expr<_Expr>::value,
4300
__val_expr<_BinaryOp<less<typename _Expr::value_type>,
4301
__scalar_expr<typename _Expr::value_type>, _Expr> >
4303
operator<(const typename _Expr::value_type& __x, const _Expr& __y)
4305
typedef typename _Expr::value_type value_type;
4306
typedef _BinaryOp<less<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4307
return __val_expr<_Op>(_Op(less<value_type>(),
4308
__scalar_expr<value_type>(__x, __y.size()), __y));
4311
template<class _Expr1, class _Expr2>
4312
inline _LIBCPP_INLINE_VISIBILITY
4315
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4316
__val_expr<_BinaryOp<greater<typename _Expr1::value_type>, _Expr1, _Expr2> >
4318
operator>(const _Expr1& __x, const _Expr2& __y)
4320
typedef typename _Expr1::value_type value_type;
4321
typedef _BinaryOp<greater<value_type>, _Expr1, _Expr2> _Op;
4322
return __val_expr<_Op>(_Op(greater<value_type>(), __x, __y));
4325
template<class _Expr>
4326
inline _LIBCPP_INLINE_VISIBILITY
4329
__is_val_expr<_Expr>::value,
4330
__val_expr<_BinaryOp<greater<typename _Expr::value_type>,
4331
_Expr, __scalar_expr<typename _Expr::value_type> > >
4333
operator>(const _Expr& __x, const typename _Expr::value_type& __y)
4335
typedef typename _Expr::value_type value_type;
4336
typedef _BinaryOp<greater<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4337
return __val_expr<_Op>(_Op(greater<value_type>(),
4338
__x, __scalar_expr<value_type>(__y, __x.size())));
4341
template<class _Expr>
4342
inline _LIBCPP_INLINE_VISIBILITY
4345
__is_val_expr<_Expr>::value,
4346
__val_expr<_BinaryOp<greater<typename _Expr::value_type>,
4347
__scalar_expr<typename _Expr::value_type>, _Expr> >
4349
operator>(const typename _Expr::value_type& __x, const _Expr& __y)
4351
typedef typename _Expr::value_type value_type;
4352
typedef _BinaryOp<greater<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4353
return __val_expr<_Op>(_Op(greater<value_type>(),
4354
__scalar_expr<value_type>(__x, __y.size()), __y));
4357
template<class _Expr1, class _Expr2>
4358
inline _LIBCPP_INLINE_VISIBILITY
4361
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4362
__val_expr<_BinaryOp<less_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
4364
operator<=(const _Expr1& __x, const _Expr2& __y)
4366
typedef typename _Expr1::value_type value_type;
4367
typedef _BinaryOp<less_equal<value_type>, _Expr1, _Expr2> _Op;
4368
return __val_expr<_Op>(_Op(less_equal<value_type>(), __x, __y));
4371
template<class _Expr>
4372
inline _LIBCPP_INLINE_VISIBILITY
4375
__is_val_expr<_Expr>::value,
4376
__val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
4377
_Expr, __scalar_expr<typename _Expr::value_type> > >
4379
operator<=(const _Expr& __x, const typename _Expr::value_type& __y)
4381
typedef typename _Expr::value_type value_type;
4382
typedef _BinaryOp<less_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4383
return __val_expr<_Op>(_Op(less_equal<value_type>(),
4384
__x, __scalar_expr<value_type>(__y, __x.size())));
4387
template<class _Expr>
4388
inline _LIBCPP_INLINE_VISIBILITY
4391
__is_val_expr<_Expr>::value,
4392
__val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
4393
__scalar_expr<typename _Expr::value_type>, _Expr> >
4395
operator<=(const typename _Expr::value_type& __x, const _Expr& __y)
4397
typedef typename _Expr::value_type value_type;
4398
typedef _BinaryOp<less_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4399
return __val_expr<_Op>(_Op(less_equal<value_type>(),
4400
__scalar_expr<value_type>(__x, __y.size()), __y));
4403
template<class _Expr1, class _Expr2>
4404
inline _LIBCPP_INLINE_VISIBILITY
4407
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4408
__val_expr<_BinaryOp<greater_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
4410
operator>=(const _Expr1& __x, const _Expr2& __y)
4412
typedef typename _Expr1::value_type value_type;
4413
typedef _BinaryOp<greater_equal<value_type>, _Expr1, _Expr2> _Op;
4414
return __val_expr<_Op>(_Op(greater_equal<value_type>(), __x, __y));
4417
template<class _Expr>
4418
inline _LIBCPP_INLINE_VISIBILITY
4421
__is_val_expr<_Expr>::value,
4422
__val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
4423
_Expr, __scalar_expr<typename _Expr::value_type> > >
4425
operator>=(const _Expr& __x, const typename _Expr::value_type& __y)
4427
typedef typename _Expr::value_type value_type;
4428
typedef _BinaryOp<greater_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4429
return __val_expr<_Op>(_Op(greater_equal<value_type>(),
4430
__x, __scalar_expr<value_type>(__y, __x.size())));
4433
template<class _Expr>
4434
inline _LIBCPP_INLINE_VISIBILITY
4437
__is_val_expr<_Expr>::value,
4438
__val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
4439
__scalar_expr<typename _Expr::value_type>, _Expr> >
4441
operator>=(const typename _Expr::value_type& __x, const _Expr& __y)
4443
typedef typename _Expr::value_type value_type;
4444
typedef _BinaryOp<greater_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4445
return __val_expr<_Op>(_Op(greater_equal<value_type>(),
4446
__scalar_expr<value_type>(__x, __y.size()), __y));
4449
template<class _Expr>
4450
inline _LIBCPP_INLINE_VISIBILITY
4453
__is_val_expr<_Expr>::value,
4454
__val_expr<_UnaryOp<__abs_expr<typename _Expr::value_type>, _Expr> >
4456
abs(const _Expr& __x)
4458
typedef typename _Expr::value_type value_type;
4459
typedef _UnaryOp<__abs_expr<value_type>, _Expr> _Op;
4460
return __val_expr<_Op>(_Op(__abs_expr<value_type>(), __x));
4463
template<class _Expr>
4464
inline _LIBCPP_INLINE_VISIBILITY
4467
__is_val_expr<_Expr>::value,
4468
__val_expr<_UnaryOp<__acos_expr<typename _Expr::value_type>, _Expr> >
4470
acos(const _Expr& __x)
4472
typedef typename _Expr::value_type value_type;
4473
typedef _UnaryOp<__acos_expr<value_type>, _Expr> _Op;
4474
return __val_expr<_Op>(_Op(__acos_expr<value_type>(), __x));
4477
template<class _Expr>
4478
inline _LIBCPP_INLINE_VISIBILITY
4481
__is_val_expr<_Expr>::value,
4482
__val_expr<_UnaryOp<__asin_expr<typename _Expr::value_type>, _Expr> >
4484
asin(const _Expr& __x)
4486
typedef typename _Expr::value_type value_type;
4487
typedef _UnaryOp<__asin_expr<value_type>, _Expr> _Op;
4488
return __val_expr<_Op>(_Op(__asin_expr<value_type>(), __x));
4491
template<class _Expr>
4492
inline _LIBCPP_INLINE_VISIBILITY
4495
__is_val_expr<_Expr>::value,
4496
__val_expr<_UnaryOp<__atan_expr<typename _Expr::value_type>, _Expr> >
4498
atan(const _Expr& __x)
4500
typedef typename _Expr::value_type value_type;
4501
typedef _UnaryOp<__atan_expr<value_type>, _Expr> _Op;
4502
return __val_expr<_Op>(_Op(__atan_expr<value_type>(), __x));
4505
template<class _Expr1, class _Expr2>
4506
inline _LIBCPP_INLINE_VISIBILITY
4509
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4510
__val_expr<_BinaryOp<__atan2_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
4512
atan2(const _Expr1& __x, const _Expr2& __y)
4514
typedef typename _Expr1::value_type value_type;
4515
typedef _BinaryOp<__atan2_expr<value_type>, _Expr1, _Expr2> _Op;
4516
return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __x, __y));
4519
template<class _Expr>
4520
inline _LIBCPP_INLINE_VISIBILITY
4523
__is_val_expr<_Expr>::value,
4524
__val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
4525
_Expr, __scalar_expr<typename _Expr::value_type> > >
4527
atan2(const _Expr& __x, const typename _Expr::value_type& __y)
4529
typedef typename _Expr::value_type value_type;
4530
typedef _BinaryOp<__atan2_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4531
return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
4532
__x, __scalar_expr<value_type>(__y, __x.size())));
4535
template<class _Expr>
4536
inline _LIBCPP_INLINE_VISIBILITY
4539
__is_val_expr<_Expr>::value,
4540
__val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
4541
__scalar_expr<typename _Expr::value_type>, _Expr> >
4543
atan2(const typename _Expr::value_type& __x, const _Expr& __y)
4545
typedef typename _Expr::value_type value_type;
4546
typedef _BinaryOp<__atan2_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4547
return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
4548
__scalar_expr<value_type>(__x, __y.size()), __y));
4551
template<class _Expr>
4552
inline _LIBCPP_INLINE_VISIBILITY
4555
__is_val_expr<_Expr>::value,
4556
__val_expr<_UnaryOp<__cos_expr<typename _Expr::value_type>, _Expr> >
4558
cos(const _Expr& __x)
4560
typedef typename _Expr::value_type value_type;
4561
typedef _UnaryOp<__cos_expr<value_type>, _Expr> _Op;
4562
return __val_expr<_Op>(_Op(__cos_expr<value_type>(), __x));
4565
template<class _Expr>
4566
inline _LIBCPP_INLINE_VISIBILITY
4569
__is_val_expr<_Expr>::value,
4570
__val_expr<_UnaryOp<__cosh_expr<typename _Expr::value_type>, _Expr> >
4572
cosh(const _Expr& __x)
4574
typedef typename _Expr::value_type value_type;
4575
typedef _UnaryOp<__cosh_expr<value_type>, _Expr> _Op;
4576
return __val_expr<_Op>(_Op(__cosh_expr<value_type>(), __x));
4579
template<class _Expr>
4580
inline _LIBCPP_INLINE_VISIBILITY
4583
__is_val_expr<_Expr>::value,
4584
__val_expr<_UnaryOp<__exp_expr<typename _Expr::value_type>, _Expr> >
4586
exp(const _Expr& __x)
4588
typedef typename _Expr::value_type value_type;
4589
typedef _UnaryOp<__exp_expr<value_type>, _Expr> _Op;
4590
return __val_expr<_Op>(_Op(__exp_expr<value_type>(), __x));
4593
template<class _Expr>
4594
inline _LIBCPP_INLINE_VISIBILITY
4597
__is_val_expr<_Expr>::value,
4598
__val_expr<_UnaryOp<__log_expr<typename _Expr::value_type>, _Expr> >
4600
log(const _Expr& __x)
4602
typedef typename _Expr::value_type value_type;
4603
typedef _UnaryOp<__log_expr<value_type>, _Expr> _Op;
4604
return __val_expr<_Op>(_Op(__log_expr<value_type>(), __x));
4607
template<class _Expr>
4608
inline _LIBCPP_INLINE_VISIBILITY
4611
__is_val_expr<_Expr>::value,
4612
__val_expr<_UnaryOp<__log10_expr<typename _Expr::value_type>, _Expr> >
4614
log10(const _Expr& __x)
4616
typedef typename _Expr::value_type value_type;
4617
typedef _UnaryOp<__log10_expr<value_type>, _Expr> _Op;
4618
return __val_expr<_Op>(_Op(__log10_expr<value_type>(), __x));
4621
template<class _Expr1, class _Expr2>
4622
inline _LIBCPP_INLINE_VISIBILITY
4625
__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
4626
__val_expr<_BinaryOp<__pow_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
4628
pow(const _Expr1& __x, const _Expr2& __y)
4630
typedef typename _Expr1::value_type value_type;
4631
typedef _BinaryOp<__pow_expr<value_type>, _Expr1, _Expr2> _Op;
4632
return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __x, __y));
4635
template<class _Expr>
4636
inline _LIBCPP_INLINE_VISIBILITY
4639
__is_val_expr<_Expr>::value,
4640
__val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
4641
_Expr, __scalar_expr<typename _Expr::value_type> > >
4643
pow(const _Expr& __x, const typename _Expr::value_type& __y)
4645
typedef typename _Expr::value_type value_type;
4646
typedef _BinaryOp<__pow_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
4647
return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
4648
__x, __scalar_expr<value_type>(__y, __x.size())));
4651
template<class _Expr>
4652
inline _LIBCPP_INLINE_VISIBILITY
4655
__is_val_expr<_Expr>::value,
4656
__val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
4657
__scalar_expr<typename _Expr::value_type>, _Expr> >
4659
pow(const typename _Expr::value_type& __x, const _Expr& __y)
4661
typedef typename _Expr::value_type value_type;
4662
typedef _BinaryOp<__pow_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
4663
return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
4664
__scalar_expr<value_type>(__x, __y.size()), __y));
4667
template<class _Expr>
4668
inline _LIBCPP_INLINE_VISIBILITY
4671
__is_val_expr<_Expr>::value,
4672
__val_expr<_UnaryOp<__sin_expr<typename _Expr::value_type>, _Expr> >
4674
sin(const _Expr& __x)
4676
typedef typename _Expr::value_type value_type;
4677
typedef _UnaryOp<__sin_expr<value_type>, _Expr> _Op;
4678
return __val_expr<_Op>(_Op(__sin_expr<value_type>(), __x));
4681
template<class _Expr>
4682
inline _LIBCPP_INLINE_VISIBILITY
4685
__is_val_expr<_Expr>::value,
4686
__val_expr<_UnaryOp<__sinh_expr<typename _Expr::value_type>, _Expr> >
4688
sinh(const _Expr& __x)
4690
typedef typename _Expr::value_type value_type;
4691
typedef _UnaryOp<__sinh_expr<value_type>, _Expr> _Op;
4692
return __val_expr<_Op>(_Op(__sinh_expr<value_type>(), __x));
4695
template<class _Expr>
4696
inline _LIBCPP_INLINE_VISIBILITY
4699
__is_val_expr<_Expr>::value,
4700
__val_expr<_UnaryOp<__sqrt_expr<typename _Expr::value_type>, _Expr> >
4702
sqrt(const _Expr& __x)
4704
typedef typename _Expr::value_type value_type;
4705
typedef _UnaryOp<__sqrt_expr<value_type>, _Expr> _Op;
4706
return __val_expr<_Op>(_Op(__sqrt_expr<value_type>(), __x));
4709
template<class _Expr>
4710
inline _LIBCPP_INLINE_VISIBILITY
4713
__is_val_expr<_Expr>::value,
4714
__val_expr<_UnaryOp<__tan_expr<typename _Expr::value_type>, _Expr> >
4716
tan(const _Expr& __x)
4718
typedef typename _Expr::value_type value_type;
4719
typedef _UnaryOp<__tan_expr<value_type>, _Expr> _Op;
4720
return __val_expr<_Op>(_Op(__tan_expr<value_type>(), __x));
4723
template<class _Expr>
4724
inline _LIBCPP_INLINE_VISIBILITY
4727
__is_val_expr<_Expr>::value,
4728
__val_expr<_UnaryOp<__tanh_expr<typename _Expr::value_type>, _Expr> >
4730
tanh(const _Expr& __x)
4732
typedef typename _Expr::value_type value_type;
4733
typedef _UnaryOp<__tanh_expr<value_type>, _Expr> _Op;
4734
return __val_expr<_Op>(_Op(__tanh_expr<value_type>(), __x));
4737
template <class _Tp>
4738
inline _LIBCPP_INLINE_VISIBILITY
4740
begin(valarray<_Tp>& __v)
4742
return __v.__begin_;
4745
template <class _Tp>
4746
inline _LIBCPP_INLINE_VISIBILITY
4748
begin(const valarray<_Tp>& __v)
4750
return __v.__begin_;
4753
template <class _Tp>
4754
inline _LIBCPP_INLINE_VISIBILITY
4756
end(valarray<_Tp>& __v)
4761
template <class _Tp>
4762
inline _LIBCPP_INLINE_VISIBILITY
4764
end(const valarray<_Tp>& __v)
4769
extern template valarray<size_t>::valarray(size_t);
4770
extern template valarray<size_t>::~valarray();
4771
extern template void valarray<size_t>::resize(size_t, size_t);
4773
_LIBCPP_END_NAMESPACE_STD
4775
#endif // _LIBCPP_VALARRAY