valarray revision 227825
1227825Stheraven// -*- C++ -*- 2227825Stheraven//===-------------------------- valarray ----------------------------------===// 3227825Stheraven// 4227825Stheraven// The LLVM Compiler Infrastructure 5227825Stheraven// 6227825Stheraven// This file is dual licensed under the MIT and the University of Illinois Open 7227825Stheraven// Source Licenses. See LICENSE.TXT for details. 8227825Stheraven// 9227825Stheraven//===----------------------------------------------------------------------===// 10227825Stheraven 11227825Stheraven#ifndef _LIBCPP_VALARRAY 12227825Stheraven#define _LIBCPP_VALARRAY 13227825Stheraven 14227825Stheraven/* 15227825Stheraven valarray synopsis 16227825Stheraven 17227825Stheravennamespace std 18227825Stheraven{ 19227825Stheraven 20227825Stheraventemplate<class T> 21227825Stheravenclass valarray 22227825Stheraven{ 23227825Stheravenpublic: 24227825Stheraven typedef T value_type; 25227825Stheraven 26227825Stheraven // construct/destroy: 27227825Stheraven valarray(); 28227825Stheraven explicit valarray(size_t n); 29227825Stheraven valarray(const value_type& x, size_t n); 30227825Stheraven valarray(const value_type* px, size_t n); 31227825Stheraven valarray(const valarray& v); 32227825Stheraven valarray(valarray&& v); 33227825Stheraven valarray(const slice_array<value_type>& sa); 34227825Stheraven valarray(const gslice_array<value_type>& ga); 35227825Stheraven valarray(const mask_array<value_type>& ma); 36227825Stheraven valarray(const indirect_array<value_type>& ia); 37227825Stheraven valarray(initializer_list<value_type> il); 38227825Stheraven ~valarray(); 39227825Stheraven 40227825Stheraven // assignment: 41227825Stheraven valarray& operator=(const valarray& v); 42227825Stheraven valarray& operator=(valarray&& v); 43227825Stheraven valarray& operator=(initializer_list<value_type> il); 44227825Stheraven valarray& operator=(const value_type& x); 45227825Stheraven valarray& operator=(const slice_array<value_type>& sa); 46227825Stheraven valarray& operator=(const gslice_array<value_type>& ga); 47227825Stheraven valarray& operator=(const mask_array<value_type>& ma); 48227825Stheraven valarray& operator=(const indirect_array<value_type>& ia); 49227825Stheraven 50227825Stheraven // element access: 51227825Stheraven const value_type& operator[](size_t i) const; 52227825Stheraven value_type& operator[](size_t i); 53227825Stheraven 54227825Stheraven // subset operations: 55227825Stheraven valarray operator[](slice s) const; 56227825Stheraven slice_array<value_type> operator[](slice s); 57227825Stheraven valarray operator[](const gslice& gs) const; 58227825Stheraven gslice_array<value_type> operator[](const gslice& gs); 59227825Stheraven valarray operator[](const valarray<bool>& vb) const; 60227825Stheraven mask_array<value_type> operator[](const valarray<bool>& vb); 61227825Stheraven valarray operator[](const valarray<size_t>& vs) const; 62227825Stheraven indirect_array<value_type> operator[](const valarray<size_t>& vs); 63227825Stheraven 64227825Stheraven // unary operators: 65227825Stheraven valarray operator+() const; 66227825Stheraven valarray operator-() const; 67227825Stheraven valarray operator~() const; 68227825Stheraven valarray<bool> operator!() const; 69227825Stheraven 70227825Stheraven // computed assignment: 71227825Stheraven valarray& operator*= (const value_type& x); 72227825Stheraven valarray& operator/= (const value_type& x); 73227825Stheraven valarray& operator%= (const value_type& x); 74227825Stheraven valarray& operator+= (const value_type& x); 75227825Stheraven valarray& operator-= (const value_type& x); 76227825Stheraven valarray& operator^= (const value_type& x); 77227825Stheraven valarray& operator&= (const value_type& x); 78227825Stheraven valarray& operator|= (const value_type& x); 79227825Stheraven valarray& operator<<=(const value_type& x); 80227825Stheraven valarray& operator>>=(const value_type& x); 81227825Stheraven 82227825Stheraven valarray& operator*= (const valarray& v); 83227825Stheraven valarray& operator/= (const valarray& v); 84227825Stheraven valarray& operator%= (const valarray& v); 85227825Stheraven valarray& operator+= (const valarray& v); 86227825Stheraven valarray& operator-= (const valarray& v); 87227825Stheraven valarray& operator^= (const valarray& v); 88227825Stheraven valarray& operator|= (const valarray& v); 89227825Stheraven valarray& operator&= (const valarray& v); 90227825Stheraven valarray& operator<<=(const valarray& v); 91227825Stheraven valarray& operator>>=(const valarray& v); 92227825Stheraven 93227825Stheraven // member functions: 94227825Stheraven void swap(valarray& v); 95227825Stheraven 96227825Stheraven size_t size() const; 97227825Stheraven 98227825Stheraven value_type sum() const; 99227825Stheraven value_type min() const; 100227825Stheraven value_type max() const; 101227825Stheraven 102227825Stheraven valarray shift (int i) const; 103227825Stheraven valarray cshift(int i) const; 104227825Stheraven valarray apply(value_type f(value_type)) const; 105227825Stheraven valarray apply(value_type f(const value_type&)) const; 106227825Stheraven void resize(size_t n, value_type x = value_type()); 107227825Stheraven}; 108227825Stheraven 109227825Stheravenclass slice 110227825Stheraven{ 111227825Stheravenpublic: 112227825Stheraven slice(); 113227825Stheraven slice(size_t start, size_t size, size_t stride); 114227825Stheraven 115227825Stheraven size_t start() const; 116227825Stheraven size_t size() const; 117227825Stheraven size_t stride() const; 118227825Stheraven}; 119227825Stheraven 120227825Stheraventemplate <class T> 121227825Stheravenclass slice_array 122227825Stheraven{ 123227825Stheravenpublic: 124227825Stheraven typedef T value_type; 125227825Stheraven 126227825Stheraven const slice_array& operator=(const slice_array& sa) const; 127227825Stheraven void operator= (const valarray<value_type>& v) const; 128227825Stheraven void operator*= (const valarray<value_type>& v) const; 129227825Stheraven void operator/= (const valarray<value_type>& v) const; 130227825Stheraven void operator%= (const valarray<value_type>& v) const; 131227825Stheraven void operator+= (const valarray<value_type>& v) const; 132227825Stheraven void operator-= (const valarray<value_type>& v) const; 133227825Stheraven void operator^= (const valarray<value_type>& v) const; 134227825Stheraven void operator&= (const valarray<value_type>& v) const; 135227825Stheraven void operator|= (const valarray<value_type>& v) const; 136227825Stheraven void operator<<=(const valarray<value_type>& v) const; 137227825Stheraven void operator>>=(const valarray<value_type>& v) const; 138227825Stheraven 139227825Stheraven void operator=(const value_type& x) const; 140227825Stheraven 141227825Stheraven slice_array() = delete; 142227825Stheraven}; 143227825Stheraven 144227825Stheravenclass gslice 145227825Stheraven{ 146227825Stheravenpublic: 147227825Stheraven gslice(); 148227825Stheraven gslice(size_t start, const valarray<size_t>& size, 149227825Stheraven const valarray<size_t>& stride); 150227825Stheraven 151227825Stheraven size_t start() const; 152227825Stheraven valarray<size_t> size() const; 153227825Stheraven valarray<size_t> stride() const; 154227825Stheraven}; 155227825Stheraven 156227825Stheraventemplate <class T> 157227825Stheravenclass gslice_array 158227825Stheraven{ 159227825Stheravenpublic: 160227825Stheraven typedef T value_type; 161227825Stheraven 162227825Stheraven void operator= (const valarray<value_type>& v) const; 163227825Stheraven void operator*= (const valarray<value_type>& v) const; 164227825Stheraven void operator/= (const valarray<value_type>& v) const; 165227825Stheraven void operator%= (const valarray<value_type>& v) const; 166227825Stheraven void operator+= (const valarray<value_type>& v) const; 167227825Stheraven void operator-= (const valarray<value_type>& v) const; 168227825Stheraven void operator^= (const valarray<value_type>& v) const; 169227825Stheraven void operator&= (const valarray<value_type>& v) const; 170227825Stheraven void operator|= (const valarray<value_type>& v) const; 171227825Stheraven void operator<<=(const valarray<value_type>& v) const; 172227825Stheraven void operator>>=(const valarray<value_type>& v) const; 173227825Stheraven 174227825Stheraven gslice_array(const gslice_array& ga); 175227825Stheraven ~gslice_array(); 176227825Stheraven const gslice_array& operator=(const gslice_array& ga) const; 177227825Stheraven void operator=(const value_type& x) const; 178227825Stheraven 179227825Stheraven gslice_array() = delete; 180227825Stheraven}; 181227825Stheraven 182227825Stheraventemplate <class T> 183227825Stheravenclass mask_array 184227825Stheraven{ 185227825Stheravenpublic: 186227825Stheraven typedef T value_type; 187227825Stheraven 188227825Stheraven void operator= (const valarray<value_type>& v) const; 189227825Stheraven void operator*= (const valarray<value_type>& v) const; 190227825Stheraven void operator/= (const valarray<value_type>& v) const; 191227825Stheraven void operator%= (const valarray<value_type>& v) const; 192227825Stheraven void operator+= (const valarray<value_type>& v) const; 193227825Stheraven void operator-= (const valarray<value_type>& v) const; 194227825Stheraven void operator^= (const valarray<value_type>& v) const; 195227825Stheraven void operator&= (const valarray<value_type>& v) const; 196227825Stheraven void operator|= (const valarray<value_type>& v) const; 197227825Stheraven void operator<<=(const valarray<value_type>& v) const; 198227825Stheraven void operator>>=(const valarray<value_type>& v) const; 199227825Stheraven 200227825Stheraven mask_array(const mask_array& ma); 201227825Stheraven ~mask_array(); 202227825Stheraven const mask_array& operator=(const mask_array& ma) const; 203227825Stheraven void operator=(const value_type& x) const; 204227825Stheraven 205227825Stheraven mask_array() = delete; 206227825Stheraven}; 207227825Stheraven 208227825Stheraventemplate <class T> 209227825Stheravenclass indirect_array 210227825Stheraven{ 211227825Stheravenpublic: 212227825Stheraven typedef T value_type; 213227825Stheraven 214227825Stheraven void operator= (const valarray<value_type>& v) const; 215227825Stheraven void operator*= (const valarray<value_type>& v) const; 216227825Stheraven void operator/= (const valarray<value_type>& v) const; 217227825Stheraven void operator%= (const valarray<value_type>& v) const; 218227825Stheraven void operator+= (const valarray<value_type>& v) const; 219227825Stheraven void operator-= (const valarray<value_type>& v) const; 220227825Stheraven void operator^= (const valarray<value_type>& v) const; 221227825Stheraven void operator&= (const valarray<value_type>& v) const; 222227825Stheraven void operator|= (const valarray<value_type>& v) const; 223227825Stheraven void operator<<=(const valarray<value_type>& v) const; 224227825Stheraven void operator>>=(const valarray<value_type>& v) const; 225227825Stheraven 226227825Stheraven indirect_array(const indirect_array& ia); 227227825Stheraven ~indirect_array(); 228227825Stheraven const indirect_array& operator=(const indirect_array& ia) const; 229227825Stheraven void operator=(const value_type& x) const; 230227825Stheraven 231227825Stheraven indirect_array() = delete; 232227825Stheraven}; 233227825Stheraven 234227825Stheraventemplate<class T> void swap(valarray<T>& x, valarray<T>& y); 235227825Stheraven 236227825Stheraventemplate<class T> valarray<T> operator* (const valarray<T>& x, const valarray<T>& y); 237227825Stheraventemplate<class T> valarray<T> operator* (const valarray<T>& x, const T& y); 238227825Stheraventemplate<class T> valarray<T> operator* (const T& x, const valarray<T>& y); 239227825Stheraven 240227825Stheraventemplate<class T> valarray<T> operator/ (const valarray<T>& x, const valarray<T>& y); 241227825Stheraventemplate<class T> valarray<T> operator/ (const valarray<T>& x, const T& y); 242227825Stheraventemplate<class T> valarray<T> operator/ (const T& x, const valarray<T>& y); 243227825Stheraven 244227825Stheraventemplate<class T> valarray<T> operator% (const valarray<T>& x, const valarray<T>& y); 245227825Stheraventemplate<class T> valarray<T> operator% (const valarray<T>& x, const T& y); 246227825Stheraventemplate<class T> valarray<T> operator% (const T& x, const valarray<T>& y); 247227825Stheraven 248227825Stheraventemplate<class T> valarray<T> operator+ (const valarray<T>& x, const valarray<T>& y); 249227825Stheraventemplate<class T> valarray<T> operator+ (const valarray<T>& x, const T& y); 250227825Stheraventemplate<class T> valarray<T> operator+ (const T& x, const valarray<T>& y); 251227825Stheraven 252227825Stheraventemplate<class T> valarray<T> operator- (const valarray<T>& x, const valarray<T>& y); 253227825Stheraventemplate<class T> valarray<T> operator- (const valarray<T>& x, const T& y); 254227825Stheraventemplate<class T> valarray<T> operator- (const T& x, const valarray<T>& y); 255227825Stheraven 256227825Stheraventemplate<class T> valarray<T> operator^ (const valarray<T>& x, const valarray<T>& y); 257227825Stheraventemplate<class T> valarray<T> operator^ (const valarray<T>& x, const T& y); 258227825Stheraventemplate<class T> valarray<T> operator^ (const T& x, const valarray<T>& y); 259227825Stheraven 260227825Stheraventemplate<class T> valarray<T> operator& (const valarray<T>& x, const valarray<T>& y); 261227825Stheraventemplate<class T> valarray<T> operator& (const valarray<T>& x, const T& y); 262227825Stheraventemplate<class T> valarray<T> operator& (const T& x, const valarray<T>& y); 263227825Stheraven 264227825Stheraventemplate<class T> valarray<T> operator| (const valarray<T>& x, const valarray<T>& y); 265227825Stheraventemplate<class T> valarray<T> operator| (const valarray<T>& x, const T& y); 266227825Stheraventemplate<class T> valarray<T> operator| (const T& x, const valarray<T>& y); 267227825Stheraven 268227825Stheraventemplate<class T> valarray<T> operator<<(const valarray<T>& x, const valarray<T>& y); 269227825Stheraventemplate<class T> valarray<T> operator<<(const valarray<T>& x, const T& y); 270227825Stheraventemplate<class T> valarray<T> operator<<(const T& x, const valarray<T>& y); 271227825Stheraven 272227825Stheraventemplate<class T> valarray<T> operator>>(const valarray<T>& x, const valarray<T>& y); 273227825Stheraventemplate<class T> valarray<T> operator>>(const valarray<T>& x, const T& y); 274227825Stheraventemplate<class T> valarray<T> operator>>(const T& x, const valarray<T>& y); 275227825Stheraven 276227825Stheraventemplate<class T> valarray<bool> operator&&(const valarray<T>& x, const valarray<T>& y); 277227825Stheraventemplate<class T> valarray<bool> operator&&(const valarray<T>& x, const T& y); 278227825Stheraventemplate<class T> valarray<bool> operator&&(const T& x, const valarray<T>& y); 279227825Stheraven 280227825Stheraventemplate<class T> valarray<bool> operator||(const valarray<T>& x, const valarray<T>& y); 281227825Stheraventemplate<class T> valarray<bool> operator||(const valarray<T>& x, const T& y); 282227825Stheraventemplate<class T> valarray<bool> operator||(const T& x, const valarray<T>& y); 283227825Stheraven 284227825Stheraventemplate<class T> valarray<bool> operator==(const valarray<T>& x, const valarray<T>& y); 285227825Stheraventemplate<class T> valarray<bool> operator==(const valarray<T>& x, const T& y); 286227825Stheraventemplate<class T> valarray<bool> operator==(const T& x, const valarray<T>& y); 287227825Stheraven 288227825Stheraventemplate<class T> valarray<bool> operator!=(const valarray<T>& x, const valarray<T>& y); 289227825Stheraventemplate<class T> valarray<bool> operator!=(const valarray<T>& x, const T& y); 290227825Stheraventemplate<class T> valarray<bool> operator!=(const T& x, const valarray<T>& y); 291227825Stheraven 292227825Stheraventemplate<class T> valarray<bool> operator< (const valarray<T>& x, const valarray<T>& y); 293227825Stheraventemplate<class T> valarray<bool> operator< (const valarray<T>& x, const T& y); 294227825Stheraventemplate<class T> valarray<bool> operator< (const T& x, const valarray<T>& y); 295227825Stheraven 296227825Stheraventemplate<class T> valarray<bool> operator> (const valarray<T>& x, const valarray<T>& y); 297227825Stheraventemplate<class T> valarray<bool> operator> (const valarray<T>& x, const T& y); 298227825Stheraventemplate<class T> valarray<bool> operator> (const T& x, const valarray<T>& y); 299227825Stheraven 300227825Stheraventemplate<class T> valarray<bool> operator<=(const valarray<T>& x, const valarray<T>& y); 301227825Stheraventemplate<class T> valarray<bool> operator<=(const valarray<T>& x, const T& y); 302227825Stheraventemplate<class T> valarray<bool> operator<=(const T& x, const valarray<T>& y); 303227825Stheraven 304227825Stheraventemplate<class T> valarray<bool> operator>=(const valarray<T>& x, const valarray<T>& y); 305227825Stheraventemplate<class T> valarray<bool> operator>=(const valarray<T>& x, const T& y); 306227825Stheraventemplate<class T> valarray<bool> operator>=(const T& x, const valarray<T>& y); 307227825Stheraven 308227825Stheraventemplate<class T> valarray<T> abs (const valarray<T>& x); 309227825Stheraventemplate<class T> valarray<T> acos (const valarray<T>& x); 310227825Stheraventemplate<class T> valarray<T> asin (const valarray<T>& x); 311227825Stheraventemplate<class T> valarray<T> atan (const valarray<T>& x); 312227825Stheraven 313227825Stheraventemplate<class T> valarray<T> atan2(const valarray<T>& x, const valarray<T>& y); 314227825Stheraventemplate<class T> valarray<T> atan2(const valarray<T>& x, const T& y); 315227825Stheraventemplate<class T> valarray<T> atan2(const T& x, const valarray<T>& y); 316227825Stheraven 317227825Stheraventemplate<class T> valarray<T> cos (const valarray<T>& x); 318227825Stheraventemplate<class T> valarray<T> cosh (const valarray<T>& x); 319227825Stheraventemplate<class T> valarray<T> exp (const valarray<T>& x); 320227825Stheraventemplate<class T> valarray<T> log (const valarray<T>& x); 321227825Stheraventemplate<class T> valarray<T> log10(const valarray<T>& x); 322227825Stheraven 323227825Stheraventemplate<class T> valarray<T> pow(const valarray<T>& x, const valarray<T>& y); 324227825Stheraventemplate<class T> valarray<T> pow(const valarray<T>& x, const T& y); 325227825Stheraventemplate<class T> valarray<T> pow(const T& x, const valarray<T>& y); 326227825Stheraven 327227825Stheraventemplate<class T> valarray<T> sin (const valarray<T>& x); 328227825Stheraventemplate<class T> valarray<T> sinh (const valarray<T>& x); 329227825Stheraventemplate<class T> valarray<T> sqrt (const valarray<T>& x); 330227825Stheraventemplate<class T> valarray<T> tan (const valarray<T>& x); 331227825Stheraventemplate<class T> valarray<T> tanh (const valarray<T>& x); 332227825Stheraven 333227825Stheraventemplate <class T> unspecified1 begin(valarray<T>& v); 334227825Stheraventemplate <class T> unspecified2 begin(const valarray<T>& v); 335227825Stheraventemplate <class T> unspecified1 end(valarray<T>& v); 336227825Stheraventemplate <class T> unspecified2 end(const valarray<T>& v); 337227825Stheraven 338227825Stheraven} // std 339227825Stheraven 340227825Stheraven*/ 341227825Stheraven 342227825Stheraven#include <__config> 343227825Stheraven#include <cstddef> 344227825Stheraven#include <cmath> 345227825Stheraven#include <initializer_list> 346227825Stheraven#include <algorithm> 347227825Stheraven#include <functional> 348227825Stheraven 349227825Stheraven#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 350227825Stheraven#pragma GCC system_header 351227825Stheraven#endif 352227825Stheraven 353227825Stheraven_LIBCPP_BEGIN_NAMESPACE_STD 354227825Stheraven 355227825Stheraventemplate<class _Tp> class valarray; 356227825Stheraven 357227825Stheravenclass _LIBCPP_VISIBLE slice 358227825Stheraven{ 359227825Stheraven size_t __start_; 360227825Stheraven size_t __size_; 361227825Stheraven size_t __stride_; 362227825Stheravenpublic: 363227825Stheraven _LIBCPP_INLINE_VISIBILITY 364227825Stheraven slice() 365227825Stheraven : __start_(0), 366227825Stheraven __size_(0), 367227825Stheraven __stride_(0) 368227825Stheraven {} 369227825Stheraven 370227825Stheraven _LIBCPP_INLINE_VISIBILITY 371227825Stheraven slice(size_t __start, size_t __size, size_t __stride) 372227825Stheraven : __start_(__start), 373227825Stheraven __size_(__size), 374227825Stheraven __stride_(__stride) 375227825Stheraven {} 376227825Stheraven 377227825Stheraven _LIBCPP_INLINE_VISIBILITY size_t start() const {return __start_;} 378227825Stheraven _LIBCPP_INLINE_VISIBILITY size_t size() const {return __size_;} 379227825Stheraven _LIBCPP_INLINE_VISIBILITY size_t stride() const {return __stride_;} 380227825Stheraven}; 381227825Stheraven 382227825Stheraventemplate <class _Tp> class slice_array; 383227825Stheravenclass gslice; 384227825Stheraventemplate <class _Tp> class gslice_array; 385227825Stheraventemplate <class _Tp> class mask_array; 386227825Stheraventemplate <class _Tp> class indirect_array; 387227825Stheraven 388227825Stheraventemplate <class _Tp> 389227825Stheraven_Tp* 390227825Stheravenbegin(valarray<_Tp>& __v); 391227825Stheraven 392227825Stheraventemplate <class _Tp> 393227825Stheravenconst _Tp* 394227825Stheravenbegin(const valarray<_Tp>& __v); 395227825Stheraven 396227825Stheraventemplate <class _Tp> 397227825Stheraven_Tp* 398227825Stheravenend(valarray<_Tp>& __v); 399227825Stheraven 400227825Stheraventemplate <class _Tp> 401227825Stheravenconst _Tp* 402227825Stheravenend(const valarray<_Tp>& __v); 403227825Stheraven 404227825Stheraventemplate <class _Op, class _A0> 405227825Stheravenstruct _UnaryOp 406227825Stheraven{ 407227825Stheraven typedef typename _Op::result_type result_type; 408227825Stheraven typedef typename _A0::value_type value_type; 409227825Stheraven 410227825Stheraven _Op __op_; 411227825Stheraven _A0 __a0_; 412227825Stheraven 413227825Stheraven _LIBCPP_INLINE_VISIBILITY 414227825Stheraven _UnaryOp(const _Op& __op, const _A0& __a0) : __op_(__op), __a0_(__a0) {} 415227825Stheraven 416227825Stheraven _LIBCPP_INLINE_VISIBILITY 417227825Stheraven result_type operator[](size_t __i) const {return __op_(__a0_[__i]);} 418227825Stheraven 419227825Stheraven _LIBCPP_INLINE_VISIBILITY 420227825Stheraven size_t size() const {return __a0_.size();} 421227825Stheraven}; 422227825Stheraven 423227825Stheraventemplate <class _Op, class _A0, class _A1> 424227825Stheravenstruct _BinaryOp 425227825Stheraven{ 426227825Stheraven typedef typename _Op::result_type result_type; 427227825Stheraven typedef typename _A0::value_type value_type; 428227825Stheraven 429227825Stheraven _Op __op_; 430227825Stheraven _A0 __a0_; 431227825Stheraven _A1 __a1_; 432227825Stheraven 433227825Stheraven _LIBCPP_INLINE_VISIBILITY 434227825Stheraven _BinaryOp(const _Op& __op, const _A0& __a0, const _A1& __a1) 435227825Stheraven : __op_(__op), __a0_(__a0), __a1_(__a1) {} 436227825Stheraven 437227825Stheraven _LIBCPP_INLINE_VISIBILITY 438227825Stheraven value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);} 439227825Stheraven 440227825Stheraven _LIBCPP_INLINE_VISIBILITY 441227825Stheraven size_t size() const {return __a0_.size();} 442227825Stheraven}; 443227825Stheraven 444227825Stheraventemplate <class _Tp> 445227825Stheravenclass __scalar_expr 446227825Stheraven{ 447227825Stheravenpublic: 448227825Stheraven typedef _Tp value_type; 449227825Stheraven typedef const _Tp& result_type; 450227825Stheravenprivate: 451227825Stheraven const value_type& __t_; 452227825Stheraven size_t __s_; 453227825Stheravenpublic: 454227825Stheraven _LIBCPP_INLINE_VISIBILITY 455227825Stheraven explicit __scalar_expr(const value_type& __t, size_t __s) : __t_(__t), __s_(__s) {} 456227825Stheraven 457227825Stheraven _LIBCPP_INLINE_VISIBILITY 458227825Stheraven result_type operator[](size_t) const {return __t_;} 459227825Stheraven 460227825Stheraven _LIBCPP_INLINE_VISIBILITY 461227825Stheraven size_t size() const {return __s_;} 462227825Stheraven}; 463227825Stheraven 464227825Stheraventemplate <class _Tp> 465227825Stheravenstruct __unary_plus : unary_function<_Tp, _Tp> 466227825Stheraven{ 467227825Stheraven _LIBCPP_INLINE_VISIBILITY 468227825Stheraven _Tp operator()(const _Tp& __x) const 469227825Stheraven {return +__x;} 470227825Stheraven}; 471227825Stheraven 472227825Stheraventemplate <class _Tp> 473227825Stheravenstruct __bit_not : unary_function<_Tp, _Tp> 474227825Stheraven{ 475227825Stheraven _LIBCPP_INLINE_VISIBILITY 476227825Stheraven _Tp operator()(const _Tp& __x) const 477227825Stheraven {return ~__x;} 478227825Stheraven}; 479227825Stheraven 480227825Stheraventemplate <class _Tp> 481227825Stheravenstruct __bit_shift_left : binary_function<_Tp, _Tp, _Tp> 482227825Stheraven{ 483227825Stheraven _LIBCPP_INLINE_VISIBILITY 484227825Stheraven _Tp operator()(const _Tp& __x, const _Tp& __y) const 485227825Stheraven {return __x << __y;} 486227825Stheraven}; 487227825Stheraven 488227825Stheraventemplate <class _Tp> 489227825Stheravenstruct __bit_shift_right : binary_function<_Tp, _Tp, _Tp> 490227825Stheraven{ 491227825Stheraven _LIBCPP_INLINE_VISIBILITY 492227825Stheraven _Tp operator()(const _Tp& __x, const _Tp& __y) const 493227825Stheraven {return __x >> __y;} 494227825Stheraven}; 495227825Stheraven 496227825Stheraventemplate <class _Tp, class _F> 497227825Stheravenstruct __apply_expr : unary_function<_Tp, _Tp> 498227825Stheraven{ 499227825Stheravenprivate: 500227825Stheraven _F __f_; 501227825Stheravenpublic: 502227825Stheraven _LIBCPP_INLINE_VISIBILITY 503227825Stheraven explicit __apply_expr(_F __f) : __f_(__f) {} 504227825Stheraven 505227825Stheraven _LIBCPP_INLINE_VISIBILITY 506227825Stheraven _Tp operator()(const _Tp& __x) const 507227825Stheraven {return __f_(__x);} 508227825Stheraven}; 509227825Stheraven 510227825Stheraventemplate <class _Tp> 511227825Stheravenstruct __abs_expr : unary_function<_Tp, _Tp> 512227825Stheraven{ 513227825Stheraven _LIBCPP_INLINE_VISIBILITY 514227825Stheraven _Tp operator()(const _Tp& __x) const 515227825Stheraven {return abs(__x);} 516227825Stheraven}; 517227825Stheraven 518227825Stheraventemplate <class _Tp> 519227825Stheravenstruct __acos_expr : unary_function<_Tp, _Tp> 520227825Stheraven{ 521227825Stheraven _LIBCPP_INLINE_VISIBILITY 522227825Stheraven _Tp operator()(const _Tp& __x) const 523227825Stheraven {return acos(__x);} 524227825Stheraven}; 525227825Stheraven 526227825Stheraventemplate <class _Tp> 527227825Stheravenstruct __asin_expr : unary_function<_Tp, _Tp> 528227825Stheraven{ 529227825Stheraven _LIBCPP_INLINE_VISIBILITY 530227825Stheraven _Tp operator()(const _Tp& __x) const 531227825Stheraven {return asin(__x);} 532227825Stheraven}; 533227825Stheraven 534227825Stheraventemplate <class _Tp> 535227825Stheravenstruct __atan_expr : unary_function<_Tp, _Tp> 536227825Stheraven{ 537227825Stheraven _LIBCPP_INLINE_VISIBILITY 538227825Stheraven _Tp operator()(const _Tp& __x) const 539227825Stheraven {return atan(__x);} 540227825Stheraven}; 541227825Stheraven 542227825Stheraventemplate <class _Tp> 543227825Stheravenstruct __atan2_expr : binary_function<_Tp, _Tp, _Tp> 544227825Stheraven{ 545227825Stheraven _LIBCPP_INLINE_VISIBILITY 546227825Stheraven _Tp operator()(const _Tp& __x, const _Tp& __y) const 547227825Stheraven {return atan2(__x, __y);} 548227825Stheraven}; 549227825Stheraven 550227825Stheraventemplate <class _Tp> 551227825Stheravenstruct __cos_expr : unary_function<_Tp, _Tp> 552227825Stheraven{ 553227825Stheraven _LIBCPP_INLINE_VISIBILITY 554227825Stheraven _Tp operator()(const _Tp& __x) const 555227825Stheraven {return cos(__x);} 556227825Stheraven}; 557227825Stheraven 558227825Stheraventemplate <class _Tp> 559227825Stheravenstruct __cosh_expr : unary_function<_Tp, _Tp> 560227825Stheraven{ 561227825Stheraven _LIBCPP_INLINE_VISIBILITY 562227825Stheraven _Tp operator()(const _Tp& __x) const 563227825Stheraven {return cosh(__x);} 564227825Stheraven}; 565227825Stheraven 566227825Stheraventemplate <class _Tp> 567227825Stheravenstruct __exp_expr : unary_function<_Tp, _Tp> 568227825Stheraven{ 569227825Stheraven _LIBCPP_INLINE_VISIBILITY 570227825Stheraven _Tp operator()(const _Tp& __x) const 571227825Stheraven {return exp(__x);} 572227825Stheraven}; 573227825Stheraven 574227825Stheraventemplate <class _Tp> 575227825Stheravenstruct __log_expr : unary_function<_Tp, _Tp> 576227825Stheraven{ 577227825Stheraven _LIBCPP_INLINE_VISIBILITY 578227825Stheraven _Tp operator()(const _Tp& __x) const 579227825Stheraven {return log(__x);} 580227825Stheraven}; 581227825Stheraven 582227825Stheraventemplate <class _Tp> 583227825Stheravenstruct __log10_expr : unary_function<_Tp, _Tp> 584227825Stheraven{ 585227825Stheraven _LIBCPP_INLINE_VISIBILITY 586227825Stheraven _Tp operator()(const _Tp& __x) const 587227825Stheraven {return log10(__x);} 588227825Stheraven}; 589227825Stheraven 590227825Stheraventemplate <class _Tp> 591227825Stheravenstruct __pow_expr : binary_function<_Tp, _Tp, _Tp> 592227825Stheraven{ 593227825Stheraven _LIBCPP_INLINE_VISIBILITY 594227825Stheraven _Tp operator()(const _Tp& __x, const _Tp& __y) const 595227825Stheraven {return pow(__x, __y);} 596227825Stheraven}; 597227825Stheraven 598227825Stheraventemplate <class _Tp> 599227825Stheravenstruct __sin_expr : unary_function<_Tp, _Tp> 600227825Stheraven{ 601227825Stheraven _LIBCPP_INLINE_VISIBILITY 602227825Stheraven _Tp operator()(const _Tp& __x) const 603227825Stheraven {return sin(__x);} 604227825Stheraven}; 605227825Stheraven 606227825Stheraventemplate <class _Tp> 607227825Stheravenstruct __sinh_expr : unary_function<_Tp, _Tp> 608227825Stheraven{ 609227825Stheraven _LIBCPP_INLINE_VISIBILITY 610227825Stheraven _Tp operator()(const _Tp& __x) const 611227825Stheraven {return sinh(__x);} 612227825Stheraven}; 613227825Stheraven 614227825Stheraventemplate <class _Tp> 615227825Stheravenstruct __sqrt_expr : unary_function<_Tp, _Tp> 616227825Stheraven{ 617227825Stheraven _LIBCPP_INLINE_VISIBILITY 618227825Stheraven _Tp operator()(const _Tp& __x) const 619227825Stheraven {return sqrt(__x);} 620227825Stheraven}; 621227825Stheraven 622227825Stheraventemplate <class _Tp> 623227825Stheravenstruct __tan_expr : unary_function<_Tp, _Tp> 624227825Stheraven{ 625227825Stheraven _LIBCPP_INLINE_VISIBILITY 626227825Stheraven _Tp operator()(const _Tp& __x) const 627227825Stheraven {return tan(__x);} 628227825Stheraven}; 629227825Stheraven 630227825Stheraventemplate <class _Tp> 631227825Stheravenstruct __tanh_expr : unary_function<_Tp, _Tp> 632227825Stheraven{ 633227825Stheraven _LIBCPP_INLINE_VISIBILITY 634227825Stheraven _Tp operator()(const _Tp& __x) const 635227825Stheraven {return tanh(__x);} 636227825Stheraven}; 637227825Stheraven 638227825Stheraventemplate <class _ValExpr> 639227825Stheravenclass __slice_expr 640227825Stheraven{ 641227825Stheraven typedef typename remove_reference<_ValExpr>::type _RmExpr; 642227825Stheravenpublic: 643227825Stheraven typedef typename _RmExpr::value_type value_type; 644227825Stheraven typedef value_type result_type; 645227825Stheraven 646227825Stheravenprivate: 647227825Stheraven _ValExpr __expr_; 648227825Stheraven size_t __start_; 649227825Stheraven size_t __size_; 650227825Stheraven size_t __stride_; 651227825Stheraven 652227825Stheraven _LIBCPP_INLINE_VISIBILITY 653227825Stheraven __slice_expr(const slice& __sl, const _RmExpr& __e) 654227825Stheraven : __expr_(__e), 655227825Stheraven __start_(__sl.start()), 656227825Stheraven __size_(__sl.size()), 657227825Stheraven __stride_(__sl.stride()) 658227825Stheraven {} 659227825Stheravenpublic: 660227825Stheraven 661227825Stheraven _LIBCPP_INLINE_VISIBILITY 662227825Stheraven result_type operator[](size_t __i) const 663227825Stheraven {return __expr_[__start_ + __i * __stride_];} 664227825Stheraven 665227825Stheraven _LIBCPP_INLINE_VISIBILITY 666227825Stheraven size_t size() const {return __size_;} 667227825Stheraven 668227825Stheraven template <class> friend class _LIBCPP_VISIBLE valarray; 669227825Stheraven}; 670227825Stheraven 671227825Stheraventemplate <class _ValExpr> 672227825Stheravenclass __mask_expr; 673227825Stheraven 674227825Stheraventemplate <class _ValExpr> 675227825Stheravenclass __indirect_expr; 676227825Stheraven 677227825Stheraventemplate <class _ValExpr> 678227825Stheravenclass __shift_expr 679227825Stheraven{ 680227825Stheraven typedef typename remove_reference<_ValExpr>::type _RmExpr; 681227825Stheravenpublic: 682227825Stheraven typedef typename _RmExpr::value_type value_type; 683227825Stheraven typedef value_type result_type; 684227825Stheraven 685227825Stheravenprivate: 686227825Stheraven _ValExpr __expr_; 687227825Stheraven size_t __size_; 688227825Stheraven ptrdiff_t __ul_; 689227825Stheraven ptrdiff_t __sn_; 690227825Stheraven ptrdiff_t __n_; 691227825Stheraven static const ptrdiff_t _N = static_cast<ptrdiff_t>( 692227825Stheraven sizeof(ptrdiff_t) * __CHAR_BIT__ - 1); 693227825Stheraven 694227825Stheraven _LIBCPP_INLINE_VISIBILITY 695227825Stheraven __shift_expr(int __n, const _RmExpr& __e) 696227825Stheraven : __expr_(__e), 697227825Stheraven __size_(__e.size()), 698227825Stheraven __n_(__n) 699227825Stheraven { 700227825Stheraven ptrdiff_t __neg_n = static_cast<ptrdiff_t>(__n_ >> _N); 701227825Stheraven __sn_ = __neg_n | static_cast<ptrdiff_t>(static_cast<size_t>(-__n_) >> _N); 702227825Stheraven __ul_ = ((__size_ - __n_) & ~__neg_n) | ((__n_ + 1) & __neg_n); 703227825Stheraven } 704227825Stheravenpublic: 705227825Stheraven 706227825Stheraven _LIBCPP_INLINE_VISIBILITY 707227825Stheraven result_type operator[](size_t __j) const 708227825Stheraven { 709227825Stheraven ptrdiff_t __i = static_cast<size_t>(__j); 710227825Stheraven ptrdiff_t __m = (__sn_ * __i - __ul_) >> _N; 711227825Stheraven return (__expr_[(__i + __n_) & __m] & __m) | (value_type() & ~__m); 712227825Stheraven } 713227825Stheraven 714227825Stheraven _LIBCPP_INLINE_VISIBILITY 715227825Stheraven size_t size() const {return __size_;} 716227825Stheraven 717227825Stheraven template <class> friend class __val_expr; 718227825Stheraven}; 719227825Stheraven 720227825Stheraventemplate <class _ValExpr> 721227825Stheravenclass __cshift_expr 722227825Stheraven{ 723227825Stheraven typedef typename remove_reference<_ValExpr>::type _RmExpr; 724227825Stheravenpublic: 725227825Stheraven typedef typename _RmExpr::value_type value_type; 726227825Stheraven typedef value_type result_type; 727227825Stheraven 728227825Stheravenprivate: 729227825Stheraven _ValExpr __expr_; 730227825Stheraven size_t __size_; 731227825Stheraven size_t __m_; 732227825Stheraven size_t __o1_; 733227825Stheraven size_t __o2_; 734227825Stheraven 735227825Stheraven _LIBCPP_INLINE_VISIBILITY 736227825Stheraven __cshift_expr(int __n, const _RmExpr& __e) 737227825Stheraven : __expr_(__e), 738227825Stheraven __size_(__e.size()) 739227825Stheraven { 740227825Stheraven __n %= static_cast<int>(__size_); 741227825Stheraven if (__n >= 0) 742227825Stheraven { 743227825Stheraven __m_ = __size_ - __n; 744227825Stheraven __o1_ = __n; 745227825Stheraven __o2_ = __n - __size_; 746227825Stheraven } 747227825Stheraven else 748227825Stheraven { 749227825Stheraven __m_ = -__n; 750227825Stheraven __o1_ = __n + __size_; 751227825Stheraven __o2_ = __n; 752227825Stheraven } 753227825Stheraven } 754227825Stheravenpublic: 755227825Stheraven 756227825Stheraven _LIBCPP_INLINE_VISIBILITY 757227825Stheraven result_type operator[](size_t __i) const 758227825Stheraven { 759227825Stheraven if (__i < __m_) 760227825Stheraven return __expr_[__i + __o1_]; 761227825Stheraven return __expr_[__i + __o2_]; 762227825Stheraven } 763227825Stheraven 764227825Stheraven _LIBCPP_INLINE_VISIBILITY 765227825Stheraven size_t size() const {return __size_;} 766227825Stheraven 767227825Stheraven template <class> friend class __val_expr; 768227825Stheraven}; 769227825Stheraven 770227825Stheraventemplate<class _ValExpr> 771227825Stheravenclass __val_expr; 772227825Stheraven 773227825Stheraventemplate<class _ValExpr> 774227825Stheravenstruct __is_val_expr : false_type {}; 775227825Stheraven 776227825Stheraventemplate<class _ValExpr> 777227825Stheravenstruct __is_val_expr<__val_expr<_ValExpr> > : true_type {}; 778227825Stheraven 779227825Stheraventemplate<class _Tp> 780227825Stheravenstruct __is_val_expr<valarray<_Tp> > : true_type {}; 781227825Stheraven 782227825Stheraventemplate<class _Tp> 783227825Stheravenclass _LIBCPP_VISIBLE valarray 784227825Stheraven{ 785227825Stheravenpublic: 786227825Stheraven typedef _Tp value_type; 787227825Stheraven typedef _Tp result_type; 788227825Stheraven 789227825Stheravenprivate: 790227825Stheraven value_type* __begin_; 791227825Stheraven value_type* __end_; 792227825Stheraven 793227825Stheravenpublic: 794227825Stheraven // construct/destroy: 795227825Stheraven _LIBCPP_INLINE_VISIBILITY 796227825Stheraven valarray() : __begin_(0), __end_(0) {} 797227825Stheraven explicit valarray(size_t __n); 798227825Stheraven valarray(const value_type& __x, size_t __n); 799227825Stheraven valarray(const value_type* __p, size_t __n); 800227825Stheraven valarray(const valarray& __v); 801227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 802227825Stheraven valarray(valarray&& __v); 803227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 804227825Stheraven#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 805227825Stheraven valarray(initializer_list<value_type> __il); 806227825Stheraven#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 807227825Stheraven valarray(const slice_array<value_type>& __sa); 808227825Stheraven valarray(const gslice_array<value_type>& __ga); 809227825Stheraven valarray(const mask_array<value_type>& __ma); 810227825Stheraven valarray(const indirect_array<value_type>& __ia); 811227825Stheraven ~valarray(); 812227825Stheraven 813227825Stheraven // assignment: 814227825Stheraven valarray& operator=(const valarray& __v); 815227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 816227825Stheraven valarray& operator=(valarray&& __v); 817227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 818227825Stheraven#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 819227825Stheraven valarray& operator=(initializer_list<value_type>); 820227825Stheraven#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 821227825Stheraven valarray& operator=(const value_type& __x); 822227825Stheraven valarray& operator=(const slice_array<value_type>& __sa); 823227825Stheraven valarray& operator=(const gslice_array<value_type>& __ga); 824227825Stheraven valarray& operator=(const mask_array<value_type>& __ma); 825227825Stheraven valarray& operator=(const indirect_array<value_type>& __ia); 826227825Stheraven template <class _ValExpr> 827227825Stheraven valarray& operator=(const __val_expr<_ValExpr>& __v); 828227825Stheraven 829227825Stheraven // element access: 830227825Stheraven _LIBCPP_INLINE_VISIBILITY 831227825Stheraven const value_type& operator[](size_t __i) const {return __begin_[__i];} 832227825Stheraven 833227825Stheraven _LIBCPP_INLINE_VISIBILITY 834227825Stheraven value_type& operator[](size_t __i) {return __begin_[__i];} 835227825Stheraven 836227825Stheraven // subset operations: 837227825Stheraven __val_expr<__slice_expr<const valarray&> > operator[](slice __s) const; 838227825Stheraven slice_array<value_type> operator[](slice __s); 839227825Stheraven __val_expr<__indirect_expr<const valarray&> > operator[](const gslice& __gs) const; 840227825Stheraven gslice_array<value_type> operator[](const gslice& __gs); 841227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 842227825Stheraven __val_expr<__indirect_expr<const valarray&> > operator[](gslice&& __gs) const; 843227825Stheraven gslice_array<value_type> operator[](gslice&& __gs); 844227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 845227825Stheraven __val_expr<__mask_expr<const valarray&> > operator[](const valarray<bool>& __vb) const; 846227825Stheraven mask_array<value_type> operator[](const valarray<bool>& __vb); 847227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 848227825Stheraven __val_expr<__mask_expr<const valarray&> > operator[](valarray<bool>&& __vb) const; 849227825Stheraven mask_array<value_type> operator[](valarray<bool>&& __vb); 850227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 851227825Stheraven __val_expr<__indirect_expr<const valarray&> > operator[](const valarray<size_t>& __vs) const; 852227825Stheraven indirect_array<value_type> operator[](const valarray<size_t>& __vs); 853227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 854227825Stheraven __val_expr<__indirect_expr<const valarray&> > operator[](valarray<size_t>&& __vs) const; 855227825Stheraven indirect_array<value_type> operator[](valarray<size_t>&& __vs); 856227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 857227825Stheraven 858227825Stheraven // unary operators: 859227825Stheraven valarray operator+() const; 860227825Stheraven valarray operator-() const; 861227825Stheraven valarray operator~() const; 862227825Stheraven valarray<bool> operator!() const; 863227825Stheraven 864227825Stheraven // computed assignment: 865227825Stheraven valarray& operator*= (const value_type& __x); 866227825Stheraven valarray& operator/= (const value_type& __x); 867227825Stheraven valarray& operator%= (const value_type& __x); 868227825Stheraven valarray& operator+= (const value_type& __x); 869227825Stheraven valarray& operator-= (const value_type& __x); 870227825Stheraven valarray& operator^= (const value_type& __x); 871227825Stheraven valarray& operator&= (const value_type& __x); 872227825Stheraven valarray& operator|= (const value_type& __x); 873227825Stheraven valarray& operator<<=(const value_type& __x); 874227825Stheraven valarray& operator>>=(const value_type& __x); 875227825Stheraven 876227825Stheraven template <class _Expr> 877227825Stheraven typename enable_if 878227825Stheraven < 879227825Stheraven __is_val_expr<_Expr>::value, 880227825Stheraven valarray& 881227825Stheraven >::type 882227825Stheraven operator*= (const _Expr& __v); 883227825Stheraven 884227825Stheraven template <class _Expr> 885227825Stheraven typename enable_if 886227825Stheraven < 887227825Stheraven __is_val_expr<_Expr>::value, 888227825Stheraven valarray& 889227825Stheraven >::type 890227825Stheraven operator/= (const _Expr& __v); 891227825Stheraven 892227825Stheraven template <class _Expr> 893227825Stheraven typename enable_if 894227825Stheraven < 895227825Stheraven __is_val_expr<_Expr>::value, 896227825Stheraven valarray& 897227825Stheraven >::type 898227825Stheraven operator%= (const _Expr& __v); 899227825Stheraven 900227825Stheraven template <class _Expr> 901227825Stheraven typename enable_if 902227825Stheraven < 903227825Stheraven __is_val_expr<_Expr>::value, 904227825Stheraven valarray& 905227825Stheraven >::type 906227825Stheraven operator+= (const _Expr& __v); 907227825Stheraven 908227825Stheraven template <class _Expr> 909227825Stheraven typename enable_if 910227825Stheraven < 911227825Stheraven __is_val_expr<_Expr>::value, 912227825Stheraven valarray& 913227825Stheraven >::type 914227825Stheraven operator-= (const _Expr& __v); 915227825Stheraven 916227825Stheraven template <class _Expr> 917227825Stheraven typename enable_if 918227825Stheraven < 919227825Stheraven __is_val_expr<_Expr>::value, 920227825Stheraven valarray& 921227825Stheraven >::type 922227825Stheraven operator^= (const _Expr& __v); 923227825Stheraven 924227825Stheraven template <class _Expr> 925227825Stheraven typename enable_if 926227825Stheraven < 927227825Stheraven __is_val_expr<_Expr>::value, 928227825Stheraven valarray& 929227825Stheraven >::type 930227825Stheraven operator|= (const _Expr& __v); 931227825Stheraven 932227825Stheraven template <class _Expr> 933227825Stheraven typename enable_if 934227825Stheraven < 935227825Stheraven __is_val_expr<_Expr>::value, 936227825Stheraven valarray& 937227825Stheraven >::type 938227825Stheraven operator&= (const _Expr& __v); 939227825Stheraven 940227825Stheraven template <class _Expr> 941227825Stheraven typename enable_if 942227825Stheraven < 943227825Stheraven __is_val_expr<_Expr>::value, 944227825Stheraven valarray& 945227825Stheraven >::type 946227825Stheraven operator<<= (const _Expr& __v); 947227825Stheraven 948227825Stheraven template <class _Expr> 949227825Stheraven typename enable_if 950227825Stheraven < 951227825Stheraven __is_val_expr<_Expr>::value, 952227825Stheraven valarray& 953227825Stheraven >::type 954227825Stheraven operator>>= (const _Expr& __v); 955227825Stheraven 956227825Stheraven // member functions: 957227825Stheraven void swap(valarray& __v); 958227825Stheraven 959227825Stheraven _LIBCPP_INLINE_VISIBILITY 960227825Stheraven size_t size() const {return __end_ - __begin_;} 961227825Stheraven 962227825Stheraven value_type sum() const; 963227825Stheraven value_type min() const; 964227825Stheraven value_type max() const; 965227825Stheraven 966227825Stheraven valarray shift (int __i) const; 967227825Stheraven valarray cshift(int __i) const; 968227825Stheraven valarray apply(value_type __f(value_type)) const; 969227825Stheraven valarray apply(value_type __f(const value_type&)) const; 970227825Stheraven void resize(size_t __n, value_type __x = value_type()); 971227825Stheraven 972227825Stheravenprivate: 973227825Stheraven template <class> friend class _LIBCPP_VISIBLE valarray; 974227825Stheraven template <class> friend class _LIBCPP_VISIBLE slice_array; 975227825Stheraven template <class> friend class _LIBCPP_VISIBLE gslice_array; 976227825Stheraven template <class> friend class _LIBCPP_VISIBLE mask_array; 977227825Stheraven template <class> friend class __mask_expr; 978227825Stheraven template <class> friend class _LIBCPP_VISIBLE indirect_array; 979227825Stheraven template <class> friend class __indirect_expr; 980227825Stheraven template <class> friend class __val_expr; 981227825Stheraven 982227825Stheraven template <class _Up> 983227825Stheraven friend 984227825Stheraven _Up* 985227825Stheraven begin(valarray<_Up>& __v); 986227825Stheraven 987227825Stheraven template <class _Up> 988227825Stheraven friend 989227825Stheraven const _Up* 990227825Stheraven begin(const valarray<_Up>& __v); 991227825Stheraven 992227825Stheraven template <class _Up> 993227825Stheraven friend 994227825Stheraven _Up* 995227825Stheraven end(valarray<_Up>& __v); 996227825Stheraven 997227825Stheraven template <class _Up> 998227825Stheraven friend 999227825Stheraven const _Up* 1000227825Stheraven end(const valarray<_Up>& __v); 1001227825Stheraven}; 1002227825Stheraven 1003227825Stheraventemplate <class _Op, class _Tp> 1004227825Stheravenstruct _UnaryOp<_Op, valarray<_Tp> > 1005227825Stheraven{ 1006227825Stheraven typedef typename _Op::result_type result_type; 1007227825Stheraven typedef _Tp value_type; 1008227825Stheraven 1009227825Stheraven _Op __op_; 1010227825Stheraven const valarray<_Tp>& __a0_; 1011227825Stheraven 1012227825Stheraven _LIBCPP_INLINE_VISIBILITY 1013227825Stheraven _UnaryOp(const _Op& __op, const valarray<_Tp>& __a0) : __op_(__op), __a0_(__a0) {} 1014227825Stheraven 1015227825Stheraven _LIBCPP_INLINE_VISIBILITY 1016227825Stheraven result_type operator[](size_t __i) const {return __op_(__a0_[__i]);} 1017227825Stheraven 1018227825Stheraven _LIBCPP_INLINE_VISIBILITY 1019227825Stheraven size_t size() const {return __a0_.size();} 1020227825Stheraven}; 1021227825Stheraven 1022227825Stheraventemplate <class _Op, class _Tp, class _A1> 1023227825Stheravenstruct _BinaryOp<_Op, valarray<_Tp>, _A1> 1024227825Stheraven{ 1025227825Stheraven typedef typename _Op::result_type result_type; 1026227825Stheraven typedef _Tp value_type; 1027227825Stheraven 1028227825Stheraven _Op __op_; 1029227825Stheraven const valarray<_Tp>& __a0_; 1030227825Stheraven _A1 __a1_; 1031227825Stheraven 1032227825Stheraven _LIBCPP_INLINE_VISIBILITY 1033227825Stheraven _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const _A1& __a1) 1034227825Stheraven : __op_(__op), __a0_(__a0), __a1_(__a1) {} 1035227825Stheraven 1036227825Stheraven _LIBCPP_INLINE_VISIBILITY 1037227825Stheraven value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);} 1038227825Stheraven 1039227825Stheraven _LIBCPP_INLINE_VISIBILITY 1040227825Stheraven size_t size() const {return __a0_.size();} 1041227825Stheraven}; 1042227825Stheraven 1043227825Stheraventemplate <class _Op, class _A0, class _Tp> 1044227825Stheravenstruct _BinaryOp<_Op, _A0, valarray<_Tp> > 1045227825Stheraven{ 1046227825Stheraven typedef typename _Op::result_type result_type; 1047227825Stheraven typedef _Tp value_type; 1048227825Stheraven 1049227825Stheraven _Op __op_; 1050227825Stheraven _A0 __a0_; 1051227825Stheraven const valarray<_Tp>& __a1_; 1052227825Stheraven 1053227825Stheraven _LIBCPP_INLINE_VISIBILITY 1054227825Stheraven _BinaryOp(const _Op& __op, const _A0& __a0, const valarray<_Tp>& __a1) 1055227825Stheraven : __op_(__op), __a0_(__a0), __a1_(__a1) {} 1056227825Stheraven 1057227825Stheraven _LIBCPP_INLINE_VISIBILITY 1058227825Stheraven value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);} 1059227825Stheraven 1060227825Stheraven _LIBCPP_INLINE_VISIBILITY 1061227825Stheraven size_t size() const {return __a0_.size();} 1062227825Stheraven}; 1063227825Stheraven 1064227825Stheraventemplate <class _Op, class _Tp> 1065227825Stheravenstruct _BinaryOp<_Op, valarray<_Tp>, valarray<_Tp> > 1066227825Stheraven{ 1067227825Stheraven typedef typename _Op::result_type result_type; 1068227825Stheraven typedef _Tp value_type; 1069227825Stheraven 1070227825Stheraven _Op __op_; 1071227825Stheraven const valarray<_Tp>& __a0_; 1072227825Stheraven const valarray<_Tp>& __a1_; 1073227825Stheraven 1074227825Stheraven _LIBCPP_INLINE_VISIBILITY 1075227825Stheraven _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const valarray<_Tp>& __a1) 1076227825Stheraven : __op_(__op), __a0_(__a0), __a1_(__a1) {} 1077227825Stheraven 1078227825Stheraven _LIBCPP_INLINE_VISIBILITY 1079227825Stheraven value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);} 1080227825Stheraven 1081227825Stheraven _LIBCPP_INLINE_VISIBILITY 1082227825Stheraven size_t size() const {return __a0_.size();} 1083227825Stheraven}; 1084227825Stheraven 1085227825Stheraven// slice_array 1086227825Stheraven 1087227825Stheraventemplate <class _Tp> 1088227825Stheravenclass _LIBCPP_VISIBLE slice_array 1089227825Stheraven{ 1090227825Stheravenpublic: 1091227825Stheraven typedef _Tp value_type; 1092227825Stheraven 1093227825Stheravenprivate: 1094227825Stheraven value_type* __vp_; 1095227825Stheraven size_t __size_; 1096227825Stheraven size_t __stride_; 1097227825Stheraven 1098227825Stheravenpublic: 1099227825Stheraven template <class _Expr> 1100227825Stheraven typename enable_if 1101227825Stheraven < 1102227825Stheraven __is_val_expr<_Expr>::value, 1103227825Stheraven void 1104227825Stheraven >::type 1105227825Stheraven operator=(const _Expr& __v) const; 1106227825Stheraven 1107227825Stheraven template <class _Expr> 1108227825Stheraven typename enable_if 1109227825Stheraven < 1110227825Stheraven __is_val_expr<_Expr>::value, 1111227825Stheraven void 1112227825Stheraven >::type 1113227825Stheraven operator*=(const _Expr& __v) const; 1114227825Stheraven 1115227825Stheraven template <class _Expr> 1116227825Stheraven typename enable_if 1117227825Stheraven < 1118227825Stheraven __is_val_expr<_Expr>::value, 1119227825Stheraven void 1120227825Stheraven >::type 1121227825Stheraven operator/=(const _Expr& __v) const; 1122227825Stheraven 1123227825Stheraven template <class _Expr> 1124227825Stheraven typename enable_if 1125227825Stheraven < 1126227825Stheraven __is_val_expr<_Expr>::value, 1127227825Stheraven void 1128227825Stheraven >::type 1129227825Stheraven operator%=(const _Expr& __v) const; 1130227825Stheraven 1131227825Stheraven template <class _Expr> 1132227825Stheraven typename enable_if 1133227825Stheraven < 1134227825Stheraven __is_val_expr<_Expr>::value, 1135227825Stheraven void 1136227825Stheraven >::type 1137227825Stheraven operator+=(const _Expr& __v) const; 1138227825Stheraven 1139227825Stheraven template <class _Expr> 1140227825Stheraven typename enable_if 1141227825Stheraven < 1142227825Stheraven __is_val_expr<_Expr>::value, 1143227825Stheraven void 1144227825Stheraven >::type 1145227825Stheraven operator-=(const _Expr& __v) const; 1146227825Stheraven 1147227825Stheraven template <class _Expr> 1148227825Stheraven typename enable_if 1149227825Stheraven < 1150227825Stheraven __is_val_expr<_Expr>::value, 1151227825Stheraven void 1152227825Stheraven >::type 1153227825Stheraven operator^=(const _Expr& __v) const; 1154227825Stheraven 1155227825Stheraven template <class _Expr> 1156227825Stheraven typename enable_if 1157227825Stheraven < 1158227825Stheraven __is_val_expr<_Expr>::value, 1159227825Stheraven void 1160227825Stheraven >::type 1161227825Stheraven operator&=(const _Expr& __v) const; 1162227825Stheraven 1163227825Stheraven template <class _Expr> 1164227825Stheraven typename enable_if 1165227825Stheraven < 1166227825Stheraven __is_val_expr<_Expr>::value, 1167227825Stheraven void 1168227825Stheraven >::type 1169227825Stheraven operator|=(const _Expr& __v) const; 1170227825Stheraven 1171227825Stheraven template <class _Expr> 1172227825Stheraven typename enable_if 1173227825Stheraven < 1174227825Stheraven __is_val_expr<_Expr>::value, 1175227825Stheraven void 1176227825Stheraven >::type 1177227825Stheraven operator<<=(const _Expr& __v) const; 1178227825Stheraven 1179227825Stheraven template <class _Expr> 1180227825Stheraven typename enable_if 1181227825Stheraven < 1182227825Stheraven __is_val_expr<_Expr>::value, 1183227825Stheraven void 1184227825Stheraven >::type 1185227825Stheraven operator>>=(const _Expr& __v) const; 1186227825Stheraven 1187227825Stheraven const slice_array& operator=(const slice_array& __sa) const; 1188227825Stheraven 1189227825Stheraven void operator=(const value_type& __x) const; 1190227825Stheraven 1191227825Stheravenprivate: 1192227825Stheraven _LIBCPP_INLINE_VISIBILITY 1193227825Stheraven slice_array(const slice& __sl, const valarray<value_type>& __v) 1194227825Stheraven : __vp_(const_cast<value_type*>(__v.__begin_ + __sl.start())), 1195227825Stheraven __size_(__sl.size()), 1196227825Stheraven __stride_(__sl.stride()) 1197227825Stheraven {} 1198227825Stheraven 1199227825Stheraven template <class> friend class valarray; 1200227825Stheraven template <class> friend class sliceExpr; 1201227825Stheraven}; 1202227825Stheraven 1203227825Stheraventemplate <class _Tp> 1204227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1205227825Stheravenconst slice_array<_Tp>& 1206227825Stheravenslice_array<_Tp>::operator=(const slice_array& __sa) const 1207227825Stheraven{ 1208227825Stheraven value_type* __t = __vp_; 1209227825Stheraven const value_type* __s = __sa.__vp_; 1210227825Stheraven for (size_t __n = __size_; __n; --__n, __t += __stride_, __s += __sa.__stride_) 1211227825Stheraven *__t = *__s; 1212227825Stheraven} 1213227825Stheraven 1214227825Stheraventemplate <class _Tp> 1215227825Stheraventemplate <class _Expr> 1216227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1217227825Stheraventypename enable_if 1218227825Stheraven< 1219227825Stheraven __is_val_expr<_Expr>::value, 1220227825Stheraven void 1221227825Stheraven>::type 1222227825Stheravenslice_array<_Tp>::operator=(const _Expr& __v) const 1223227825Stheraven{ 1224227825Stheraven value_type* __t = __vp_; 1225227825Stheraven for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_) 1226227825Stheraven *__t = __v[__i]; 1227227825Stheraven} 1228227825Stheraven 1229227825Stheraventemplate <class _Tp> 1230227825Stheraventemplate <class _Expr> 1231227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1232227825Stheraventypename enable_if 1233227825Stheraven< 1234227825Stheraven __is_val_expr<_Expr>::value, 1235227825Stheraven void 1236227825Stheraven>::type 1237227825Stheravenslice_array<_Tp>::operator*=(const _Expr& __v) const 1238227825Stheraven{ 1239227825Stheraven value_type* __t = __vp_; 1240227825Stheraven for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_) 1241227825Stheraven *__t *= __v[__i]; 1242227825Stheraven} 1243227825Stheraven 1244227825Stheraventemplate <class _Tp> 1245227825Stheraventemplate <class _Expr> 1246227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1247227825Stheraventypename enable_if 1248227825Stheraven< 1249227825Stheraven __is_val_expr<_Expr>::value, 1250227825Stheraven void 1251227825Stheraven>::type 1252227825Stheravenslice_array<_Tp>::operator/=(const _Expr& __v) const 1253227825Stheraven{ 1254227825Stheraven value_type* __t = __vp_; 1255227825Stheraven for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_) 1256227825Stheraven *__t /= __v[__i]; 1257227825Stheraven} 1258227825Stheraven 1259227825Stheraventemplate <class _Tp> 1260227825Stheraventemplate <class _Expr> 1261227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1262227825Stheraventypename enable_if 1263227825Stheraven< 1264227825Stheraven __is_val_expr<_Expr>::value, 1265227825Stheraven void 1266227825Stheraven>::type 1267227825Stheravenslice_array<_Tp>::operator%=(const _Expr& __v) const 1268227825Stheraven{ 1269227825Stheraven value_type* __t = __vp_; 1270227825Stheraven for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_) 1271227825Stheraven *__t %= __v[__i]; 1272227825Stheraven} 1273227825Stheraven 1274227825Stheraventemplate <class _Tp> 1275227825Stheraventemplate <class _Expr> 1276227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1277227825Stheraventypename enable_if 1278227825Stheraven< 1279227825Stheraven __is_val_expr<_Expr>::value, 1280227825Stheraven void 1281227825Stheraven>::type 1282227825Stheravenslice_array<_Tp>::operator+=(const _Expr& __v) const 1283227825Stheraven{ 1284227825Stheraven value_type* __t = __vp_; 1285227825Stheraven for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_) 1286227825Stheraven *__t += __v[__i]; 1287227825Stheraven} 1288227825Stheraven 1289227825Stheraventemplate <class _Tp> 1290227825Stheraventemplate <class _Expr> 1291227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1292227825Stheraventypename enable_if 1293227825Stheraven< 1294227825Stheraven __is_val_expr<_Expr>::value, 1295227825Stheraven void 1296227825Stheraven>::type 1297227825Stheravenslice_array<_Tp>::operator-=(const _Expr& __v) const 1298227825Stheraven{ 1299227825Stheraven value_type* __t = __vp_; 1300227825Stheraven for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_) 1301227825Stheraven *__t -= __v[__i]; 1302227825Stheraven} 1303227825Stheraven 1304227825Stheraventemplate <class _Tp> 1305227825Stheraventemplate <class _Expr> 1306227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1307227825Stheraventypename enable_if 1308227825Stheraven< 1309227825Stheraven __is_val_expr<_Expr>::value, 1310227825Stheraven void 1311227825Stheraven>::type 1312227825Stheravenslice_array<_Tp>::operator^=(const _Expr& __v) const 1313227825Stheraven{ 1314227825Stheraven value_type* __t = __vp_; 1315227825Stheraven for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_) 1316227825Stheraven *__t ^= __v[__i]; 1317227825Stheraven} 1318227825Stheraven 1319227825Stheraventemplate <class _Tp> 1320227825Stheraventemplate <class _Expr> 1321227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1322227825Stheraventypename enable_if 1323227825Stheraven< 1324227825Stheraven __is_val_expr<_Expr>::value, 1325227825Stheraven void 1326227825Stheraven>::type 1327227825Stheravenslice_array<_Tp>::operator&=(const _Expr& __v) const 1328227825Stheraven{ 1329227825Stheraven value_type* __t = __vp_; 1330227825Stheraven for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_) 1331227825Stheraven *__t &= __v[__i]; 1332227825Stheraven} 1333227825Stheraven 1334227825Stheraventemplate <class _Tp> 1335227825Stheraventemplate <class _Expr> 1336227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1337227825Stheraventypename enable_if 1338227825Stheraven< 1339227825Stheraven __is_val_expr<_Expr>::value, 1340227825Stheraven void 1341227825Stheraven>::type 1342227825Stheravenslice_array<_Tp>::operator|=(const _Expr& __v) const 1343227825Stheraven{ 1344227825Stheraven value_type* __t = __vp_; 1345227825Stheraven for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_) 1346227825Stheraven *__t |= __v[__i]; 1347227825Stheraven} 1348227825Stheraven 1349227825Stheraventemplate <class _Tp> 1350227825Stheraventemplate <class _Expr> 1351227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1352227825Stheraventypename enable_if 1353227825Stheraven< 1354227825Stheraven __is_val_expr<_Expr>::value, 1355227825Stheraven void 1356227825Stheraven>::type 1357227825Stheravenslice_array<_Tp>::operator<<=(const _Expr& __v) const 1358227825Stheraven{ 1359227825Stheraven value_type* __t = __vp_; 1360227825Stheraven for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_) 1361227825Stheraven *__t <<= __v[__i]; 1362227825Stheraven} 1363227825Stheraven 1364227825Stheraventemplate <class _Tp> 1365227825Stheraventemplate <class _Expr> 1366227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1367227825Stheraventypename enable_if 1368227825Stheraven< 1369227825Stheraven __is_val_expr<_Expr>::value, 1370227825Stheraven void 1371227825Stheraven>::type 1372227825Stheravenslice_array<_Tp>::operator>>=(const _Expr& __v) const 1373227825Stheraven{ 1374227825Stheraven value_type* __t = __vp_; 1375227825Stheraven for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_) 1376227825Stheraven *__t >>= __v[__i]; 1377227825Stheraven} 1378227825Stheraven 1379227825Stheraventemplate <class _Tp> 1380227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1381227825Stheravenvoid 1382227825Stheravenslice_array<_Tp>::operator=(const value_type& __x) const 1383227825Stheraven{ 1384227825Stheraven value_type* __t = __vp_; 1385227825Stheraven for (size_t __n = __size_; __n; --__n, __t += __stride_) 1386227825Stheraven *__t = __x; 1387227825Stheraven} 1388227825Stheraven 1389227825Stheraven// gslice 1390227825Stheraven 1391227825Stheravenclass _LIBCPP_VISIBLE gslice 1392227825Stheraven{ 1393227825Stheraven valarray<size_t> __size_; 1394227825Stheraven valarray<size_t> __stride_; 1395227825Stheraven valarray<size_t> __1d_; 1396227825Stheraven 1397227825Stheravenpublic: 1398227825Stheraven _LIBCPP_INLINE_VISIBILITY 1399227825Stheraven gslice() {} 1400227825Stheraven 1401227825Stheraven _LIBCPP_INLINE_VISIBILITY 1402227825Stheraven gslice(size_t __start, const valarray<size_t>& __size, 1403227825Stheraven const valarray<size_t>& __stride) 1404227825Stheraven : __size_(__size), 1405227825Stheraven __stride_(__stride) 1406227825Stheraven {__init(__start);} 1407227825Stheraven 1408227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1409227825Stheraven 1410227825Stheraven _LIBCPP_INLINE_VISIBILITY 1411227825Stheraven gslice(size_t __start, const valarray<size_t>& __size, 1412227825Stheraven valarray<size_t>&& __stride) 1413227825Stheraven : __size_(__size), 1414227825Stheraven __stride_(move(__stride)) 1415227825Stheraven {__init(__start);} 1416227825Stheraven 1417227825Stheraven _LIBCPP_INLINE_VISIBILITY 1418227825Stheraven gslice(size_t __start, valarray<size_t>&& __size, 1419227825Stheraven const valarray<size_t>& __stride) 1420227825Stheraven : __size_(move(__size)), 1421227825Stheraven __stride_(__stride) 1422227825Stheraven {__init(__start);} 1423227825Stheraven 1424227825Stheraven _LIBCPP_INLINE_VISIBILITY 1425227825Stheraven gslice(size_t __start, valarray<size_t>&& __size, 1426227825Stheraven valarray<size_t>&& __stride) 1427227825Stheraven : __size_(move(__size)), 1428227825Stheraven __stride_(move(__stride)) 1429227825Stheraven {__init(__start);} 1430227825Stheraven 1431227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1432227825Stheraven 1433227825Stheraven// gslice(const gslice&) = default; 1434227825Stheraven// gslice(gslice&&) = default; 1435227825Stheraven// gslice& operator=(const gslice&) = default; 1436227825Stheraven// gslice& operator=(gslice&&) = default; 1437227825Stheraven 1438227825Stheraven _LIBCPP_INLINE_VISIBILITY 1439227825Stheraven size_t start() const {return __1d_.size() ? __1d_[0] : 0;} 1440227825Stheraven 1441227825Stheraven _LIBCPP_INLINE_VISIBILITY 1442227825Stheraven valarray<size_t> size() const {return __size_;} 1443227825Stheraven 1444227825Stheraven _LIBCPP_INLINE_VISIBILITY 1445227825Stheraven valarray<size_t> stride() const {return __stride_;} 1446227825Stheraven 1447227825Stheravenprivate: 1448227825Stheraven void __init(size_t __start); 1449227825Stheraven 1450227825Stheraven template <class> friend class gslice_array; 1451227825Stheraven template <class> friend class valarray; 1452227825Stheraven template <class> friend class __val_expr; 1453227825Stheraven}; 1454227825Stheraven 1455227825Stheraven// gslice_array 1456227825Stheraven 1457227825Stheraventemplate <class _Tp> 1458227825Stheravenclass _LIBCPP_VISIBLE gslice_array 1459227825Stheraven{ 1460227825Stheravenpublic: 1461227825Stheraven typedef _Tp value_type; 1462227825Stheraven 1463227825Stheravenprivate: 1464227825Stheraven value_type* __vp_; 1465227825Stheraven valarray<size_t> __1d_; 1466227825Stheraven 1467227825Stheravenpublic: 1468227825Stheraven template <class _Expr> 1469227825Stheraven typename enable_if 1470227825Stheraven < 1471227825Stheraven __is_val_expr<_Expr>::value, 1472227825Stheraven void 1473227825Stheraven >::type 1474227825Stheraven operator=(const _Expr& __v) const; 1475227825Stheraven 1476227825Stheraven template <class _Expr> 1477227825Stheraven typename enable_if 1478227825Stheraven < 1479227825Stheraven __is_val_expr<_Expr>::value, 1480227825Stheraven void 1481227825Stheraven >::type 1482227825Stheraven operator*=(const _Expr& __v) const; 1483227825Stheraven 1484227825Stheraven template <class _Expr> 1485227825Stheraven typename enable_if 1486227825Stheraven < 1487227825Stheraven __is_val_expr<_Expr>::value, 1488227825Stheraven void 1489227825Stheraven >::type 1490227825Stheraven operator/=(const _Expr& __v) const; 1491227825Stheraven 1492227825Stheraven template <class _Expr> 1493227825Stheraven typename enable_if 1494227825Stheraven < 1495227825Stheraven __is_val_expr<_Expr>::value, 1496227825Stheraven void 1497227825Stheraven >::type 1498227825Stheraven operator%=(const _Expr& __v) const; 1499227825Stheraven 1500227825Stheraven template <class _Expr> 1501227825Stheraven typename enable_if 1502227825Stheraven < 1503227825Stheraven __is_val_expr<_Expr>::value, 1504227825Stheraven void 1505227825Stheraven >::type 1506227825Stheraven operator+=(const _Expr& __v) const; 1507227825Stheraven 1508227825Stheraven template <class _Expr> 1509227825Stheraven typename enable_if 1510227825Stheraven < 1511227825Stheraven __is_val_expr<_Expr>::value, 1512227825Stheraven void 1513227825Stheraven >::type 1514227825Stheraven operator-=(const _Expr& __v) const; 1515227825Stheraven 1516227825Stheraven template <class _Expr> 1517227825Stheraven typename enable_if 1518227825Stheraven < 1519227825Stheraven __is_val_expr<_Expr>::value, 1520227825Stheraven void 1521227825Stheraven >::type 1522227825Stheraven operator^=(const _Expr& __v) const; 1523227825Stheraven 1524227825Stheraven template <class _Expr> 1525227825Stheraven typename enable_if 1526227825Stheraven < 1527227825Stheraven __is_val_expr<_Expr>::value, 1528227825Stheraven void 1529227825Stheraven >::type 1530227825Stheraven operator&=(const _Expr& __v) const; 1531227825Stheraven 1532227825Stheraven template <class _Expr> 1533227825Stheraven typename enable_if 1534227825Stheraven < 1535227825Stheraven __is_val_expr<_Expr>::value, 1536227825Stheraven void 1537227825Stheraven >::type 1538227825Stheraven operator|=(const _Expr& __v) const; 1539227825Stheraven 1540227825Stheraven template <class _Expr> 1541227825Stheraven typename enable_if 1542227825Stheraven < 1543227825Stheraven __is_val_expr<_Expr>::value, 1544227825Stheraven void 1545227825Stheraven >::type 1546227825Stheraven operator<<=(const _Expr& __v) const; 1547227825Stheraven 1548227825Stheraven template <class _Expr> 1549227825Stheraven typename enable_if 1550227825Stheraven < 1551227825Stheraven __is_val_expr<_Expr>::value, 1552227825Stheraven void 1553227825Stheraven >::type 1554227825Stheraven operator>>=(const _Expr& __v) const; 1555227825Stheraven 1556227825Stheraven const gslice_array& operator=(const gslice_array& __ga) const; 1557227825Stheraven 1558227825Stheraven void operator=(const value_type& __x) const; 1559227825Stheraven 1560227825Stheraven// gslice_array(const gslice_array&) = default; 1561227825Stheraven// gslice_array(gslice_array&&) = default; 1562227825Stheraven// gslice_array& operator=(const gslice_array&) = default; 1563227825Stheraven// gslice_array& operator=(gslice_array&&) = default; 1564227825Stheraven 1565227825Stheravenprivate: 1566227825Stheraven _LIBCPP_INLINE_VISIBILITY 1567227825Stheraven gslice_array(const gslice& __gs, const valarray<value_type>& __v) 1568227825Stheraven : __vp_(const_cast<value_type*>(__v.__begin_)), 1569227825Stheraven __1d_(__gs.__1d_) 1570227825Stheraven {} 1571227825Stheraven 1572227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1573227825Stheraven 1574227825Stheraven _LIBCPP_INLINE_VISIBILITY 1575227825Stheraven gslice_array(gslice&& __gs, const valarray<value_type>& __v) 1576227825Stheraven : __vp_(const_cast<value_type*>(__v.__begin_)), 1577227825Stheraven __1d_(move(__gs.__1d_)) 1578227825Stheraven {} 1579227825Stheraven 1580227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1581227825Stheraven 1582227825Stheraven template <class> friend class valarray; 1583227825Stheraven}; 1584227825Stheraven 1585227825Stheraventemplate <class _Tp> 1586227825Stheraventemplate <class _Expr> 1587227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1588227825Stheraventypename enable_if 1589227825Stheraven< 1590227825Stheraven __is_val_expr<_Expr>::value, 1591227825Stheraven void 1592227825Stheraven>::type 1593227825Stheravengslice_array<_Tp>::operator=(const _Expr& __v) const 1594227825Stheraven{ 1595227825Stheraven typedef const size_t* _Ip; 1596227825Stheraven size_t __j = 0; 1597227825Stheraven for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j) 1598227825Stheraven __vp_[*__i] = __v[__j]; 1599227825Stheraven} 1600227825Stheraven 1601227825Stheraventemplate <class _Tp> 1602227825Stheraventemplate <class _Expr> 1603227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1604227825Stheraventypename enable_if 1605227825Stheraven< 1606227825Stheraven __is_val_expr<_Expr>::value, 1607227825Stheraven void 1608227825Stheraven>::type 1609227825Stheravengslice_array<_Tp>::operator*=(const _Expr& __v) const 1610227825Stheraven{ 1611227825Stheraven typedef const size_t* _Ip; 1612227825Stheraven size_t __j = 0; 1613227825Stheraven for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j) 1614227825Stheraven __vp_[*__i] *= __v[__j]; 1615227825Stheraven} 1616227825Stheraven 1617227825Stheraventemplate <class _Tp> 1618227825Stheraventemplate <class _Expr> 1619227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1620227825Stheraventypename enable_if 1621227825Stheraven< 1622227825Stheraven __is_val_expr<_Expr>::value, 1623227825Stheraven void 1624227825Stheraven>::type 1625227825Stheravengslice_array<_Tp>::operator/=(const _Expr& __v) const 1626227825Stheraven{ 1627227825Stheraven typedef const size_t* _Ip; 1628227825Stheraven size_t __j = 0; 1629227825Stheraven for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j) 1630227825Stheraven __vp_[*__i] /= __v[__j]; 1631227825Stheraven} 1632227825Stheraven 1633227825Stheraventemplate <class _Tp> 1634227825Stheraventemplate <class _Expr> 1635227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1636227825Stheraventypename enable_if 1637227825Stheraven< 1638227825Stheraven __is_val_expr<_Expr>::value, 1639227825Stheraven void 1640227825Stheraven>::type 1641227825Stheravengslice_array<_Tp>::operator%=(const _Expr& __v) const 1642227825Stheraven{ 1643227825Stheraven typedef const size_t* _Ip; 1644227825Stheraven size_t __j = 0; 1645227825Stheraven for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j) 1646227825Stheraven __vp_[*__i] %= __v[__j]; 1647227825Stheraven} 1648227825Stheraven 1649227825Stheraventemplate <class _Tp> 1650227825Stheraventemplate <class _Expr> 1651227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1652227825Stheraventypename enable_if 1653227825Stheraven< 1654227825Stheraven __is_val_expr<_Expr>::value, 1655227825Stheraven void 1656227825Stheraven>::type 1657227825Stheravengslice_array<_Tp>::operator+=(const _Expr& __v) const 1658227825Stheraven{ 1659227825Stheraven typedef const size_t* _Ip; 1660227825Stheraven size_t __j = 0; 1661227825Stheraven for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j) 1662227825Stheraven __vp_[*__i] += __v[__j]; 1663227825Stheraven} 1664227825Stheraven 1665227825Stheraventemplate <class _Tp> 1666227825Stheraventemplate <class _Expr> 1667227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1668227825Stheraventypename enable_if 1669227825Stheraven< 1670227825Stheraven __is_val_expr<_Expr>::value, 1671227825Stheraven void 1672227825Stheraven>::type 1673227825Stheravengslice_array<_Tp>::operator-=(const _Expr& __v) const 1674227825Stheraven{ 1675227825Stheraven typedef const size_t* _Ip; 1676227825Stheraven size_t __j = 0; 1677227825Stheraven for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j) 1678227825Stheraven __vp_[*__i] -= __v[__j]; 1679227825Stheraven} 1680227825Stheraven 1681227825Stheraventemplate <class _Tp> 1682227825Stheraventemplate <class _Expr> 1683227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1684227825Stheraventypename enable_if 1685227825Stheraven< 1686227825Stheraven __is_val_expr<_Expr>::value, 1687227825Stheraven void 1688227825Stheraven>::type 1689227825Stheravengslice_array<_Tp>::operator^=(const _Expr& __v) const 1690227825Stheraven{ 1691227825Stheraven typedef const size_t* _Ip; 1692227825Stheraven size_t __j = 0; 1693227825Stheraven for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j) 1694227825Stheraven __vp_[*__i] ^= __v[__j]; 1695227825Stheraven} 1696227825Stheraven 1697227825Stheraventemplate <class _Tp> 1698227825Stheraventemplate <class _Expr> 1699227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1700227825Stheraventypename enable_if 1701227825Stheraven< 1702227825Stheraven __is_val_expr<_Expr>::value, 1703227825Stheraven void 1704227825Stheraven>::type 1705227825Stheravengslice_array<_Tp>::operator&=(const _Expr& __v) const 1706227825Stheraven{ 1707227825Stheraven typedef const size_t* _Ip; 1708227825Stheraven size_t __j = 0; 1709227825Stheraven for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j) 1710227825Stheraven __vp_[*__i] &= __v[__j]; 1711227825Stheraven} 1712227825Stheraven 1713227825Stheraventemplate <class _Tp> 1714227825Stheraventemplate <class _Expr> 1715227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1716227825Stheraventypename enable_if 1717227825Stheraven< 1718227825Stheraven __is_val_expr<_Expr>::value, 1719227825Stheraven void 1720227825Stheraven>::type 1721227825Stheravengslice_array<_Tp>::operator|=(const _Expr& __v) const 1722227825Stheraven{ 1723227825Stheraven typedef const size_t* _Ip; 1724227825Stheraven size_t __j = 0; 1725227825Stheraven for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j) 1726227825Stheraven __vp_[*__i] |= __v[__j]; 1727227825Stheraven} 1728227825Stheraven 1729227825Stheraventemplate <class _Tp> 1730227825Stheraventemplate <class _Expr> 1731227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1732227825Stheraventypename enable_if 1733227825Stheraven< 1734227825Stheraven __is_val_expr<_Expr>::value, 1735227825Stheraven void 1736227825Stheraven>::type 1737227825Stheravengslice_array<_Tp>::operator<<=(const _Expr& __v) const 1738227825Stheraven{ 1739227825Stheraven typedef const size_t* _Ip; 1740227825Stheraven size_t __j = 0; 1741227825Stheraven for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j) 1742227825Stheraven __vp_[*__i] <<= __v[__j]; 1743227825Stheraven} 1744227825Stheraven 1745227825Stheraventemplate <class _Tp> 1746227825Stheraventemplate <class _Expr> 1747227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1748227825Stheraventypename enable_if 1749227825Stheraven< 1750227825Stheraven __is_val_expr<_Expr>::value, 1751227825Stheraven void 1752227825Stheraven>::type 1753227825Stheravengslice_array<_Tp>::operator>>=(const _Expr& __v) const 1754227825Stheraven{ 1755227825Stheraven typedef const size_t* _Ip; 1756227825Stheraven size_t __j = 0; 1757227825Stheraven for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j) 1758227825Stheraven __vp_[*__i] >>= __v[__j]; 1759227825Stheraven} 1760227825Stheraven 1761227825Stheraventemplate <class _Tp> 1762227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1763227825Stheravenconst gslice_array<_Tp>& 1764227825Stheravengslice_array<_Tp>::operator=(const gslice_array& __ga) const 1765227825Stheraven{ 1766227825Stheraven typedef const size_t* _Ip; 1767227825Stheraven const value_type* __s = __ga.__vp_; 1768227825Stheraven for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ga.__1d_.__begin_; 1769227825Stheraven __i != __e; ++__i, ++__j) 1770227825Stheraven __vp_[*__i] = __s[*__j]; 1771227825Stheraven return *this; 1772227825Stheraven} 1773227825Stheraven 1774227825Stheraventemplate <class _Tp> 1775227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1776227825Stheravenvoid 1777227825Stheravengslice_array<_Tp>::operator=(const value_type& __x) const 1778227825Stheraven{ 1779227825Stheraven typedef const size_t* _Ip; 1780227825Stheraven for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i) 1781227825Stheraven __vp_[*__i] = __x; 1782227825Stheraven} 1783227825Stheraven 1784227825Stheraven// mask_array 1785227825Stheraven 1786227825Stheraventemplate <class _Tp> 1787227825Stheravenclass _LIBCPP_VISIBLE mask_array 1788227825Stheraven{ 1789227825Stheravenpublic: 1790227825Stheraven typedef _Tp value_type; 1791227825Stheraven 1792227825Stheravenprivate: 1793227825Stheraven value_type* __vp_; 1794227825Stheraven valarray<size_t> __1d_; 1795227825Stheraven 1796227825Stheravenpublic: 1797227825Stheraven template <class _Expr> 1798227825Stheraven typename enable_if 1799227825Stheraven < 1800227825Stheraven __is_val_expr<_Expr>::value, 1801227825Stheraven void 1802227825Stheraven >::type 1803227825Stheraven operator=(const _Expr& __v) const; 1804227825Stheraven 1805227825Stheraven template <class _Expr> 1806227825Stheraven typename enable_if 1807227825Stheraven < 1808227825Stheraven __is_val_expr<_Expr>::value, 1809227825Stheraven void 1810227825Stheraven >::type 1811227825Stheraven operator*=(const _Expr& __v) const; 1812227825Stheraven 1813227825Stheraven template <class _Expr> 1814227825Stheraven typename enable_if 1815227825Stheraven < 1816227825Stheraven __is_val_expr<_Expr>::value, 1817227825Stheraven void 1818227825Stheraven >::type 1819227825Stheraven operator/=(const _Expr& __v) const; 1820227825Stheraven 1821227825Stheraven template <class _Expr> 1822227825Stheraven typename enable_if 1823227825Stheraven < 1824227825Stheraven __is_val_expr<_Expr>::value, 1825227825Stheraven void 1826227825Stheraven >::type 1827227825Stheraven operator%=(const _Expr& __v) const; 1828227825Stheraven 1829227825Stheraven template <class _Expr> 1830227825Stheraven typename enable_if 1831227825Stheraven < 1832227825Stheraven __is_val_expr<_Expr>::value, 1833227825Stheraven void 1834227825Stheraven >::type 1835227825Stheraven operator+=(const _Expr& __v) const; 1836227825Stheraven 1837227825Stheraven template <class _Expr> 1838227825Stheraven typename enable_if 1839227825Stheraven < 1840227825Stheraven __is_val_expr<_Expr>::value, 1841227825Stheraven void 1842227825Stheraven >::type 1843227825Stheraven operator-=(const _Expr& __v) const; 1844227825Stheraven 1845227825Stheraven template <class _Expr> 1846227825Stheraven typename enable_if 1847227825Stheraven < 1848227825Stheraven __is_val_expr<_Expr>::value, 1849227825Stheraven void 1850227825Stheraven >::type 1851227825Stheraven operator^=(const _Expr& __v) const; 1852227825Stheraven 1853227825Stheraven template <class _Expr> 1854227825Stheraven typename enable_if 1855227825Stheraven < 1856227825Stheraven __is_val_expr<_Expr>::value, 1857227825Stheraven void 1858227825Stheraven >::type 1859227825Stheraven operator&=(const _Expr& __v) const; 1860227825Stheraven 1861227825Stheraven template <class _Expr> 1862227825Stheraven typename enable_if 1863227825Stheraven < 1864227825Stheraven __is_val_expr<_Expr>::value, 1865227825Stheraven void 1866227825Stheraven >::type 1867227825Stheraven operator|=(const _Expr& __v) const; 1868227825Stheraven 1869227825Stheraven template <class _Expr> 1870227825Stheraven typename enable_if 1871227825Stheraven < 1872227825Stheraven __is_val_expr<_Expr>::value, 1873227825Stheraven void 1874227825Stheraven >::type 1875227825Stheraven operator<<=(const _Expr& __v) const; 1876227825Stheraven 1877227825Stheraven template <class _Expr> 1878227825Stheraven typename enable_if 1879227825Stheraven < 1880227825Stheraven __is_val_expr<_Expr>::value, 1881227825Stheraven void 1882227825Stheraven >::type 1883227825Stheraven operator>>=(const _Expr& __v) const; 1884227825Stheraven 1885227825Stheraven const mask_array& operator=(const mask_array& __ma) const; 1886227825Stheraven 1887227825Stheraven void operator=(const value_type& __x) const; 1888227825Stheraven 1889227825Stheraven// mask_array(const mask_array&) = default; 1890227825Stheraven// mask_array(mask_array&&) = default; 1891227825Stheraven// mask_array& operator=(const mask_array&) = default; 1892227825Stheraven// mask_array& operator=(mask_array&&) = default; 1893227825Stheraven 1894227825Stheravenprivate: 1895227825Stheraven _LIBCPP_INLINE_VISIBILITY 1896227825Stheraven mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v) 1897227825Stheraven : __vp_(const_cast<value_type*>(__v.__begin_)), 1898227825Stheraven __1d_(count(__vb.__begin_, __vb.__end_, true)) 1899227825Stheraven { 1900227825Stheraven size_t __j = 0; 1901227825Stheraven for (size_t __i = 0; __i < __vb.size(); ++__i) 1902227825Stheraven if (__vb[__i]) 1903227825Stheraven __1d_[__j++] = __i; 1904227825Stheraven } 1905227825Stheraven 1906227825Stheraven template <class> friend class valarray; 1907227825Stheraven}; 1908227825Stheraven 1909227825Stheraventemplate <class _Tp> 1910227825Stheraventemplate <class _Expr> 1911227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1912227825Stheraventypename enable_if 1913227825Stheraven< 1914227825Stheraven __is_val_expr<_Expr>::value, 1915227825Stheraven void 1916227825Stheraven>::type 1917227825Stheravenmask_array<_Tp>::operator=(const _Expr& __v) const 1918227825Stheraven{ 1919227825Stheraven size_t __n = __1d_.size(); 1920227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 1921227825Stheraven __vp_[__1d_[__i]] = __v[__i]; 1922227825Stheraven} 1923227825Stheraven 1924227825Stheraventemplate <class _Tp> 1925227825Stheraventemplate <class _Expr> 1926227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1927227825Stheraventypename enable_if 1928227825Stheraven< 1929227825Stheraven __is_val_expr<_Expr>::value, 1930227825Stheraven void 1931227825Stheraven>::type 1932227825Stheravenmask_array<_Tp>::operator*=(const _Expr& __v) const 1933227825Stheraven{ 1934227825Stheraven size_t __n = __1d_.size(); 1935227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 1936227825Stheraven __vp_[__1d_[__i]] *= __v[__i]; 1937227825Stheraven} 1938227825Stheraven 1939227825Stheraventemplate <class _Tp> 1940227825Stheraventemplate <class _Expr> 1941227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1942227825Stheraventypename enable_if 1943227825Stheraven< 1944227825Stheraven __is_val_expr<_Expr>::value, 1945227825Stheraven void 1946227825Stheraven>::type 1947227825Stheravenmask_array<_Tp>::operator/=(const _Expr& __v) const 1948227825Stheraven{ 1949227825Stheraven size_t __n = __1d_.size(); 1950227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 1951227825Stheraven __vp_[__1d_[__i]] /= __v[__i]; 1952227825Stheraven} 1953227825Stheraven 1954227825Stheraventemplate <class _Tp> 1955227825Stheraventemplate <class _Expr> 1956227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1957227825Stheraventypename enable_if 1958227825Stheraven< 1959227825Stheraven __is_val_expr<_Expr>::value, 1960227825Stheraven void 1961227825Stheraven>::type 1962227825Stheravenmask_array<_Tp>::operator%=(const _Expr& __v) const 1963227825Stheraven{ 1964227825Stheraven size_t __n = __1d_.size(); 1965227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 1966227825Stheraven __vp_[__1d_[__i]] %= __v[__i]; 1967227825Stheraven} 1968227825Stheraven 1969227825Stheraventemplate <class _Tp> 1970227825Stheraventemplate <class _Expr> 1971227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1972227825Stheraventypename enable_if 1973227825Stheraven< 1974227825Stheraven __is_val_expr<_Expr>::value, 1975227825Stheraven void 1976227825Stheraven>::type 1977227825Stheravenmask_array<_Tp>::operator+=(const _Expr& __v) const 1978227825Stheraven{ 1979227825Stheraven size_t __n = __1d_.size(); 1980227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 1981227825Stheraven __vp_[__1d_[__i]] += __v[__i]; 1982227825Stheraven} 1983227825Stheraven 1984227825Stheraventemplate <class _Tp> 1985227825Stheraventemplate <class _Expr> 1986227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1987227825Stheraventypename enable_if 1988227825Stheraven< 1989227825Stheraven __is_val_expr<_Expr>::value, 1990227825Stheraven void 1991227825Stheraven>::type 1992227825Stheravenmask_array<_Tp>::operator-=(const _Expr& __v) const 1993227825Stheraven{ 1994227825Stheraven size_t __n = __1d_.size(); 1995227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 1996227825Stheraven __vp_[__1d_[__i]] -= __v[__i]; 1997227825Stheraven} 1998227825Stheraven 1999227825Stheraventemplate <class _Tp> 2000227825Stheraventemplate <class _Expr> 2001227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2002227825Stheraventypename enable_if 2003227825Stheraven< 2004227825Stheraven __is_val_expr<_Expr>::value, 2005227825Stheraven void 2006227825Stheraven>::type 2007227825Stheravenmask_array<_Tp>::operator^=(const _Expr& __v) const 2008227825Stheraven{ 2009227825Stheraven size_t __n = __1d_.size(); 2010227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2011227825Stheraven __vp_[__1d_[__i]] ^= __v[__i]; 2012227825Stheraven} 2013227825Stheraven 2014227825Stheraventemplate <class _Tp> 2015227825Stheraventemplate <class _Expr> 2016227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2017227825Stheraventypename enable_if 2018227825Stheraven< 2019227825Stheraven __is_val_expr<_Expr>::value, 2020227825Stheraven void 2021227825Stheraven>::type 2022227825Stheravenmask_array<_Tp>::operator&=(const _Expr& __v) const 2023227825Stheraven{ 2024227825Stheraven size_t __n = __1d_.size(); 2025227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2026227825Stheraven __vp_[__1d_[__i]] &= __v[__i]; 2027227825Stheraven} 2028227825Stheraven 2029227825Stheraventemplate <class _Tp> 2030227825Stheraventemplate <class _Expr> 2031227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2032227825Stheraventypename enable_if 2033227825Stheraven< 2034227825Stheraven __is_val_expr<_Expr>::value, 2035227825Stheraven void 2036227825Stheraven>::type 2037227825Stheravenmask_array<_Tp>::operator|=(const _Expr& __v) const 2038227825Stheraven{ 2039227825Stheraven size_t __n = __1d_.size(); 2040227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2041227825Stheraven __vp_[__1d_[__i]] |= __v[__i]; 2042227825Stheraven} 2043227825Stheraven 2044227825Stheraventemplate <class _Tp> 2045227825Stheraventemplate <class _Expr> 2046227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2047227825Stheraventypename enable_if 2048227825Stheraven< 2049227825Stheraven __is_val_expr<_Expr>::value, 2050227825Stheraven void 2051227825Stheraven>::type 2052227825Stheravenmask_array<_Tp>::operator<<=(const _Expr& __v) const 2053227825Stheraven{ 2054227825Stheraven size_t __n = __1d_.size(); 2055227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2056227825Stheraven __vp_[__1d_[__i]] <<= __v[__i]; 2057227825Stheraven} 2058227825Stheraven 2059227825Stheraventemplate <class _Tp> 2060227825Stheraventemplate <class _Expr> 2061227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2062227825Stheraventypename enable_if 2063227825Stheraven< 2064227825Stheraven __is_val_expr<_Expr>::value, 2065227825Stheraven void 2066227825Stheraven>::type 2067227825Stheravenmask_array<_Tp>::operator>>=(const _Expr& __v) const 2068227825Stheraven{ 2069227825Stheraven size_t __n = __1d_.size(); 2070227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2071227825Stheraven __vp_[__1d_[__i]] >>= __v[__i]; 2072227825Stheraven} 2073227825Stheraven 2074227825Stheraventemplate <class _Tp> 2075227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2076227825Stheravenconst mask_array<_Tp>& 2077227825Stheravenmask_array<_Tp>::operator=(const mask_array& __ma) const 2078227825Stheraven{ 2079227825Stheraven size_t __n = __1d_.size(); 2080227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2081227825Stheraven __vp_[__1d_[__i]] = __ma.__vp_[__1d_[__i]]; 2082227825Stheraven} 2083227825Stheraven 2084227825Stheraventemplate <class _Tp> 2085227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2086227825Stheravenvoid 2087227825Stheravenmask_array<_Tp>::operator=(const value_type& __x) const 2088227825Stheraven{ 2089227825Stheraven size_t __n = __1d_.size(); 2090227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2091227825Stheraven __vp_[__1d_[__i]] = __x; 2092227825Stheraven} 2093227825Stheraven 2094227825Stheraventemplate <class _ValExpr> 2095227825Stheravenclass __mask_expr 2096227825Stheraven{ 2097227825Stheraven typedef typename remove_reference<_ValExpr>::type _RmExpr; 2098227825Stheravenpublic: 2099227825Stheraven typedef typename _RmExpr::value_type value_type; 2100227825Stheraven typedef value_type result_type; 2101227825Stheraven 2102227825Stheravenprivate: 2103227825Stheraven _ValExpr __expr_; 2104227825Stheraven valarray<size_t> __1d_; 2105227825Stheraven 2106227825Stheraven _LIBCPP_INLINE_VISIBILITY 2107227825Stheraven __mask_expr(const valarray<bool>& __vb, const _RmExpr& __e) 2108227825Stheraven : __expr_(__e), 2109227825Stheraven __1d_(count(__vb.__begin_, __vb.__end_, true)) 2110227825Stheraven { 2111227825Stheraven size_t __j = 0; 2112227825Stheraven for (size_t __i = 0; __i < __vb.size(); ++__i) 2113227825Stheraven if (__vb[__i]) 2114227825Stheraven __1d_[__j++] = __i; 2115227825Stheraven } 2116227825Stheraven 2117227825Stheravenpublic: 2118227825Stheraven _LIBCPP_INLINE_VISIBILITY 2119227825Stheraven result_type operator[](size_t __i) const 2120227825Stheraven {return __expr_[__1d_[__i]];} 2121227825Stheraven 2122227825Stheraven _LIBCPP_INLINE_VISIBILITY 2123227825Stheraven size_t size() const {return __1d_.size();} 2124227825Stheraven 2125227825Stheraven template <class> friend class valarray; 2126227825Stheraven}; 2127227825Stheraven 2128227825Stheraven// indirect_array 2129227825Stheraven 2130227825Stheraventemplate <class _Tp> 2131227825Stheravenclass _LIBCPP_VISIBLE indirect_array 2132227825Stheraven{ 2133227825Stheravenpublic: 2134227825Stheraven typedef _Tp value_type; 2135227825Stheraven 2136227825Stheravenprivate: 2137227825Stheraven value_type* __vp_; 2138227825Stheraven valarray<size_t> __1d_; 2139227825Stheraven 2140227825Stheravenpublic: 2141227825Stheraven template <class _Expr> 2142227825Stheraven typename enable_if 2143227825Stheraven < 2144227825Stheraven __is_val_expr<_Expr>::value, 2145227825Stheraven void 2146227825Stheraven >::type 2147227825Stheraven operator=(const _Expr& __v) const; 2148227825Stheraven 2149227825Stheraven template <class _Expr> 2150227825Stheraven typename enable_if 2151227825Stheraven < 2152227825Stheraven __is_val_expr<_Expr>::value, 2153227825Stheraven void 2154227825Stheraven >::type 2155227825Stheraven operator*=(const _Expr& __v) const; 2156227825Stheraven 2157227825Stheraven template <class _Expr> 2158227825Stheraven typename enable_if 2159227825Stheraven < 2160227825Stheraven __is_val_expr<_Expr>::value, 2161227825Stheraven void 2162227825Stheraven >::type 2163227825Stheraven operator/=(const _Expr& __v) const; 2164227825Stheraven 2165227825Stheraven template <class _Expr> 2166227825Stheraven typename enable_if 2167227825Stheraven < 2168227825Stheraven __is_val_expr<_Expr>::value, 2169227825Stheraven void 2170227825Stheraven >::type 2171227825Stheraven operator%=(const _Expr& __v) const; 2172227825Stheraven 2173227825Stheraven template <class _Expr> 2174227825Stheraven typename enable_if 2175227825Stheraven < 2176227825Stheraven __is_val_expr<_Expr>::value, 2177227825Stheraven void 2178227825Stheraven >::type 2179227825Stheraven operator+=(const _Expr& __v) const; 2180227825Stheraven 2181227825Stheraven template <class _Expr> 2182227825Stheraven typename enable_if 2183227825Stheraven < 2184227825Stheraven __is_val_expr<_Expr>::value, 2185227825Stheraven void 2186227825Stheraven >::type 2187227825Stheraven operator-=(const _Expr& __v) const; 2188227825Stheraven 2189227825Stheraven template <class _Expr> 2190227825Stheraven typename enable_if 2191227825Stheraven < 2192227825Stheraven __is_val_expr<_Expr>::value, 2193227825Stheraven void 2194227825Stheraven >::type 2195227825Stheraven operator^=(const _Expr& __v) const; 2196227825Stheraven 2197227825Stheraven template <class _Expr> 2198227825Stheraven typename enable_if 2199227825Stheraven < 2200227825Stheraven __is_val_expr<_Expr>::value, 2201227825Stheraven void 2202227825Stheraven >::type 2203227825Stheraven operator&=(const _Expr& __v) const; 2204227825Stheraven 2205227825Stheraven template <class _Expr> 2206227825Stheraven typename enable_if 2207227825Stheraven < 2208227825Stheraven __is_val_expr<_Expr>::value, 2209227825Stheraven void 2210227825Stheraven >::type 2211227825Stheraven operator|=(const _Expr& __v) const; 2212227825Stheraven 2213227825Stheraven template <class _Expr> 2214227825Stheraven typename enable_if 2215227825Stheraven < 2216227825Stheraven __is_val_expr<_Expr>::value, 2217227825Stheraven void 2218227825Stheraven >::type 2219227825Stheraven operator<<=(const _Expr& __v) const; 2220227825Stheraven 2221227825Stheraven template <class _Expr> 2222227825Stheraven typename enable_if 2223227825Stheraven < 2224227825Stheraven __is_val_expr<_Expr>::value, 2225227825Stheraven void 2226227825Stheraven >::type 2227227825Stheraven operator>>=(const _Expr& __v) const; 2228227825Stheraven 2229227825Stheraven const indirect_array& operator=(const indirect_array& __ia) const; 2230227825Stheraven 2231227825Stheraven void operator=(const value_type& __x) const; 2232227825Stheraven 2233227825Stheraven// indirect_array(const indirect_array&) = default; 2234227825Stheraven// indirect_array(indirect_array&&) = default; 2235227825Stheraven// indirect_array& operator=(const indirect_array&) = default; 2236227825Stheraven// indirect_array& operator=(indirect_array&&) = default; 2237227825Stheraven 2238227825Stheravenprivate: 2239227825Stheraven _LIBCPP_INLINE_VISIBILITY 2240227825Stheraven indirect_array(const valarray<size_t>& __ia, const valarray<value_type>& __v) 2241227825Stheraven : __vp_(const_cast<value_type*>(__v.__begin_)), 2242227825Stheraven __1d_(__ia) 2243227825Stheraven {} 2244227825Stheraven 2245227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2246227825Stheraven 2247227825Stheraven _LIBCPP_INLINE_VISIBILITY 2248227825Stheraven indirect_array(valarray<size_t>&& __ia, const valarray<value_type>& __v) 2249227825Stheraven : __vp_(const_cast<value_type*>(__v.__begin_)), 2250227825Stheraven __1d_(move(__ia)) 2251227825Stheraven {} 2252227825Stheraven 2253227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2254227825Stheraven 2255227825Stheraven template <class> friend class valarray; 2256227825Stheraven}; 2257227825Stheraven 2258227825Stheraventemplate <class _Tp> 2259227825Stheraventemplate <class _Expr> 2260227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2261227825Stheraventypename enable_if 2262227825Stheraven< 2263227825Stheraven __is_val_expr<_Expr>::value, 2264227825Stheraven void 2265227825Stheraven>::type 2266227825Stheravenindirect_array<_Tp>::operator=(const _Expr& __v) const 2267227825Stheraven{ 2268227825Stheraven size_t __n = __1d_.size(); 2269227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2270227825Stheraven __vp_[__1d_[__i]] = __v[__i]; 2271227825Stheraven} 2272227825Stheraven 2273227825Stheraventemplate <class _Tp> 2274227825Stheraventemplate <class _Expr> 2275227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2276227825Stheraventypename enable_if 2277227825Stheraven< 2278227825Stheraven __is_val_expr<_Expr>::value, 2279227825Stheraven void 2280227825Stheraven>::type 2281227825Stheravenindirect_array<_Tp>::operator*=(const _Expr& __v) const 2282227825Stheraven{ 2283227825Stheraven size_t __n = __1d_.size(); 2284227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2285227825Stheraven __vp_[__1d_[__i]] *= __v[__i]; 2286227825Stheraven} 2287227825Stheraven 2288227825Stheraventemplate <class _Tp> 2289227825Stheraventemplate <class _Expr> 2290227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2291227825Stheraventypename enable_if 2292227825Stheraven< 2293227825Stheraven __is_val_expr<_Expr>::value, 2294227825Stheraven void 2295227825Stheraven>::type 2296227825Stheravenindirect_array<_Tp>::operator/=(const _Expr& __v) const 2297227825Stheraven{ 2298227825Stheraven size_t __n = __1d_.size(); 2299227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2300227825Stheraven __vp_[__1d_[__i]] /= __v[__i]; 2301227825Stheraven} 2302227825Stheraven 2303227825Stheraventemplate <class _Tp> 2304227825Stheraventemplate <class _Expr> 2305227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2306227825Stheraventypename enable_if 2307227825Stheraven< 2308227825Stheraven __is_val_expr<_Expr>::value, 2309227825Stheraven void 2310227825Stheraven>::type 2311227825Stheravenindirect_array<_Tp>::operator%=(const _Expr& __v) const 2312227825Stheraven{ 2313227825Stheraven size_t __n = __1d_.size(); 2314227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2315227825Stheraven __vp_[__1d_[__i]] %= __v[__i]; 2316227825Stheraven} 2317227825Stheraven 2318227825Stheraventemplate <class _Tp> 2319227825Stheraventemplate <class _Expr> 2320227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2321227825Stheraventypename enable_if 2322227825Stheraven< 2323227825Stheraven __is_val_expr<_Expr>::value, 2324227825Stheraven void 2325227825Stheraven>::type 2326227825Stheravenindirect_array<_Tp>::operator+=(const _Expr& __v) const 2327227825Stheraven{ 2328227825Stheraven size_t __n = __1d_.size(); 2329227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2330227825Stheraven __vp_[__1d_[__i]] += __v[__i]; 2331227825Stheraven} 2332227825Stheraven 2333227825Stheraventemplate <class _Tp> 2334227825Stheraventemplate <class _Expr> 2335227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2336227825Stheraventypename enable_if 2337227825Stheraven< 2338227825Stheraven __is_val_expr<_Expr>::value, 2339227825Stheraven void 2340227825Stheraven>::type 2341227825Stheravenindirect_array<_Tp>::operator-=(const _Expr& __v) const 2342227825Stheraven{ 2343227825Stheraven size_t __n = __1d_.size(); 2344227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2345227825Stheraven __vp_[__1d_[__i]] -= __v[__i]; 2346227825Stheraven} 2347227825Stheraven 2348227825Stheraventemplate <class _Tp> 2349227825Stheraventemplate <class _Expr> 2350227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2351227825Stheraventypename enable_if 2352227825Stheraven< 2353227825Stheraven __is_val_expr<_Expr>::value, 2354227825Stheraven void 2355227825Stheraven>::type 2356227825Stheravenindirect_array<_Tp>::operator^=(const _Expr& __v) const 2357227825Stheraven{ 2358227825Stheraven size_t __n = __1d_.size(); 2359227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2360227825Stheraven __vp_[__1d_[__i]] ^= __v[__i]; 2361227825Stheraven} 2362227825Stheraven 2363227825Stheraventemplate <class _Tp> 2364227825Stheraventemplate <class _Expr> 2365227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2366227825Stheraventypename enable_if 2367227825Stheraven< 2368227825Stheraven __is_val_expr<_Expr>::value, 2369227825Stheraven void 2370227825Stheraven>::type 2371227825Stheravenindirect_array<_Tp>::operator&=(const _Expr& __v) const 2372227825Stheraven{ 2373227825Stheraven size_t __n = __1d_.size(); 2374227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2375227825Stheraven __vp_[__1d_[__i]] &= __v[__i]; 2376227825Stheraven} 2377227825Stheraven 2378227825Stheraventemplate <class _Tp> 2379227825Stheraventemplate <class _Expr> 2380227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2381227825Stheraventypename enable_if 2382227825Stheraven< 2383227825Stheraven __is_val_expr<_Expr>::value, 2384227825Stheraven void 2385227825Stheraven>::type 2386227825Stheravenindirect_array<_Tp>::operator|=(const _Expr& __v) const 2387227825Stheraven{ 2388227825Stheraven size_t __n = __1d_.size(); 2389227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2390227825Stheraven __vp_[__1d_[__i]] |= __v[__i]; 2391227825Stheraven} 2392227825Stheraven 2393227825Stheraventemplate <class _Tp> 2394227825Stheraventemplate <class _Expr> 2395227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2396227825Stheraventypename enable_if 2397227825Stheraven< 2398227825Stheraven __is_val_expr<_Expr>::value, 2399227825Stheraven void 2400227825Stheraven>::type 2401227825Stheravenindirect_array<_Tp>::operator<<=(const _Expr& __v) const 2402227825Stheraven{ 2403227825Stheraven size_t __n = __1d_.size(); 2404227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2405227825Stheraven __vp_[__1d_[__i]] <<= __v[__i]; 2406227825Stheraven} 2407227825Stheraven 2408227825Stheraventemplate <class _Tp> 2409227825Stheraventemplate <class _Expr> 2410227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2411227825Stheraventypename enable_if 2412227825Stheraven< 2413227825Stheraven __is_val_expr<_Expr>::value, 2414227825Stheraven void 2415227825Stheraven>::type 2416227825Stheravenindirect_array<_Tp>::operator>>=(const _Expr& __v) const 2417227825Stheraven{ 2418227825Stheraven size_t __n = __1d_.size(); 2419227825Stheraven for (size_t __i = 0; __i < __n; ++__i) 2420227825Stheraven __vp_[__1d_[__i]] >>= __v[__i]; 2421227825Stheraven} 2422227825Stheraven 2423227825Stheraventemplate <class _Tp> 2424227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2425227825Stheravenconst indirect_array<_Tp>& 2426227825Stheravenindirect_array<_Tp>::operator=(const indirect_array& __ia) const 2427227825Stheraven{ 2428227825Stheraven typedef const size_t* _Ip; 2429227825Stheraven const value_type* __s = __ia.__vp_; 2430227825Stheraven for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ia.__1d_.__begin_; 2431227825Stheraven __i != __e; ++__i, ++__j) 2432227825Stheraven __vp_[*__i] = __s[*__j]; 2433227825Stheraven return *this; 2434227825Stheraven} 2435227825Stheraven 2436227825Stheraventemplate <class _Tp> 2437227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2438227825Stheravenvoid 2439227825Stheravenindirect_array<_Tp>::operator=(const value_type& __x) const 2440227825Stheraven{ 2441227825Stheraven typedef const size_t* _Ip; 2442227825Stheraven for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i) 2443227825Stheraven __vp_[*__i] = __x; 2444227825Stheraven} 2445227825Stheraven 2446227825Stheraventemplate <class _ValExpr> 2447227825Stheravenclass __indirect_expr 2448227825Stheraven{ 2449227825Stheraven typedef typename remove_reference<_ValExpr>::type _RmExpr; 2450227825Stheravenpublic: 2451227825Stheraven typedef typename _RmExpr::value_type value_type; 2452227825Stheraven typedef value_type result_type; 2453227825Stheraven 2454227825Stheravenprivate: 2455227825Stheraven _ValExpr __expr_; 2456227825Stheraven valarray<size_t> __1d_; 2457227825Stheraven 2458227825Stheraven _LIBCPP_INLINE_VISIBILITY 2459227825Stheraven __indirect_expr(const valarray<size_t>& __ia, const _RmExpr& __e) 2460227825Stheraven : __expr_(__e), 2461227825Stheraven __1d_(__ia) 2462227825Stheraven {} 2463227825Stheraven 2464227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2465227825Stheraven 2466227825Stheraven _LIBCPP_INLINE_VISIBILITY 2467227825Stheraven __indirect_expr(valarray<size_t>&& __ia, const _RmExpr& __e) 2468227825Stheraven : __expr_(__e), 2469227825Stheraven __1d_(move(__ia)) 2470227825Stheraven {} 2471227825Stheraven 2472227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2473227825Stheraven 2474227825Stheravenpublic: 2475227825Stheraven _LIBCPP_INLINE_VISIBILITY 2476227825Stheraven result_type operator[](size_t __i) const 2477227825Stheraven {return __expr_[__1d_[__i]];} 2478227825Stheraven 2479227825Stheraven _LIBCPP_INLINE_VISIBILITY 2480227825Stheraven size_t size() const {return __1d_.size();} 2481227825Stheraven 2482227825Stheraven template <class> friend class _LIBCPP_VISIBLE valarray; 2483227825Stheraven}; 2484227825Stheraven 2485227825Stheraventemplate<class _ValExpr> 2486227825Stheravenclass __val_expr 2487227825Stheraven{ 2488227825Stheraven typedef typename remove_reference<_ValExpr>::type _RmExpr; 2489227825Stheraven 2490227825Stheraven _ValExpr __expr_; 2491227825Stheravenpublic: 2492227825Stheraven typedef typename _RmExpr::value_type value_type; 2493227825Stheraven typedef typename _RmExpr::result_type result_type; 2494227825Stheraven 2495227825Stheraven _LIBCPP_INLINE_VISIBILITY 2496227825Stheraven explicit __val_expr(const _RmExpr& __e) : __expr_(__e) {} 2497227825Stheraven 2498227825Stheraven _LIBCPP_INLINE_VISIBILITY 2499227825Stheraven result_type operator[](size_t __i) const 2500227825Stheraven {return __expr_[__i];} 2501227825Stheraven 2502227825Stheraven _LIBCPP_INLINE_VISIBILITY 2503227825Stheraven __val_expr<__slice_expr<_ValExpr> > operator[](slice __s) const 2504227825Stheraven {return __val_expr<__slice_expr<_ValExpr> >(__expr_, __s);} 2505227825Stheraven 2506227825Stheraven _LIBCPP_INLINE_VISIBILITY 2507227825Stheraven __val_expr<__indirect_expr<_ValExpr> > operator[](const gslice& __gs) const 2508227825Stheraven {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __gs.__1d_);} 2509227825Stheraven 2510227825Stheraven _LIBCPP_INLINE_VISIBILITY 2511227825Stheraven __val_expr<__mask_expr<_ValExpr> > operator[](const valarray<bool>& __vb) const 2512227825Stheraven {return __val_expr<__mask_expr<_ValExpr> >(__expr_, __vb);} 2513227825Stheraven 2514227825Stheraven _LIBCPP_INLINE_VISIBILITY 2515227825Stheraven __val_expr<__indirect_expr<_ValExpr> > operator[](const valarray<size_t>& __vs) const 2516227825Stheraven {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __vs);} 2517227825Stheraven 2518227825Stheraven _LIBCPP_INLINE_VISIBILITY 2519227825Stheraven __val_expr<_UnaryOp<__unary_plus<value_type>, _ValExpr> > 2520227825Stheraven operator+() const 2521227825Stheraven { 2522227825Stheraven typedef _UnaryOp<__unary_plus<value_type>, _ValExpr> _NewExpr; 2523227825Stheraven return __val_expr<_NewExpr>(_NewExpr(__unary_plus<value_type>(), __expr_)); 2524227825Stheraven } 2525227825Stheraven 2526227825Stheraven _LIBCPP_INLINE_VISIBILITY 2527227825Stheraven __val_expr<_UnaryOp<negate<value_type>, _ValExpr> > 2528227825Stheraven operator-() const 2529227825Stheraven { 2530227825Stheraven typedef _UnaryOp<negate<value_type>, _ValExpr> _NewExpr; 2531227825Stheraven return __val_expr<_NewExpr>(_NewExpr(negate<value_type>(), __expr_)); 2532227825Stheraven } 2533227825Stheraven 2534227825Stheraven _LIBCPP_INLINE_VISIBILITY 2535227825Stheraven __val_expr<_UnaryOp<__bit_not<value_type>, _ValExpr> > 2536227825Stheraven operator~() const 2537227825Stheraven { 2538227825Stheraven typedef _UnaryOp<__bit_not<value_type>, _ValExpr> _NewExpr; 2539227825Stheraven return __val_expr<_NewExpr>(_NewExpr(__bit_not<value_type>(), __expr_)); 2540227825Stheraven } 2541227825Stheraven 2542227825Stheraven _LIBCPP_INLINE_VISIBILITY 2543227825Stheraven __val_expr<_UnaryOp<logical_not<value_type>, _ValExpr> > 2544227825Stheraven operator!() const 2545227825Stheraven { 2546227825Stheraven typedef _UnaryOp<logical_not<value_type>, _ValExpr> _NewExpr; 2547227825Stheraven return __val_expr<_NewExpr>(_NewExpr(logical_not<value_type>(), __expr_)); 2548227825Stheraven } 2549227825Stheraven 2550227825Stheraven operator valarray<result_type>() const; 2551227825Stheraven 2552227825Stheraven _LIBCPP_INLINE_VISIBILITY 2553227825Stheraven size_t size() const {return __expr_.size();} 2554227825Stheraven 2555227825Stheraven _LIBCPP_INLINE_VISIBILITY 2556227825Stheraven result_type sum() const 2557227825Stheraven { 2558227825Stheraven size_t __n = __expr_.size(); 2559227825Stheraven result_type __r = __n ? __expr_[0] : result_type(); 2560227825Stheraven for (size_t __i = 1; __i < __n; ++__i) 2561227825Stheraven __r += __expr_[__i]; 2562227825Stheraven return __r; 2563227825Stheraven } 2564227825Stheraven 2565227825Stheraven _LIBCPP_INLINE_VISIBILITY 2566227825Stheraven result_type min() const 2567227825Stheraven { 2568227825Stheraven size_t __n = size(); 2569227825Stheraven result_type __r = __n ? (*this)[0] : result_type(); 2570227825Stheraven for (size_t __i = 1; __i < __n; ++__i) 2571227825Stheraven { 2572227825Stheraven result_type __x = __expr_[__i]; 2573227825Stheraven if (__x < __r) 2574227825Stheraven __r = __x; 2575227825Stheraven } 2576227825Stheraven return __r; 2577227825Stheraven } 2578227825Stheraven 2579227825Stheraven _LIBCPP_INLINE_VISIBILITY 2580227825Stheraven result_type max() const 2581227825Stheraven { 2582227825Stheraven size_t __n = size(); 2583227825Stheraven result_type __r = __n ? (*this)[0] : result_type(); 2584227825Stheraven for (size_t __i = 1; __i < __n; ++__i) 2585227825Stheraven { 2586227825Stheraven result_type __x = __expr_[__i]; 2587227825Stheraven if (__r < __x) 2588227825Stheraven __r = __x; 2589227825Stheraven } 2590227825Stheraven return __r; 2591227825Stheraven } 2592227825Stheraven 2593227825Stheraven _LIBCPP_INLINE_VISIBILITY 2594227825Stheraven __val_expr<__shift_expr<_ValExpr> > shift (int __i) const 2595227825Stheraven {return __val_expr<__shift_expr<_ValExpr> >(__shift_expr<_ValExpr>(__i, __expr_));} 2596227825Stheraven 2597227825Stheraven _LIBCPP_INLINE_VISIBILITY 2598227825Stheraven __val_expr<__cshift_expr<_ValExpr> > cshift(int __i) const 2599227825Stheraven {return __val_expr<__cshift_expr<_ValExpr> >(__cshift_expr<_ValExpr>(__i, __expr_));} 2600227825Stheraven 2601227825Stheraven _LIBCPP_INLINE_VISIBILITY 2602227825Stheraven __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(value_type)>, _ValExpr> > 2603227825Stheraven apply(value_type __f(value_type)) const 2604227825Stheraven { 2605227825Stheraven typedef __apply_expr<value_type, value_type(*)(value_type)> _Op; 2606227825Stheraven typedef _UnaryOp<_Op, _ValExpr> _NewExpr; 2607227825Stheraven return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_)); 2608227825Stheraven } 2609227825Stheraven 2610227825Stheraven _LIBCPP_INLINE_VISIBILITY 2611227825Stheraven __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(const value_type&)>, _ValExpr> > 2612227825Stheraven apply(value_type __f(const value_type&)) const 2613227825Stheraven { 2614227825Stheraven typedef __apply_expr<value_type, value_type(*)(const value_type&)> _Op; 2615227825Stheraven typedef _UnaryOp<_Op, _ValExpr> _NewExpr; 2616227825Stheraven return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_)); 2617227825Stheraven } 2618227825Stheraven}; 2619227825Stheraven 2620227825Stheraventemplate<class _ValExpr> 2621227825Stheraven__val_expr<_ValExpr>::operator valarray<result_type>() const 2622227825Stheraven{ 2623227825Stheraven valarray<result_type> __r; 2624227825Stheraven size_t __n = __expr_.size(); 2625227825Stheraven if (__n) 2626227825Stheraven { 2627227825Stheraven __r.__begin_ = 2628227825Stheraven __r.__end_ = 2629227825Stheraven static_cast<result_type*>(::operator new(__n * sizeof(result_type))); 2630227825Stheraven for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i) 2631227825Stheraven ::new (__r.__end_) result_type(__expr_[__i]); 2632227825Stheraven } 2633227825Stheraven return __r; 2634227825Stheraven} 2635227825Stheraven 2636227825Stheraven// valarray 2637227825Stheraven 2638227825Stheraventemplate <class _Tp> 2639227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2640227825Stheravenvalarray<_Tp>::valarray(size_t __n) 2641227825Stheraven : __begin_(0), 2642227825Stheraven __end_(0) 2643227825Stheraven{ 2644227825Stheraven resize(__n); 2645227825Stheraven} 2646227825Stheraven 2647227825Stheraventemplate <class _Tp> 2648227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2649227825Stheravenvalarray<_Tp>::valarray(const value_type& __x, size_t __n) 2650227825Stheraven : __begin_(0), 2651227825Stheraven __end_(0) 2652227825Stheraven{ 2653227825Stheraven resize(__n, __x); 2654227825Stheraven} 2655227825Stheraven 2656227825Stheraventemplate <class _Tp> 2657227825Stheravenvalarray<_Tp>::valarray(const value_type* __p, size_t __n) 2658227825Stheraven : __begin_(0), 2659227825Stheraven __end_(0) 2660227825Stheraven{ 2661227825Stheraven if (__n) 2662227825Stheraven { 2663227825Stheraven __begin_ = __end_ = static_cast<value_type*>(::operator new(__n * sizeof(value_type))); 2664227825Stheraven#ifndef _LIBCPP_NO_EXCEPTIONS 2665227825Stheraven try 2666227825Stheraven { 2667227825Stheraven#endif // _LIBCPP_NO_EXCEPTIONS 2668227825Stheraven for (; __n; ++__end_, ++__p, --__n) 2669227825Stheraven ::new (__end_) value_type(*__p); 2670227825Stheraven#ifndef _LIBCPP_NO_EXCEPTIONS 2671227825Stheraven } 2672227825Stheraven catch (...) 2673227825Stheraven { 2674227825Stheraven resize(0); 2675227825Stheraven throw; 2676227825Stheraven } 2677227825Stheraven#endif // _LIBCPP_NO_EXCEPTIONS 2678227825Stheraven } 2679227825Stheraven} 2680227825Stheraven 2681227825Stheraventemplate <class _Tp> 2682227825Stheravenvalarray<_Tp>::valarray(const valarray& __v) 2683227825Stheraven : __begin_(0), 2684227825Stheraven __end_(0) 2685227825Stheraven{ 2686227825Stheraven if (__v.size()) 2687227825Stheraven { 2688227825Stheraven __begin_ = __end_ = static_cast<value_type*>(::operator new(__v.size() * sizeof(value_type))); 2689227825Stheraven#ifndef _LIBCPP_NO_EXCEPTIONS 2690227825Stheraven try 2691227825Stheraven { 2692227825Stheraven#endif // _LIBCPP_NO_EXCEPTIONS 2693227825Stheraven for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p) 2694227825Stheraven ::new (__end_) value_type(*__p); 2695227825Stheraven#ifndef _LIBCPP_NO_EXCEPTIONS 2696227825Stheraven } 2697227825Stheraven catch (...) 2698227825Stheraven { 2699227825Stheraven resize(0); 2700227825Stheraven throw; 2701227825Stheraven } 2702227825Stheraven#endif // _LIBCPP_NO_EXCEPTIONS 2703227825Stheraven } 2704227825Stheraven} 2705227825Stheraven 2706227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2707227825Stheraven 2708227825Stheraventemplate <class _Tp> 2709227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2710227825Stheravenvalarray<_Tp>::valarray(valarray&& __v) 2711227825Stheraven : __begin_(__v.__begin_), 2712227825Stheraven __end_(__v.__end_) 2713227825Stheraven{ 2714227825Stheraven __v.__begin_ = __v.__end_ = nullptr; 2715227825Stheraven} 2716227825Stheraven 2717227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2718227825Stheraven 2719227825Stheraven#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 2720227825Stheraven 2721227825Stheraventemplate <class _Tp> 2722227825Stheravenvalarray<_Tp>::valarray(initializer_list<value_type> __il) 2723227825Stheraven : __begin_(0), 2724227825Stheraven __end_(0) 2725227825Stheraven{ 2726227825Stheraven size_t __n = __il.size(); 2727227825Stheraven if (__n) 2728227825Stheraven { 2729227825Stheraven __begin_ = __end_ = static_cast<value_type*>(::operator new(__n * sizeof(value_type))); 2730227825Stheraven#ifndef _LIBCPP_NO_EXCEPTIONS 2731227825Stheraven try 2732227825Stheraven { 2733227825Stheraven#endif // _LIBCPP_NO_EXCEPTIONS 2734227825Stheraven for (const value_type* __p = __il.begin(); __n; ++__end_, ++__p, --__n) 2735227825Stheraven ::new (__end_) value_type(*__p); 2736227825Stheraven#ifndef _LIBCPP_NO_EXCEPTIONS 2737227825Stheraven } 2738227825Stheraven catch (...) 2739227825Stheraven { 2740227825Stheraven resize(0); 2741227825Stheraven throw; 2742227825Stheraven } 2743227825Stheraven#endif // _LIBCPP_NO_EXCEPTIONS 2744227825Stheraven } 2745227825Stheraven} 2746227825Stheraven 2747227825Stheraven#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 2748227825Stheraven 2749227825Stheraventemplate <class _Tp> 2750227825Stheravenvalarray<_Tp>::valarray(const slice_array<value_type>& __sa) 2751227825Stheraven : __begin_(0), 2752227825Stheraven __end_(0) 2753227825Stheraven{ 2754227825Stheraven size_t __n = __sa.__size_; 2755227825Stheraven if (__n) 2756227825Stheraven { 2757227825Stheraven __begin_ = __end_ = static_cast<value_type*>(::operator new(__n * sizeof(value_type))); 2758227825Stheraven#ifndef _LIBCPP_NO_EXCEPTIONS 2759227825Stheraven try 2760227825Stheraven { 2761227825Stheraven#endif // _LIBCPP_NO_EXCEPTIONS 2762227825Stheraven for (const value_type* __p = __sa.__vp_; __n; ++__end_, __p += __sa.__stride_, --__n) 2763227825Stheraven ::new (__end_) value_type(*__p); 2764227825Stheraven#ifndef _LIBCPP_NO_EXCEPTIONS 2765227825Stheraven } 2766227825Stheraven catch (...) 2767227825Stheraven { 2768227825Stheraven resize(0); 2769227825Stheraven throw; 2770227825Stheraven } 2771227825Stheraven#endif // _LIBCPP_NO_EXCEPTIONS 2772227825Stheraven } 2773227825Stheraven} 2774227825Stheraven 2775227825Stheraventemplate <class _Tp> 2776227825Stheravenvalarray<_Tp>::valarray(const gslice_array<value_type>& __ga) 2777227825Stheraven : __begin_(0), 2778227825Stheraven __end_(0) 2779227825Stheraven{ 2780227825Stheraven size_t __n = __ga.__1d_.size(); 2781227825Stheraven if (__n) 2782227825Stheraven { 2783227825Stheraven __begin_ = __end_ = static_cast<value_type*>(::operator new(__n * sizeof(value_type))); 2784227825Stheraven#ifndef _LIBCPP_NO_EXCEPTIONS 2785227825Stheraven try 2786227825Stheraven { 2787227825Stheraven#endif // _LIBCPP_NO_EXCEPTIONS 2788227825Stheraven typedef const size_t* _Ip; 2789227825Stheraven const value_type* __s = __ga.__vp_; 2790227825Stheraven for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_; 2791227825Stheraven __i != __e; ++__i, ++__end_) 2792227825Stheraven ::new (__end_) value_type(__s[*__i]); 2793227825Stheraven#ifndef _LIBCPP_NO_EXCEPTIONS 2794227825Stheraven } 2795227825Stheraven catch (...) 2796227825Stheraven { 2797227825Stheraven resize(0); 2798227825Stheraven throw; 2799227825Stheraven } 2800227825Stheraven#endif // _LIBCPP_NO_EXCEPTIONS 2801227825Stheraven } 2802227825Stheraven} 2803227825Stheraven 2804227825Stheraventemplate <class _Tp> 2805227825Stheravenvalarray<_Tp>::valarray(const mask_array<value_type>& __ma) 2806227825Stheraven : __begin_(0), 2807227825Stheraven __end_(0) 2808227825Stheraven{ 2809227825Stheraven size_t __n = __ma.__1d_.size(); 2810227825Stheraven if (__n) 2811227825Stheraven { 2812227825Stheraven __begin_ = __end_ = static_cast<value_type*>(::operator new(__n * sizeof(value_type))); 2813227825Stheraven#ifndef _LIBCPP_NO_EXCEPTIONS 2814227825Stheraven try 2815227825Stheraven { 2816227825Stheraven#endif // _LIBCPP_NO_EXCEPTIONS 2817227825Stheraven typedef const size_t* _Ip; 2818227825Stheraven const value_type* __s = __ma.__vp_; 2819227825Stheraven for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_; 2820227825Stheraven __i != __e; ++__i, ++__end_) 2821227825Stheraven ::new (__end_) value_type(__s[*__i]); 2822227825Stheraven#ifndef _LIBCPP_NO_EXCEPTIONS 2823227825Stheraven } 2824227825Stheraven catch (...) 2825227825Stheraven { 2826227825Stheraven resize(0); 2827227825Stheraven throw; 2828227825Stheraven } 2829227825Stheraven#endif // _LIBCPP_NO_EXCEPTIONS 2830227825Stheraven } 2831227825Stheraven} 2832227825Stheraven 2833227825Stheraventemplate <class _Tp> 2834227825Stheravenvalarray<_Tp>::valarray(const indirect_array<value_type>& __ia) 2835227825Stheraven : __begin_(0), 2836227825Stheraven __end_(0) 2837227825Stheraven{ 2838227825Stheraven size_t __n = __ia.__1d_.size(); 2839227825Stheraven if (__n) 2840227825Stheraven { 2841227825Stheraven __begin_ = __end_ = static_cast<value_type*>(::operator new(__n * sizeof(value_type))); 2842227825Stheraven#ifndef _LIBCPP_NO_EXCEPTIONS 2843227825Stheraven try 2844227825Stheraven { 2845227825Stheraven#endif // _LIBCPP_NO_EXCEPTIONS 2846227825Stheraven typedef const size_t* _Ip; 2847227825Stheraven const value_type* __s = __ia.__vp_; 2848227825Stheraven for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_; 2849227825Stheraven __i != __e; ++__i, ++__end_) 2850227825Stheraven ::new (__end_) value_type(__s[*__i]); 2851227825Stheraven#ifndef _LIBCPP_NO_EXCEPTIONS 2852227825Stheraven } 2853227825Stheraven catch (...) 2854227825Stheraven { 2855227825Stheraven resize(0); 2856227825Stheraven throw; 2857227825Stheraven } 2858227825Stheraven#endif // _LIBCPP_NO_EXCEPTIONS 2859227825Stheraven } 2860227825Stheraven} 2861227825Stheraven 2862227825Stheraventemplate <class _Tp> 2863227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2864227825Stheravenvalarray<_Tp>::~valarray() 2865227825Stheraven{ 2866227825Stheraven resize(0); 2867227825Stheraven} 2868227825Stheraven 2869227825Stheraventemplate <class _Tp> 2870227825Stheravenvalarray<_Tp>& 2871227825Stheravenvalarray<_Tp>::operator=(const valarray& __v) 2872227825Stheraven{ 2873227825Stheraven if (this != &__v) 2874227825Stheraven { 2875227825Stheraven if (size() != __v.size()) 2876227825Stheraven resize(__v.size()); 2877227825Stheraven _VSTD::copy(__v.__begin_, __v.__end_, __begin_); 2878227825Stheraven } 2879227825Stheraven return *this; 2880227825Stheraven} 2881227825Stheraven 2882227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2883227825Stheraven 2884227825Stheraventemplate <class _Tp> 2885227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2886227825Stheravenvalarray<_Tp>& 2887227825Stheravenvalarray<_Tp>::operator=(valarray&& __v) 2888227825Stheraven{ 2889227825Stheraven resize(0); 2890227825Stheraven __begin_ = __v.__begin_; 2891227825Stheraven __end_ = __v.__end_; 2892227825Stheraven __v.__begin_ = nullptr; 2893227825Stheraven __v.__end_ = nullptr; 2894227825Stheraven return *this; 2895227825Stheraven} 2896227825Stheraven 2897227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2898227825Stheraven 2899227825Stheraven#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 2900227825Stheraven 2901227825Stheraventemplate <class _Tp> 2902227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2903227825Stheravenvalarray<_Tp>& 2904227825Stheravenvalarray<_Tp>::operator=(initializer_list<value_type> __il) 2905227825Stheraven{ 2906227825Stheraven if (size() != __il.size()) 2907227825Stheraven resize(__il.size()); 2908227825Stheraven _VSTD::copy(__il.begin(), __il.end(), __begin_); 2909227825Stheraven return *this; 2910227825Stheraven} 2911227825Stheraven 2912227825Stheraven#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 2913227825Stheraven 2914227825Stheraventemplate <class _Tp> 2915227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2916227825Stheravenvalarray<_Tp>& 2917227825Stheravenvalarray<_Tp>::operator=(const value_type& __x) 2918227825Stheraven{ 2919227825Stheraven _VSTD::fill(__begin_, __end_, __x); 2920227825Stheraven return *this; 2921227825Stheraven} 2922227825Stheraven 2923227825Stheraventemplate <class _Tp> 2924227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2925227825Stheravenvalarray<_Tp>& 2926227825Stheravenvalarray<_Tp>::operator=(const slice_array<value_type>& __sa) 2927227825Stheraven{ 2928227825Stheraven value_type* __t = __begin_; 2929227825Stheraven const value_type* __s = __sa.__vp_; 2930227825Stheraven for (size_t __n = __sa.__size_; __n; --__n, __s += __sa.__stride_, ++__t) 2931227825Stheraven *__t = *__s; 2932227825Stheraven return *this; 2933227825Stheraven} 2934227825Stheraven 2935227825Stheraventemplate <class _Tp> 2936227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2937227825Stheravenvalarray<_Tp>& 2938227825Stheravenvalarray<_Tp>::operator=(const gslice_array<value_type>& __ga) 2939227825Stheraven{ 2940227825Stheraven typedef const size_t* _Ip; 2941227825Stheraven value_type* __t = __begin_; 2942227825Stheraven const value_type* __s = __ga.__vp_; 2943227825Stheraven for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_; 2944227825Stheraven __i != __e; ++__i, ++__t) 2945227825Stheraven *__t = __s[*__i]; 2946227825Stheraven return *this; 2947227825Stheraven} 2948227825Stheraven 2949227825Stheraventemplate <class _Tp> 2950227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2951227825Stheravenvalarray<_Tp>& 2952227825Stheravenvalarray<_Tp>::operator=(const mask_array<value_type>& __ma) 2953227825Stheraven{ 2954227825Stheraven typedef const size_t* _Ip; 2955227825Stheraven value_type* __t = __begin_; 2956227825Stheraven const value_type* __s = __ma.__vp_; 2957227825Stheraven for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_; 2958227825Stheraven __i != __e; ++__i, ++__t) 2959227825Stheraven *__t = __s[*__i]; 2960227825Stheraven return *this; 2961227825Stheraven} 2962227825Stheraven 2963227825Stheraventemplate <class _Tp> 2964227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2965227825Stheravenvalarray<_Tp>& 2966227825Stheravenvalarray<_Tp>::operator=(const indirect_array<value_type>& __ia) 2967227825Stheraven{ 2968227825Stheraven typedef const size_t* _Ip; 2969227825Stheraven value_type* __t = __begin_; 2970227825Stheraven const value_type* __s = __ia.__vp_; 2971227825Stheraven for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_; 2972227825Stheraven __i != __e; ++__i, ++__t) 2973227825Stheraven *__t = __s[*__i]; 2974227825Stheraven return *this; 2975227825Stheraven} 2976227825Stheraven 2977227825Stheraventemplate <class _Tp> 2978227825Stheraventemplate <class _ValExpr> 2979227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2980227825Stheravenvalarray<_Tp>& 2981227825Stheravenvalarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v) 2982227825Stheraven{ 2983227825Stheraven size_t __n = __v.size(); 2984227825Stheraven if (size() != __n) 2985227825Stheraven resize(__n); 2986227825Stheraven value_type* __t = __begin_; 2987227825Stheraven for (size_t __i = 0; __i != __n; ++__t, ++__i) 2988227825Stheraven *__t = result_type(__v[__i]); 2989227825Stheraven return *this; 2990227825Stheraven} 2991227825Stheraven 2992227825Stheraventemplate <class _Tp> 2993227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2994227825Stheraven__val_expr<__slice_expr<const valarray<_Tp>&> > 2995227825Stheravenvalarray<_Tp>::operator[](slice __s) const 2996227825Stheraven{ 2997227825Stheraven return __val_expr<__slice_expr<const valarray&> >(__slice_expr<const valarray&>(__s, *this)); 2998227825Stheraven} 2999227825Stheraven 3000227825Stheraventemplate <class _Tp> 3001227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3002227825Stheravenslice_array<_Tp> 3003227825Stheravenvalarray<_Tp>::operator[](slice __s) 3004227825Stheraven{ 3005227825Stheraven return slice_array<value_type>(__s, *this); 3006227825Stheraven} 3007227825Stheraven 3008227825Stheraventemplate <class _Tp> 3009227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3010227825Stheraven__val_expr<__indirect_expr<const valarray<_Tp>&> > 3011227825Stheravenvalarray<_Tp>::operator[](const gslice& __gs) const 3012227825Stheraven{ 3013227825Stheraven return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__gs.__1d_, *this)); 3014227825Stheraven} 3015227825Stheraven 3016227825Stheraventemplate <class _Tp> 3017227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3018227825Stheravengslice_array<_Tp> 3019227825Stheravenvalarray<_Tp>::operator[](const gslice& __gs) 3020227825Stheraven{ 3021227825Stheraven return gslice_array<value_type>(__gs, *this); 3022227825Stheraven} 3023227825Stheraven 3024227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3025227825Stheraven 3026227825Stheraventemplate <class _Tp> 3027227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3028227825Stheraven__val_expr<__indirect_expr<const valarray<_Tp>&> > 3029227825Stheravenvalarray<_Tp>::operator[](gslice&& __gs) const 3030227825Stheraven{ 3031227825Stheraven return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__gs.__1d_), *this)); 3032227825Stheraven} 3033227825Stheraven 3034227825Stheraventemplate <class _Tp> 3035227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3036227825Stheravengslice_array<_Tp> 3037227825Stheravenvalarray<_Tp>::operator[](gslice&& __gs) 3038227825Stheraven{ 3039227825Stheraven return gslice_array<value_type>(move(__gs), *this); 3040227825Stheraven} 3041227825Stheraven 3042227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 3043227825Stheraven 3044227825Stheraventemplate <class _Tp> 3045227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3046227825Stheraven__val_expr<__mask_expr<const valarray<_Tp>&> > 3047227825Stheravenvalarray<_Tp>::operator[](const valarray<bool>& __vb) const 3048227825Stheraven{ 3049227825Stheraven return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(__vb, *this)); 3050227825Stheraven} 3051227825Stheraven 3052227825Stheraventemplate <class _Tp> 3053227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3054227825Stheravenmask_array<_Tp> 3055227825Stheravenvalarray<_Tp>::operator[](const valarray<bool>& __vb) 3056227825Stheraven{ 3057227825Stheraven return mask_array<value_type>(__vb, *this); 3058227825Stheraven} 3059227825Stheraven 3060227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3061227825Stheraven 3062227825Stheraventemplate <class _Tp> 3063227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3064227825Stheraven__val_expr<__mask_expr<const valarray<_Tp>&> > 3065227825Stheravenvalarray<_Tp>::operator[](valarray<bool>&& __vb) const 3066227825Stheraven{ 3067227825Stheraven return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(move(__vb), *this)); 3068227825Stheraven} 3069227825Stheraven 3070227825Stheraventemplate <class _Tp> 3071227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3072227825Stheravenmask_array<_Tp> 3073227825Stheravenvalarray<_Tp>::operator[](valarray<bool>&& __vb) 3074227825Stheraven{ 3075227825Stheraven return mask_array<value_type>(move(__vb), *this); 3076227825Stheraven} 3077227825Stheraven 3078227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 3079227825Stheraven 3080227825Stheraventemplate <class _Tp> 3081227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3082227825Stheraven__val_expr<__indirect_expr<const valarray<_Tp>&> > 3083227825Stheravenvalarray<_Tp>::operator[](const valarray<size_t>& __vs) const 3084227825Stheraven{ 3085227825Stheraven return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__vs, *this)); 3086227825Stheraven} 3087227825Stheraven 3088227825Stheraventemplate <class _Tp> 3089227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3090227825Stheravenindirect_array<_Tp> 3091227825Stheravenvalarray<_Tp>::operator[](const valarray<size_t>& __vs) 3092227825Stheraven{ 3093227825Stheraven return indirect_array<value_type>(__vs, *this); 3094227825Stheraven} 3095227825Stheraven 3096227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3097227825Stheraven 3098227825Stheraventemplate <class _Tp> 3099227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3100227825Stheraven__val_expr<__indirect_expr<const valarray<_Tp>&> > 3101227825Stheravenvalarray<_Tp>::operator[](valarray<size_t>&& __vs) const 3102227825Stheraven{ 3103227825Stheraven return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__vs), *this)); 3104227825Stheraven} 3105227825Stheraven 3106227825Stheraventemplate <class _Tp> 3107227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3108227825Stheravenindirect_array<_Tp> 3109227825Stheravenvalarray<_Tp>::operator[](valarray<size_t>&& __vs) 3110227825Stheraven{ 3111227825Stheraven return indirect_array<value_type>(move(__vs), *this); 3112227825Stheraven} 3113227825Stheraven 3114227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 3115227825Stheraven 3116227825Stheraventemplate <class _Tp> 3117227825Stheravenvalarray<_Tp> 3118227825Stheravenvalarray<_Tp>::operator+() const 3119227825Stheraven{ 3120227825Stheraven valarray<value_type> __r; 3121227825Stheraven size_t __n = size(); 3122227825Stheraven if (__n) 3123227825Stheraven { 3124227825Stheraven __r.__begin_ = 3125227825Stheraven __r.__end_ = 3126227825Stheraven static_cast<value_type*>(::operator new(__n * sizeof(value_type))); 3127227825Stheraven for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) 3128227825Stheraven ::new (__r.__end_) value_type(+*__p); 3129227825Stheraven } 3130227825Stheraven return __r; 3131227825Stheraven} 3132227825Stheraven 3133227825Stheraventemplate <class _Tp> 3134227825Stheravenvalarray<_Tp> 3135227825Stheravenvalarray<_Tp>::operator-() const 3136227825Stheraven{ 3137227825Stheraven valarray<value_type> __r; 3138227825Stheraven size_t __n = size(); 3139227825Stheraven if (__n) 3140227825Stheraven { 3141227825Stheraven __r.__begin_ = 3142227825Stheraven __r.__end_ = 3143227825Stheraven static_cast<value_type*>(::operator new(__n * sizeof(value_type))); 3144227825Stheraven for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) 3145227825Stheraven ::new (__r.__end_) value_type(-*__p); 3146227825Stheraven } 3147227825Stheraven return __r; 3148227825Stheraven} 3149227825Stheraven 3150227825Stheraventemplate <class _Tp> 3151227825Stheravenvalarray<_Tp> 3152227825Stheravenvalarray<_Tp>::operator~() const 3153227825Stheraven{ 3154227825Stheraven valarray<value_type> __r; 3155227825Stheraven size_t __n = size(); 3156227825Stheraven if (__n) 3157227825Stheraven { 3158227825Stheraven __r.__begin_ = 3159227825Stheraven __r.__end_ = 3160227825Stheraven static_cast<value_type*>(::operator new(__n * sizeof(value_type))); 3161227825Stheraven for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) 3162227825Stheraven ::new (__r.__end_) value_type(~*__p); 3163227825Stheraven } 3164227825Stheraven return __r; 3165227825Stheraven} 3166227825Stheraven 3167227825Stheraventemplate <class _Tp> 3168227825Stheravenvalarray<bool> 3169227825Stheravenvalarray<_Tp>::operator!() const 3170227825Stheraven{ 3171227825Stheraven valarray<bool> __r; 3172227825Stheraven size_t __n = size(); 3173227825Stheraven if (__n) 3174227825Stheraven { 3175227825Stheraven __r.__begin_ = 3176227825Stheraven __r.__end_ = 3177227825Stheraven static_cast<bool*>(::operator new(__n * sizeof(bool))); 3178227825Stheraven for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) 3179227825Stheraven ::new (__r.__end_) bool(!*__p); 3180227825Stheraven } 3181227825Stheraven return __r; 3182227825Stheraven} 3183227825Stheraven 3184227825Stheraventemplate <class _Tp> 3185227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3186227825Stheravenvalarray<_Tp>& 3187227825Stheravenvalarray<_Tp>::operator*=(const value_type& __x) 3188227825Stheraven{ 3189227825Stheraven for (value_type* __p = __begin_; __p != __end_; ++__p) 3190227825Stheraven *__p *= __x; 3191227825Stheraven return *this; 3192227825Stheraven} 3193227825Stheraven 3194227825Stheraventemplate <class _Tp> 3195227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3196227825Stheravenvalarray<_Tp>& 3197227825Stheravenvalarray<_Tp>::operator/=(const value_type& __x) 3198227825Stheraven{ 3199227825Stheraven for (value_type* __p = __begin_; __p != __end_; ++__p) 3200227825Stheraven *__p /= __x; 3201227825Stheraven return *this; 3202227825Stheraven} 3203227825Stheraven 3204227825Stheraventemplate <class _Tp> 3205227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3206227825Stheravenvalarray<_Tp>& 3207227825Stheravenvalarray<_Tp>::operator%=(const value_type& __x) 3208227825Stheraven{ 3209227825Stheraven for (value_type* __p = __begin_; __p != __end_; ++__p) 3210227825Stheraven *__p %= __x; 3211227825Stheraven return *this; 3212227825Stheraven} 3213227825Stheraven 3214227825Stheraventemplate <class _Tp> 3215227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3216227825Stheravenvalarray<_Tp>& 3217227825Stheravenvalarray<_Tp>::operator+=(const value_type& __x) 3218227825Stheraven{ 3219227825Stheraven for (value_type* __p = __begin_; __p != __end_; ++__p) 3220227825Stheraven *__p += __x; 3221227825Stheraven return *this; 3222227825Stheraven} 3223227825Stheraven 3224227825Stheraventemplate <class _Tp> 3225227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3226227825Stheravenvalarray<_Tp>& 3227227825Stheravenvalarray<_Tp>::operator-=(const value_type& __x) 3228227825Stheraven{ 3229227825Stheraven for (value_type* __p = __begin_; __p != __end_; ++__p) 3230227825Stheraven *__p -= __x; 3231227825Stheraven return *this; 3232227825Stheraven} 3233227825Stheraven 3234227825Stheraventemplate <class _Tp> 3235227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3236227825Stheravenvalarray<_Tp>& 3237227825Stheravenvalarray<_Tp>::operator^=(const value_type& __x) 3238227825Stheraven{ 3239227825Stheraven for (value_type* __p = __begin_; __p != __end_; ++__p) 3240227825Stheraven *__p ^= __x; 3241227825Stheraven return *this; 3242227825Stheraven} 3243227825Stheraven 3244227825Stheraventemplate <class _Tp> 3245227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3246227825Stheravenvalarray<_Tp>& 3247227825Stheravenvalarray<_Tp>::operator&=(const value_type& __x) 3248227825Stheraven{ 3249227825Stheraven for (value_type* __p = __begin_; __p != __end_; ++__p) 3250227825Stheraven *__p &= __x; 3251227825Stheraven return *this; 3252227825Stheraven} 3253227825Stheraven 3254227825Stheraventemplate <class _Tp> 3255227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3256227825Stheravenvalarray<_Tp>& 3257227825Stheravenvalarray<_Tp>::operator|=(const value_type& __x) 3258227825Stheraven{ 3259227825Stheraven for (value_type* __p = __begin_; __p != __end_; ++__p) 3260227825Stheraven *__p |= __x; 3261227825Stheraven return *this; 3262227825Stheraven} 3263227825Stheraven 3264227825Stheraventemplate <class _Tp> 3265227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3266227825Stheravenvalarray<_Tp>& 3267227825Stheravenvalarray<_Tp>::operator<<=(const value_type& __x) 3268227825Stheraven{ 3269227825Stheraven for (value_type* __p = __begin_; __p != __end_; ++__p) 3270227825Stheraven *__p <<= __x; 3271227825Stheraven return *this; 3272227825Stheraven} 3273227825Stheraven 3274227825Stheraventemplate <class _Tp> 3275227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3276227825Stheravenvalarray<_Tp>& 3277227825Stheravenvalarray<_Tp>::operator>>=(const value_type& __x) 3278227825Stheraven{ 3279227825Stheraven for (value_type* __p = __begin_; __p != __end_; ++__p) 3280227825Stheraven *__p >>= __x; 3281227825Stheraven return *this; 3282227825Stheraven} 3283227825Stheraven 3284227825Stheraventemplate <class _Tp> 3285227825Stheraventemplate <class _Expr> 3286227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3287227825Stheraventypename enable_if 3288227825Stheraven< 3289227825Stheraven __is_val_expr<_Expr>::value, 3290227825Stheraven valarray<_Tp>& 3291227825Stheraven>::type 3292227825Stheravenvalarray<_Tp>::operator*=(const _Expr& __v) 3293227825Stheraven{ 3294227825Stheraven size_t __i = 0; 3295227825Stheraven for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i) 3296227825Stheraven *__t *= __v[__i]; 3297227825Stheraven return *this; 3298227825Stheraven} 3299227825Stheraven 3300227825Stheraventemplate <class _Tp> 3301227825Stheraventemplate <class _Expr> 3302227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3303227825Stheraventypename enable_if 3304227825Stheraven< 3305227825Stheraven __is_val_expr<_Expr>::value, 3306227825Stheraven valarray<_Tp>& 3307227825Stheraven>::type 3308227825Stheravenvalarray<_Tp>::operator/=(const _Expr& __v) 3309227825Stheraven{ 3310227825Stheraven size_t __i = 0; 3311227825Stheraven for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i) 3312227825Stheraven *__t /= __v[__i]; 3313227825Stheraven return *this; 3314227825Stheraven} 3315227825Stheraven 3316227825Stheraventemplate <class _Tp> 3317227825Stheraventemplate <class _Expr> 3318227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3319227825Stheraventypename enable_if 3320227825Stheraven< 3321227825Stheraven __is_val_expr<_Expr>::value, 3322227825Stheraven valarray<_Tp>& 3323227825Stheraven>::type 3324227825Stheravenvalarray<_Tp>::operator%=(const _Expr& __v) 3325227825Stheraven{ 3326227825Stheraven size_t __i = 0; 3327227825Stheraven for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i) 3328227825Stheraven *__t %= __v[__i]; 3329227825Stheraven return *this; 3330227825Stheraven} 3331227825Stheraven 3332227825Stheraventemplate <class _Tp> 3333227825Stheraventemplate <class _Expr> 3334227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3335227825Stheraventypename enable_if 3336227825Stheraven< 3337227825Stheraven __is_val_expr<_Expr>::value, 3338227825Stheraven valarray<_Tp>& 3339227825Stheraven>::type 3340227825Stheravenvalarray<_Tp>::operator+=(const _Expr& __v) 3341227825Stheraven{ 3342227825Stheraven size_t __i = 0; 3343227825Stheraven for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i) 3344227825Stheraven *__t += __v[__i]; 3345227825Stheraven return *this; 3346227825Stheraven} 3347227825Stheraven 3348227825Stheraventemplate <class _Tp> 3349227825Stheraventemplate <class _Expr> 3350227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3351227825Stheraventypename enable_if 3352227825Stheraven< 3353227825Stheraven __is_val_expr<_Expr>::value, 3354227825Stheraven valarray<_Tp>& 3355227825Stheraven>::type 3356227825Stheravenvalarray<_Tp>::operator-=(const _Expr& __v) 3357227825Stheraven{ 3358227825Stheraven size_t __i = 0; 3359227825Stheraven for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i) 3360227825Stheraven *__t -= __v[__i]; 3361227825Stheraven return *this; 3362227825Stheraven} 3363227825Stheraven 3364227825Stheraventemplate <class _Tp> 3365227825Stheraventemplate <class _Expr> 3366227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3367227825Stheraventypename enable_if 3368227825Stheraven< 3369227825Stheraven __is_val_expr<_Expr>::value, 3370227825Stheraven valarray<_Tp>& 3371227825Stheraven>::type 3372227825Stheravenvalarray<_Tp>::operator^=(const _Expr& __v) 3373227825Stheraven{ 3374227825Stheraven size_t __i = 0; 3375227825Stheraven for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i) 3376227825Stheraven *__t ^= __v[__i]; 3377227825Stheraven return *this; 3378227825Stheraven} 3379227825Stheraven 3380227825Stheraventemplate <class _Tp> 3381227825Stheraventemplate <class _Expr> 3382227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3383227825Stheraventypename enable_if 3384227825Stheraven< 3385227825Stheraven __is_val_expr<_Expr>::value, 3386227825Stheraven valarray<_Tp>& 3387227825Stheraven>::type 3388227825Stheravenvalarray<_Tp>::operator|=(const _Expr& __v) 3389227825Stheraven{ 3390227825Stheraven size_t __i = 0; 3391227825Stheraven for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i) 3392227825Stheraven *__t |= __v[__i]; 3393227825Stheraven return *this; 3394227825Stheraven} 3395227825Stheraven 3396227825Stheraventemplate <class _Tp> 3397227825Stheraventemplate <class _Expr> 3398227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3399227825Stheraventypename enable_if 3400227825Stheraven< 3401227825Stheraven __is_val_expr<_Expr>::value, 3402227825Stheraven valarray<_Tp>& 3403227825Stheraven>::type 3404227825Stheravenvalarray<_Tp>::operator&=(const _Expr& __v) 3405227825Stheraven{ 3406227825Stheraven size_t __i = 0; 3407227825Stheraven for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i) 3408227825Stheraven *__t &= __v[__i]; 3409227825Stheraven return *this; 3410227825Stheraven} 3411227825Stheraven 3412227825Stheraventemplate <class _Tp> 3413227825Stheraventemplate <class _Expr> 3414227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3415227825Stheraventypename enable_if 3416227825Stheraven< 3417227825Stheraven __is_val_expr<_Expr>::value, 3418227825Stheraven valarray<_Tp>& 3419227825Stheraven>::type 3420227825Stheravenvalarray<_Tp>::operator<<=(const _Expr& __v) 3421227825Stheraven{ 3422227825Stheraven size_t __i = 0; 3423227825Stheraven for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i) 3424227825Stheraven *__t <<= __v[__i]; 3425227825Stheraven return *this; 3426227825Stheraven} 3427227825Stheraven 3428227825Stheraventemplate <class _Tp> 3429227825Stheraventemplate <class _Expr> 3430227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3431227825Stheraventypename enable_if 3432227825Stheraven< 3433227825Stheraven __is_val_expr<_Expr>::value, 3434227825Stheraven valarray<_Tp>& 3435227825Stheraven>::type 3436227825Stheravenvalarray<_Tp>::operator>>=(const _Expr& __v) 3437227825Stheraven{ 3438227825Stheraven size_t __i = 0; 3439227825Stheraven for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i) 3440227825Stheraven *__t >>= __v[__i]; 3441227825Stheraven return *this; 3442227825Stheraven} 3443227825Stheraven 3444227825Stheraventemplate <class _Tp> 3445227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3446227825Stheravenvoid 3447227825Stheravenvalarray<_Tp>::swap(valarray& __v) 3448227825Stheraven{ 3449227825Stheraven _VSTD::swap(__begin_, __v.__begin_); 3450227825Stheraven _VSTD::swap(__end_, __v.__end_); 3451227825Stheraven} 3452227825Stheraven 3453227825Stheraventemplate <class _Tp> 3454227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3455227825Stheraven_Tp 3456227825Stheravenvalarray<_Tp>::sum() const 3457227825Stheraven{ 3458227825Stheraven if (__begin_ == __end_) 3459227825Stheraven return value_type(); 3460227825Stheraven const value_type* __p = __begin_; 3461227825Stheraven _Tp __r = *__p; 3462227825Stheraven for (++__p; __p != __end_; ++__p) 3463227825Stheraven __r += *__p; 3464227825Stheraven return __r; 3465227825Stheraven} 3466227825Stheraven 3467227825Stheraventemplate <class _Tp> 3468227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3469227825Stheraven_Tp 3470227825Stheravenvalarray<_Tp>::min() const 3471227825Stheraven{ 3472227825Stheraven if (__begin_ == __end_) 3473227825Stheraven return value_type(); 3474227825Stheraven return *_VSTD::min_element(__begin_, __end_); 3475227825Stheraven} 3476227825Stheraven 3477227825Stheraventemplate <class _Tp> 3478227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3479227825Stheraven_Tp 3480227825Stheravenvalarray<_Tp>::max() const 3481227825Stheraven{ 3482227825Stheraven if (__begin_ == __end_) 3483227825Stheraven return value_type(); 3484227825Stheraven return *_VSTD::max_element(__begin_, __end_); 3485227825Stheraven} 3486227825Stheraven 3487227825Stheraventemplate <class _Tp> 3488227825Stheravenvalarray<_Tp> 3489227825Stheravenvalarray<_Tp>::shift(int __i) const 3490227825Stheraven{ 3491227825Stheraven valarray<value_type> __r; 3492227825Stheraven size_t __n = size(); 3493227825Stheraven if (__n) 3494227825Stheraven { 3495227825Stheraven __r.__begin_ = 3496227825Stheraven __r.__end_ = 3497227825Stheraven static_cast<value_type*>(::operator new(__n * sizeof(value_type))); 3498227825Stheraven const value_type* __sb; 3499227825Stheraven value_type* __tb; 3500227825Stheraven value_type* __te; 3501227825Stheraven if (__i >= 0) 3502227825Stheraven { 3503227825Stheraven __i = _VSTD::min(__i, static_cast<int>(__n)); 3504227825Stheraven __sb = __begin_ + __i; 3505227825Stheraven __tb = __r.__begin_; 3506227825Stheraven __te = __r.__begin_ + (__n - __i); 3507227825Stheraven } 3508227825Stheraven else 3509227825Stheraven { 3510227825Stheraven __i = _VSTD::min(-__i, static_cast<int>(__n)); 3511227825Stheraven __sb = __begin_; 3512227825Stheraven __tb = __r.__begin_ + __i; 3513227825Stheraven __te = __r.__begin_ + __n; 3514227825Stheraven } 3515227825Stheraven for (; __r.__end_ != __tb; ++__r.__end_) 3516227825Stheraven ::new (__r.__end_) value_type(); 3517227825Stheraven for (; __r.__end_ != __te; ++__r.__end_, ++__sb) 3518227825Stheraven ::new (__r.__end_) value_type(*__sb); 3519227825Stheraven for (__te = __r.__begin_ + __n; __r.__end_ != __te; ++__r.__end_) 3520227825Stheraven ::new (__r.__end_) value_type(); 3521227825Stheraven } 3522227825Stheraven return __r; 3523227825Stheraven} 3524227825Stheraven 3525227825Stheraventemplate <class _Tp> 3526227825Stheravenvalarray<_Tp> 3527227825Stheravenvalarray<_Tp>::cshift(int __i) const 3528227825Stheraven{ 3529227825Stheraven valarray<value_type> __r; 3530227825Stheraven size_t __n = size(); 3531227825Stheraven if (__n) 3532227825Stheraven { 3533227825Stheraven __r.__begin_ = 3534227825Stheraven __r.__end_ = 3535227825Stheraven static_cast<value_type*>(::operator new(__n * sizeof(value_type))); 3536227825Stheraven __i %= static_cast<int>(__n); 3537227825Stheraven const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i; 3538227825Stheraven for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s) 3539227825Stheraven ::new (__r.__end_) value_type(*__s); 3540227825Stheraven for (const value_type* __s = __begin_; __s != __m; ++__r.__end_, ++__s) 3541227825Stheraven ::new (__r.__end_) value_type(*__s); 3542227825Stheraven } 3543227825Stheraven return __r; 3544227825Stheraven} 3545227825Stheraven 3546227825Stheraventemplate <class _Tp> 3547227825Stheravenvalarray<_Tp> 3548227825Stheravenvalarray<_Tp>::apply(value_type __f(value_type)) const 3549227825Stheraven{ 3550227825Stheraven valarray<value_type> __r; 3551227825Stheraven size_t __n = size(); 3552227825Stheraven if (__n) 3553227825Stheraven { 3554227825Stheraven __r.__begin_ = 3555227825Stheraven __r.__end_ = 3556227825Stheraven static_cast<value_type*>(::operator new(__n * sizeof(value_type))); 3557227825Stheraven for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) 3558227825Stheraven ::new (__r.__end_) value_type(__f(*__p)); 3559227825Stheraven } 3560227825Stheraven return __r; 3561227825Stheraven} 3562227825Stheraven 3563227825Stheraventemplate <class _Tp> 3564227825Stheravenvalarray<_Tp> 3565227825Stheravenvalarray<_Tp>::apply(value_type __f(const value_type&)) const 3566227825Stheraven{ 3567227825Stheraven valarray<value_type> __r; 3568227825Stheraven size_t __n = size(); 3569227825Stheraven if (__n) 3570227825Stheraven { 3571227825Stheraven __r.__begin_ = 3572227825Stheraven __r.__end_ = 3573227825Stheraven static_cast<value_type*>(::operator new(__n * sizeof(value_type))); 3574227825Stheraven for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) 3575227825Stheraven ::new (__r.__end_) value_type(__f(*__p)); 3576227825Stheraven } 3577227825Stheraven return __r; 3578227825Stheraven} 3579227825Stheraven 3580227825Stheraventemplate <class _Tp> 3581227825Stheravenvoid 3582227825Stheravenvalarray<_Tp>::resize(size_t __n, value_type __x) 3583227825Stheraven{ 3584227825Stheraven if (__begin_ != nullptr) 3585227825Stheraven { 3586227825Stheraven while (__end_ != __begin_) 3587227825Stheraven (--__end_)->~value_type(); 3588227825Stheraven ::operator delete(__begin_); 3589227825Stheraven __begin_ = __end_ = nullptr; 3590227825Stheraven } 3591227825Stheraven if (__n) 3592227825Stheraven { 3593227825Stheraven __begin_ = __end_ = static_cast<value_type*>(::operator new(__n * sizeof(value_type))); 3594227825Stheraven#ifndef _LIBCPP_NO_EXCEPTIONS 3595227825Stheraven try 3596227825Stheraven { 3597227825Stheraven#endif // _LIBCPP_NO_EXCEPTIONS 3598227825Stheraven for (; __n; --__n, ++__end_) 3599227825Stheraven ::new (__end_) value_type(__x); 3600227825Stheraven#ifndef _LIBCPP_NO_EXCEPTIONS 3601227825Stheraven } 3602227825Stheraven catch (...) 3603227825Stheraven { 3604227825Stheraven resize(0); 3605227825Stheraven throw; 3606227825Stheraven } 3607227825Stheraven#endif // _LIBCPP_NO_EXCEPTIONS 3608227825Stheraven } 3609227825Stheraven} 3610227825Stheraven 3611227825Stheraventemplate<class _Tp> 3612227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3613227825Stheravenvoid 3614227825Stheravenswap(valarray<_Tp>& __x, valarray<_Tp>& __y) 3615227825Stheraven{ 3616227825Stheraven __x.swap(__y); 3617227825Stheraven} 3618227825Stheraven 3619227825Stheraventemplate<class _Expr1, class _Expr2> 3620227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3621227825Stheraventypename enable_if 3622227825Stheraven< 3623227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 3624227825Stheraven __val_expr<_BinaryOp<multiplies<typename _Expr1::value_type>, _Expr1, _Expr2> > 3625227825Stheraven>::type 3626227825Stheravenoperator*(const _Expr1& __x, const _Expr2& __y) 3627227825Stheraven{ 3628227825Stheraven typedef typename _Expr1::value_type value_type; 3629227825Stheraven typedef _BinaryOp<multiplies<value_type>, _Expr1, _Expr2> _Op; 3630227825Stheraven return __val_expr<_Op>(_Op(multiplies<value_type>(), __x, __y)); 3631227825Stheraven} 3632227825Stheraven 3633227825Stheraventemplate<class _Expr> 3634227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3635227825Stheraventypename enable_if 3636227825Stheraven< 3637227825Stheraven __is_val_expr<_Expr>::value, 3638227825Stheraven __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>, 3639227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 3640227825Stheraven>::type 3641227825Stheravenoperator*(const _Expr& __x, const typename _Expr::value_type& __y) 3642227825Stheraven{ 3643227825Stheraven typedef typename _Expr::value_type value_type; 3644227825Stheraven typedef _BinaryOp<multiplies<value_type>, _Expr, __scalar_expr<value_type> > _Op; 3645227825Stheraven return __val_expr<_Op>(_Op(multiplies<value_type>(), 3646227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 3647227825Stheraven} 3648227825Stheraven 3649227825Stheraventemplate<class _Expr> 3650227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3651227825Stheraventypename enable_if 3652227825Stheraven< 3653227825Stheraven __is_val_expr<_Expr>::value, 3654227825Stheraven __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>, 3655227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 3656227825Stheraven>::type 3657227825Stheravenoperator*(const typename _Expr::value_type& __x, const _Expr& __y) 3658227825Stheraven{ 3659227825Stheraven typedef typename _Expr::value_type value_type; 3660227825Stheraven typedef _BinaryOp<multiplies<value_type>, __scalar_expr<value_type>, _Expr> _Op; 3661227825Stheraven return __val_expr<_Op>(_Op(multiplies<value_type>(), 3662227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 3663227825Stheraven} 3664227825Stheraven 3665227825Stheraventemplate<class _Expr1, class _Expr2> 3666227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3667227825Stheraventypename enable_if 3668227825Stheraven< 3669227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 3670227825Stheraven __val_expr<_BinaryOp<divides<typename _Expr1::value_type>, _Expr1, _Expr2> > 3671227825Stheraven>::type 3672227825Stheravenoperator/(const _Expr1& __x, const _Expr2& __y) 3673227825Stheraven{ 3674227825Stheraven typedef typename _Expr1::value_type value_type; 3675227825Stheraven typedef _BinaryOp<divides<value_type>, _Expr1, _Expr2> _Op; 3676227825Stheraven return __val_expr<_Op>(_Op(divides<value_type>(), __x, __y)); 3677227825Stheraven} 3678227825Stheraven 3679227825Stheraventemplate<class _Expr> 3680227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3681227825Stheraventypename enable_if 3682227825Stheraven< 3683227825Stheraven __is_val_expr<_Expr>::value, 3684227825Stheraven __val_expr<_BinaryOp<divides<typename _Expr::value_type>, 3685227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 3686227825Stheraven>::type 3687227825Stheravenoperator/(const _Expr& __x, const typename _Expr::value_type& __y) 3688227825Stheraven{ 3689227825Stheraven typedef typename _Expr::value_type value_type; 3690227825Stheraven typedef _BinaryOp<divides<value_type>, _Expr, __scalar_expr<value_type> > _Op; 3691227825Stheraven return __val_expr<_Op>(_Op(divides<value_type>(), 3692227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 3693227825Stheraven} 3694227825Stheraven 3695227825Stheraventemplate<class _Expr> 3696227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3697227825Stheraventypename enable_if 3698227825Stheraven< 3699227825Stheraven __is_val_expr<_Expr>::value, 3700227825Stheraven __val_expr<_BinaryOp<divides<typename _Expr::value_type>, 3701227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 3702227825Stheraven>::type 3703227825Stheravenoperator/(const typename _Expr::value_type& __x, const _Expr& __y) 3704227825Stheraven{ 3705227825Stheraven typedef typename _Expr::value_type value_type; 3706227825Stheraven typedef _BinaryOp<divides<value_type>, __scalar_expr<value_type>, _Expr> _Op; 3707227825Stheraven return __val_expr<_Op>(_Op(divides<value_type>(), 3708227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 3709227825Stheraven} 3710227825Stheraven 3711227825Stheraventemplate<class _Expr1, class _Expr2> 3712227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3713227825Stheraventypename enable_if 3714227825Stheraven< 3715227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 3716227825Stheraven __val_expr<_BinaryOp<modulus<typename _Expr1::value_type>, _Expr1, _Expr2> > 3717227825Stheraven>::type 3718227825Stheravenoperator%(const _Expr1& __x, const _Expr2& __y) 3719227825Stheraven{ 3720227825Stheraven typedef typename _Expr1::value_type value_type; 3721227825Stheraven typedef _BinaryOp<modulus<value_type>, _Expr1, _Expr2> _Op; 3722227825Stheraven return __val_expr<_Op>(_Op(modulus<value_type>(), __x, __y)); 3723227825Stheraven} 3724227825Stheraven 3725227825Stheraventemplate<class _Expr> 3726227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3727227825Stheraventypename enable_if 3728227825Stheraven< 3729227825Stheraven __is_val_expr<_Expr>::value, 3730227825Stheraven __val_expr<_BinaryOp<modulus<typename _Expr::value_type>, 3731227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 3732227825Stheraven>::type 3733227825Stheravenoperator%(const _Expr& __x, const typename _Expr::value_type& __y) 3734227825Stheraven{ 3735227825Stheraven typedef typename _Expr::value_type value_type; 3736227825Stheraven typedef _BinaryOp<modulus<value_type>, _Expr, __scalar_expr<value_type> > _Op; 3737227825Stheraven return __val_expr<_Op>(_Op(modulus<value_type>(), 3738227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 3739227825Stheraven} 3740227825Stheraven 3741227825Stheraventemplate<class _Expr> 3742227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3743227825Stheraventypename enable_if 3744227825Stheraven< 3745227825Stheraven __is_val_expr<_Expr>::value, 3746227825Stheraven __val_expr<_BinaryOp<modulus<typename _Expr::value_type>, 3747227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 3748227825Stheraven>::type 3749227825Stheravenoperator%(const typename _Expr::value_type& __x, const _Expr& __y) 3750227825Stheraven{ 3751227825Stheraven typedef typename _Expr::value_type value_type; 3752227825Stheraven typedef _BinaryOp<modulus<value_type>, __scalar_expr<value_type>, _Expr> _Op; 3753227825Stheraven return __val_expr<_Op>(_Op(modulus<value_type>(), 3754227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 3755227825Stheraven} 3756227825Stheraven 3757227825Stheraventemplate<class _Expr1, class _Expr2> 3758227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3759227825Stheraventypename enable_if 3760227825Stheraven< 3761227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 3762227825Stheraven __val_expr<_BinaryOp<plus<typename _Expr1::value_type>, _Expr1, _Expr2> > 3763227825Stheraven>::type 3764227825Stheravenoperator+(const _Expr1& __x, const _Expr2& __y) 3765227825Stheraven{ 3766227825Stheraven typedef typename _Expr1::value_type value_type; 3767227825Stheraven typedef _BinaryOp<plus<value_type>, _Expr1, _Expr2> _Op; 3768227825Stheraven return __val_expr<_Op>(_Op(plus<value_type>(), __x, __y)); 3769227825Stheraven} 3770227825Stheraven 3771227825Stheraventemplate<class _Expr> 3772227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3773227825Stheraventypename enable_if 3774227825Stheraven< 3775227825Stheraven __is_val_expr<_Expr>::value, 3776227825Stheraven __val_expr<_BinaryOp<plus<typename _Expr::value_type>, 3777227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 3778227825Stheraven>::type 3779227825Stheravenoperator+(const _Expr& __x, const typename _Expr::value_type& __y) 3780227825Stheraven{ 3781227825Stheraven typedef typename _Expr::value_type value_type; 3782227825Stheraven typedef _BinaryOp<plus<value_type>, _Expr, __scalar_expr<value_type> > _Op; 3783227825Stheraven return __val_expr<_Op>(_Op(plus<value_type>(), 3784227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 3785227825Stheraven} 3786227825Stheraven 3787227825Stheraventemplate<class _Expr> 3788227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3789227825Stheraventypename enable_if 3790227825Stheraven< 3791227825Stheraven __is_val_expr<_Expr>::value, 3792227825Stheraven __val_expr<_BinaryOp<plus<typename _Expr::value_type>, 3793227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 3794227825Stheraven>::type 3795227825Stheravenoperator+(const typename _Expr::value_type& __x, const _Expr& __y) 3796227825Stheraven{ 3797227825Stheraven typedef typename _Expr::value_type value_type; 3798227825Stheraven typedef _BinaryOp<plus<value_type>, __scalar_expr<value_type>, _Expr> _Op; 3799227825Stheraven return __val_expr<_Op>(_Op(plus<value_type>(), 3800227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 3801227825Stheraven} 3802227825Stheraven 3803227825Stheraventemplate<class _Expr1, class _Expr2> 3804227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3805227825Stheraventypename enable_if 3806227825Stheraven< 3807227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 3808227825Stheraven __val_expr<_BinaryOp<minus<typename _Expr1::value_type>, _Expr1, _Expr2> > 3809227825Stheraven>::type 3810227825Stheravenoperator-(const _Expr1& __x, const _Expr2& __y) 3811227825Stheraven{ 3812227825Stheraven typedef typename _Expr1::value_type value_type; 3813227825Stheraven typedef _BinaryOp<minus<value_type>, _Expr1, _Expr2> _Op; 3814227825Stheraven return __val_expr<_Op>(_Op(minus<value_type>(), __x, __y)); 3815227825Stheraven} 3816227825Stheraven 3817227825Stheraventemplate<class _Expr> 3818227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3819227825Stheraventypename enable_if 3820227825Stheraven< 3821227825Stheraven __is_val_expr<_Expr>::value, 3822227825Stheraven __val_expr<_BinaryOp<minus<typename _Expr::value_type>, 3823227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 3824227825Stheraven>::type 3825227825Stheravenoperator-(const _Expr& __x, const typename _Expr::value_type& __y) 3826227825Stheraven{ 3827227825Stheraven typedef typename _Expr::value_type value_type; 3828227825Stheraven typedef _BinaryOp<minus<value_type>, _Expr, __scalar_expr<value_type> > _Op; 3829227825Stheraven return __val_expr<_Op>(_Op(minus<value_type>(), 3830227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 3831227825Stheraven} 3832227825Stheraven 3833227825Stheraventemplate<class _Expr> 3834227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3835227825Stheraventypename enable_if 3836227825Stheraven< 3837227825Stheraven __is_val_expr<_Expr>::value, 3838227825Stheraven __val_expr<_BinaryOp<minus<typename _Expr::value_type>, 3839227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 3840227825Stheraven>::type 3841227825Stheravenoperator-(const typename _Expr::value_type& __x, const _Expr& __y) 3842227825Stheraven{ 3843227825Stheraven typedef typename _Expr::value_type value_type; 3844227825Stheraven typedef _BinaryOp<minus<value_type>, __scalar_expr<value_type>, _Expr> _Op; 3845227825Stheraven return __val_expr<_Op>(_Op(minus<value_type>(), 3846227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 3847227825Stheraven} 3848227825Stheraven 3849227825Stheraventemplate<class _Expr1, class _Expr2> 3850227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3851227825Stheraventypename enable_if 3852227825Stheraven< 3853227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 3854227825Stheraven __val_expr<_BinaryOp<bit_xor<typename _Expr1::value_type>, _Expr1, _Expr2> > 3855227825Stheraven>::type 3856227825Stheravenoperator^(const _Expr1& __x, const _Expr2& __y) 3857227825Stheraven{ 3858227825Stheraven typedef typename _Expr1::value_type value_type; 3859227825Stheraven typedef _BinaryOp<bit_xor<value_type>, _Expr1, _Expr2> _Op; 3860227825Stheraven return __val_expr<_Op>(_Op(bit_xor<value_type>(), __x, __y)); 3861227825Stheraven} 3862227825Stheraven 3863227825Stheraventemplate<class _Expr> 3864227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3865227825Stheraventypename enable_if 3866227825Stheraven< 3867227825Stheraven __is_val_expr<_Expr>::value, 3868227825Stheraven __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>, 3869227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 3870227825Stheraven>::type 3871227825Stheravenoperator^(const _Expr& __x, const typename _Expr::value_type& __y) 3872227825Stheraven{ 3873227825Stheraven typedef typename _Expr::value_type value_type; 3874227825Stheraven typedef _BinaryOp<bit_xor<value_type>, _Expr, __scalar_expr<value_type> > _Op; 3875227825Stheraven return __val_expr<_Op>(_Op(bit_xor<value_type>(), 3876227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 3877227825Stheraven} 3878227825Stheraven 3879227825Stheraventemplate<class _Expr> 3880227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3881227825Stheraventypename enable_if 3882227825Stheraven< 3883227825Stheraven __is_val_expr<_Expr>::value, 3884227825Stheraven __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>, 3885227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 3886227825Stheraven>::type 3887227825Stheravenoperator^(const typename _Expr::value_type& __x, const _Expr& __y) 3888227825Stheraven{ 3889227825Stheraven typedef typename _Expr::value_type value_type; 3890227825Stheraven typedef _BinaryOp<bit_xor<value_type>, __scalar_expr<value_type>, _Expr> _Op; 3891227825Stheraven return __val_expr<_Op>(_Op(bit_xor<value_type>(), 3892227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 3893227825Stheraven} 3894227825Stheraven 3895227825Stheraventemplate<class _Expr1, class _Expr2> 3896227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3897227825Stheraventypename enable_if 3898227825Stheraven< 3899227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 3900227825Stheraven __val_expr<_BinaryOp<bit_and<typename _Expr1::value_type>, _Expr1, _Expr2> > 3901227825Stheraven>::type 3902227825Stheravenoperator&(const _Expr1& __x, const _Expr2& __y) 3903227825Stheraven{ 3904227825Stheraven typedef typename _Expr1::value_type value_type; 3905227825Stheraven typedef _BinaryOp<bit_and<value_type>, _Expr1, _Expr2> _Op; 3906227825Stheraven return __val_expr<_Op>(_Op(bit_and<value_type>(), __x, __y)); 3907227825Stheraven} 3908227825Stheraven 3909227825Stheraventemplate<class _Expr> 3910227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3911227825Stheraventypename enable_if 3912227825Stheraven< 3913227825Stheraven __is_val_expr<_Expr>::value, 3914227825Stheraven __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>, 3915227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 3916227825Stheraven>::type 3917227825Stheravenoperator&(const _Expr& __x, const typename _Expr::value_type& __y) 3918227825Stheraven{ 3919227825Stheraven typedef typename _Expr::value_type value_type; 3920227825Stheraven typedef _BinaryOp<bit_and<value_type>, _Expr, __scalar_expr<value_type> > _Op; 3921227825Stheraven return __val_expr<_Op>(_Op(bit_and<value_type>(), 3922227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 3923227825Stheraven} 3924227825Stheraven 3925227825Stheraventemplate<class _Expr> 3926227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3927227825Stheraventypename enable_if 3928227825Stheraven< 3929227825Stheraven __is_val_expr<_Expr>::value, 3930227825Stheraven __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>, 3931227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 3932227825Stheraven>::type 3933227825Stheravenoperator&(const typename _Expr::value_type& __x, const _Expr& __y) 3934227825Stheraven{ 3935227825Stheraven typedef typename _Expr::value_type value_type; 3936227825Stheraven typedef _BinaryOp<bit_and<value_type>, __scalar_expr<value_type>, _Expr> _Op; 3937227825Stheraven return __val_expr<_Op>(_Op(bit_and<value_type>(), 3938227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 3939227825Stheraven} 3940227825Stheraven 3941227825Stheraventemplate<class _Expr1, class _Expr2> 3942227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3943227825Stheraventypename enable_if 3944227825Stheraven< 3945227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 3946227825Stheraven __val_expr<_BinaryOp<bit_or<typename _Expr1::value_type>, _Expr1, _Expr2> > 3947227825Stheraven>::type 3948227825Stheravenoperator|(const _Expr1& __x, const _Expr2& __y) 3949227825Stheraven{ 3950227825Stheraven typedef typename _Expr1::value_type value_type; 3951227825Stheraven typedef _BinaryOp<bit_or<value_type>, _Expr1, _Expr2> _Op; 3952227825Stheraven return __val_expr<_Op>(_Op(bit_or<value_type>(), __x, __y)); 3953227825Stheraven} 3954227825Stheraven 3955227825Stheraventemplate<class _Expr> 3956227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3957227825Stheraventypename enable_if 3958227825Stheraven< 3959227825Stheraven __is_val_expr<_Expr>::value, 3960227825Stheraven __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>, 3961227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 3962227825Stheraven>::type 3963227825Stheravenoperator|(const _Expr& __x, const typename _Expr::value_type& __y) 3964227825Stheraven{ 3965227825Stheraven typedef typename _Expr::value_type value_type; 3966227825Stheraven typedef _BinaryOp<bit_or<value_type>, _Expr, __scalar_expr<value_type> > _Op; 3967227825Stheraven return __val_expr<_Op>(_Op(bit_or<value_type>(), 3968227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 3969227825Stheraven} 3970227825Stheraven 3971227825Stheraventemplate<class _Expr> 3972227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3973227825Stheraventypename enable_if 3974227825Stheraven< 3975227825Stheraven __is_val_expr<_Expr>::value, 3976227825Stheraven __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>, 3977227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 3978227825Stheraven>::type 3979227825Stheravenoperator|(const typename _Expr::value_type& __x, const _Expr& __y) 3980227825Stheraven{ 3981227825Stheraven typedef typename _Expr::value_type value_type; 3982227825Stheraven typedef _BinaryOp<bit_or<value_type>, __scalar_expr<value_type>, _Expr> _Op; 3983227825Stheraven return __val_expr<_Op>(_Op(bit_or<value_type>(), 3984227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 3985227825Stheraven} 3986227825Stheraven 3987227825Stheraventemplate<class _Expr1, class _Expr2> 3988227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3989227825Stheraventypename enable_if 3990227825Stheraven< 3991227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 3992227825Stheraven __val_expr<_BinaryOp<__bit_shift_left<typename _Expr1::value_type>, _Expr1, _Expr2> > 3993227825Stheraven>::type 3994227825Stheravenoperator<<(const _Expr1& __x, const _Expr2& __y) 3995227825Stheraven{ 3996227825Stheraven typedef typename _Expr1::value_type value_type; 3997227825Stheraven typedef _BinaryOp<__bit_shift_left<value_type>, _Expr1, _Expr2> _Op; 3998227825Stheraven return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), __x, __y)); 3999227825Stheraven} 4000227825Stheraven 4001227825Stheraventemplate<class _Expr> 4002227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4003227825Stheraventypename enable_if 4004227825Stheraven< 4005227825Stheraven __is_val_expr<_Expr>::value, 4006227825Stheraven __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>, 4007227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 4008227825Stheraven>::type 4009227825Stheravenoperator<<(const _Expr& __x, const typename _Expr::value_type& __y) 4010227825Stheraven{ 4011227825Stheraven typedef typename _Expr::value_type value_type; 4012227825Stheraven typedef _BinaryOp<__bit_shift_left<value_type>, _Expr, __scalar_expr<value_type> > _Op; 4013227825Stheraven return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), 4014227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 4015227825Stheraven} 4016227825Stheraven 4017227825Stheraventemplate<class _Expr> 4018227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4019227825Stheraventypename enable_if 4020227825Stheraven< 4021227825Stheraven __is_val_expr<_Expr>::value, 4022227825Stheraven __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>, 4023227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 4024227825Stheraven>::type 4025227825Stheravenoperator<<(const typename _Expr::value_type& __x, const _Expr& __y) 4026227825Stheraven{ 4027227825Stheraven typedef typename _Expr::value_type value_type; 4028227825Stheraven typedef _BinaryOp<__bit_shift_left<value_type>, __scalar_expr<value_type>, _Expr> _Op; 4029227825Stheraven return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), 4030227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 4031227825Stheraven} 4032227825Stheraven 4033227825Stheraventemplate<class _Expr1, class _Expr2> 4034227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4035227825Stheraventypename enable_if 4036227825Stheraven< 4037227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 4038227825Stheraven __val_expr<_BinaryOp<__bit_shift_right<typename _Expr1::value_type>, _Expr1, _Expr2> > 4039227825Stheraven>::type 4040227825Stheravenoperator>>(const _Expr1& __x, const _Expr2& __y) 4041227825Stheraven{ 4042227825Stheraven typedef typename _Expr1::value_type value_type; 4043227825Stheraven typedef _BinaryOp<__bit_shift_right<value_type>, _Expr1, _Expr2> _Op; 4044227825Stheraven return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), __x, __y)); 4045227825Stheraven} 4046227825Stheraven 4047227825Stheraventemplate<class _Expr> 4048227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4049227825Stheraventypename enable_if 4050227825Stheraven< 4051227825Stheraven __is_val_expr<_Expr>::value, 4052227825Stheraven __val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>, 4053227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 4054227825Stheraven>::type 4055227825Stheravenoperator>>(const _Expr& __x, const typename _Expr::value_type& __y) 4056227825Stheraven{ 4057227825Stheraven typedef typename _Expr::value_type value_type; 4058227825Stheraven typedef _BinaryOp<__bit_shift_right<value_type>, _Expr, __scalar_expr<value_type> > _Op; 4059227825Stheraven return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), 4060227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 4061227825Stheraven} 4062227825Stheraven 4063227825Stheraventemplate<class _Expr> 4064227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4065227825Stheraventypename enable_if 4066227825Stheraven< 4067227825Stheraven __is_val_expr<_Expr>::value, 4068227825Stheraven __val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>, 4069227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 4070227825Stheraven>::type 4071227825Stheravenoperator>>(const typename _Expr::value_type& __x, const _Expr& __y) 4072227825Stheraven{ 4073227825Stheraven typedef typename _Expr::value_type value_type; 4074227825Stheraven typedef _BinaryOp<__bit_shift_right<value_type>, __scalar_expr<value_type>, _Expr> _Op; 4075227825Stheraven return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), 4076227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 4077227825Stheraven} 4078227825Stheraven 4079227825Stheraventemplate<class _Expr1, class _Expr2> 4080227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4081227825Stheraventypename enable_if 4082227825Stheraven< 4083227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 4084227825Stheraven __val_expr<_BinaryOp<logical_and<typename _Expr1::value_type>, _Expr1, _Expr2> > 4085227825Stheraven>::type 4086227825Stheravenoperator&&(const _Expr1& __x, const _Expr2& __y) 4087227825Stheraven{ 4088227825Stheraven typedef typename _Expr1::value_type value_type; 4089227825Stheraven typedef _BinaryOp<logical_and<value_type>, _Expr1, _Expr2> _Op; 4090227825Stheraven return __val_expr<_Op>(_Op(logical_and<value_type>(), __x, __y)); 4091227825Stheraven} 4092227825Stheraven 4093227825Stheraventemplate<class _Expr> 4094227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4095227825Stheraventypename enable_if 4096227825Stheraven< 4097227825Stheraven __is_val_expr<_Expr>::value, 4098227825Stheraven __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>, 4099227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 4100227825Stheraven>::type 4101227825Stheravenoperator&&(const _Expr& __x, const typename _Expr::value_type& __y) 4102227825Stheraven{ 4103227825Stheraven typedef typename _Expr::value_type value_type; 4104227825Stheraven typedef _BinaryOp<logical_and<value_type>, _Expr, __scalar_expr<value_type> > _Op; 4105227825Stheraven return __val_expr<_Op>(_Op(logical_and<value_type>(), 4106227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 4107227825Stheraven} 4108227825Stheraven 4109227825Stheraventemplate<class _Expr> 4110227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4111227825Stheraventypename enable_if 4112227825Stheraven< 4113227825Stheraven __is_val_expr<_Expr>::value, 4114227825Stheraven __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>, 4115227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 4116227825Stheraven>::type 4117227825Stheravenoperator&&(const typename _Expr::value_type& __x, const _Expr& __y) 4118227825Stheraven{ 4119227825Stheraven typedef typename _Expr::value_type value_type; 4120227825Stheraven typedef _BinaryOp<logical_and<value_type>, __scalar_expr<value_type>, _Expr> _Op; 4121227825Stheraven return __val_expr<_Op>(_Op(logical_and<value_type>(), 4122227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 4123227825Stheraven} 4124227825Stheraven 4125227825Stheraventemplate<class _Expr1, class _Expr2> 4126227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4127227825Stheraventypename enable_if 4128227825Stheraven< 4129227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 4130227825Stheraven __val_expr<_BinaryOp<logical_or<typename _Expr1::value_type>, _Expr1, _Expr2> > 4131227825Stheraven>::type 4132227825Stheravenoperator||(const _Expr1& __x, const _Expr2& __y) 4133227825Stheraven{ 4134227825Stheraven typedef typename _Expr1::value_type value_type; 4135227825Stheraven typedef _BinaryOp<logical_or<value_type>, _Expr1, _Expr2> _Op; 4136227825Stheraven return __val_expr<_Op>(_Op(logical_or<value_type>(), __x, __y)); 4137227825Stheraven} 4138227825Stheraven 4139227825Stheraventemplate<class _Expr> 4140227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4141227825Stheraventypename enable_if 4142227825Stheraven< 4143227825Stheraven __is_val_expr<_Expr>::value, 4144227825Stheraven __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>, 4145227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 4146227825Stheraven>::type 4147227825Stheravenoperator||(const _Expr& __x, const typename _Expr::value_type& __y) 4148227825Stheraven{ 4149227825Stheraven typedef typename _Expr::value_type value_type; 4150227825Stheraven typedef _BinaryOp<logical_or<value_type>, _Expr, __scalar_expr<value_type> > _Op; 4151227825Stheraven return __val_expr<_Op>(_Op(logical_or<value_type>(), 4152227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 4153227825Stheraven} 4154227825Stheraven 4155227825Stheraventemplate<class _Expr> 4156227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4157227825Stheraventypename enable_if 4158227825Stheraven< 4159227825Stheraven __is_val_expr<_Expr>::value, 4160227825Stheraven __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>, 4161227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 4162227825Stheraven>::type 4163227825Stheravenoperator||(const typename _Expr::value_type& __x, const _Expr& __y) 4164227825Stheraven{ 4165227825Stheraven typedef typename _Expr::value_type value_type; 4166227825Stheraven typedef _BinaryOp<logical_or<value_type>, __scalar_expr<value_type>, _Expr> _Op; 4167227825Stheraven return __val_expr<_Op>(_Op(logical_or<value_type>(), 4168227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 4169227825Stheraven} 4170227825Stheraven 4171227825Stheraventemplate<class _Expr1, class _Expr2> 4172227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4173227825Stheraventypename enable_if 4174227825Stheraven< 4175227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 4176227825Stheraven __val_expr<_BinaryOp<equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> > 4177227825Stheraven>::type 4178227825Stheravenoperator==(const _Expr1& __x, const _Expr2& __y) 4179227825Stheraven{ 4180227825Stheraven typedef typename _Expr1::value_type value_type; 4181227825Stheraven typedef _BinaryOp<equal_to<value_type>, _Expr1, _Expr2> _Op; 4182227825Stheraven return __val_expr<_Op>(_Op(equal_to<value_type>(), __x, __y)); 4183227825Stheraven} 4184227825Stheraven 4185227825Stheraventemplate<class _Expr> 4186227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4187227825Stheraventypename enable_if 4188227825Stheraven< 4189227825Stheraven __is_val_expr<_Expr>::value, 4190227825Stheraven __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>, 4191227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 4192227825Stheraven>::type 4193227825Stheravenoperator==(const _Expr& __x, const typename _Expr::value_type& __y) 4194227825Stheraven{ 4195227825Stheraven typedef typename _Expr::value_type value_type; 4196227825Stheraven typedef _BinaryOp<equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op; 4197227825Stheraven return __val_expr<_Op>(_Op(equal_to<value_type>(), 4198227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 4199227825Stheraven} 4200227825Stheraven 4201227825Stheraventemplate<class _Expr> 4202227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4203227825Stheraventypename enable_if 4204227825Stheraven< 4205227825Stheraven __is_val_expr<_Expr>::value, 4206227825Stheraven __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>, 4207227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 4208227825Stheraven>::type 4209227825Stheravenoperator==(const typename _Expr::value_type& __x, const _Expr& __y) 4210227825Stheraven{ 4211227825Stheraven typedef typename _Expr::value_type value_type; 4212227825Stheraven typedef _BinaryOp<equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op; 4213227825Stheraven return __val_expr<_Op>(_Op(equal_to<value_type>(), 4214227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 4215227825Stheraven} 4216227825Stheraven 4217227825Stheraventemplate<class _Expr1, class _Expr2> 4218227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4219227825Stheraventypename enable_if 4220227825Stheraven< 4221227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 4222227825Stheraven __val_expr<_BinaryOp<not_equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> > 4223227825Stheraven>::type 4224227825Stheravenoperator!=(const _Expr1& __x, const _Expr2& __y) 4225227825Stheraven{ 4226227825Stheraven typedef typename _Expr1::value_type value_type; 4227227825Stheraven typedef _BinaryOp<not_equal_to<value_type>, _Expr1, _Expr2> _Op; 4228227825Stheraven return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __x, __y)); 4229227825Stheraven} 4230227825Stheraven 4231227825Stheraventemplate<class _Expr> 4232227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4233227825Stheraventypename enable_if 4234227825Stheraven< 4235227825Stheraven __is_val_expr<_Expr>::value, 4236227825Stheraven __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>, 4237227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 4238227825Stheraven>::type 4239227825Stheravenoperator!=(const _Expr& __x, const typename _Expr::value_type& __y) 4240227825Stheraven{ 4241227825Stheraven typedef typename _Expr::value_type value_type; 4242227825Stheraven typedef _BinaryOp<not_equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op; 4243227825Stheraven return __val_expr<_Op>(_Op(not_equal_to<value_type>(), 4244227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 4245227825Stheraven} 4246227825Stheraven 4247227825Stheraventemplate<class _Expr> 4248227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4249227825Stheraventypename enable_if 4250227825Stheraven< 4251227825Stheraven __is_val_expr<_Expr>::value, 4252227825Stheraven __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>, 4253227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 4254227825Stheraven>::type 4255227825Stheravenoperator!=(const typename _Expr::value_type& __x, const _Expr& __y) 4256227825Stheraven{ 4257227825Stheraven typedef typename _Expr::value_type value_type; 4258227825Stheraven typedef _BinaryOp<not_equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op; 4259227825Stheraven return __val_expr<_Op>(_Op(not_equal_to<value_type>(), 4260227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 4261227825Stheraven} 4262227825Stheraven 4263227825Stheraventemplate<class _Expr1, class _Expr2> 4264227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4265227825Stheraventypename enable_if 4266227825Stheraven< 4267227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 4268227825Stheraven __val_expr<_BinaryOp<less<typename _Expr1::value_type>, _Expr1, _Expr2> > 4269227825Stheraven>::type 4270227825Stheravenoperator<(const _Expr1& __x, const _Expr2& __y) 4271227825Stheraven{ 4272227825Stheraven typedef typename _Expr1::value_type value_type; 4273227825Stheraven typedef _BinaryOp<less<value_type>, _Expr1, _Expr2> _Op; 4274227825Stheraven return __val_expr<_Op>(_Op(less<value_type>(), __x, __y)); 4275227825Stheraven} 4276227825Stheraven 4277227825Stheraventemplate<class _Expr> 4278227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4279227825Stheraventypename enable_if 4280227825Stheraven< 4281227825Stheraven __is_val_expr<_Expr>::value, 4282227825Stheraven __val_expr<_BinaryOp<less<typename _Expr::value_type>, 4283227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 4284227825Stheraven>::type 4285227825Stheravenoperator<(const _Expr& __x, const typename _Expr::value_type& __y) 4286227825Stheraven{ 4287227825Stheraven typedef typename _Expr::value_type value_type; 4288227825Stheraven typedef _BinaryOp<less<value_type>, _Expr, __scalar_expr<value_type> > _Op; 4289227825Stheraven return __val_expr<_Op>(_Op(less<value_type>(), 4290227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 4291227825Stheraven} 4292227825Stheraven 4293227825Stheraventemplate<class _Expr> 4294227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4295227825Stheraventypename enable_if 4296227825Stheraven< 4297227825Stheraven __is_val_expr<_Expr>::value, 4298227825Stheraven __val_expr<_BinaryOp<less<typename _Expr::value_type>, 4299227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 4300227825Stheraven>::type 4301227825Stheravenoperator<(const typename _Expr::value_type& __x, const _Expr& __y) 4302227825Stheraven{ 4303227825Stheraven typedef typename _Expr::value_type value_type; 4304227825Stheraven typedef _BinaryOp<less<value_type>, __scalar_expr<value_type>, _Expr> _Op; 4305227825Stheraven return __val_expr<_Op>(_Op(less<value_type>(), 4306227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 4307227825Stheraven} 4308227825Stheraven 4309227825Stheraventemplate<class _Expr1, class _Expr2> 4310227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4311227825Stheraventypename enable_if 4312227825Stheraven< 4313227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 4314227825Stheraven __val_expr<_BinaryOp<greater<typename _Expr1::value_type>, _Expr1, _Expr2> > 4315227825Stheraven>::type 4316227825Stheravenoperator>(const _Expr1& __x, const _Expr2& __y) 4317227825Stheraven{ 4318227825Stheraven typedef typename _Expr1::value_type value_type; 4319227825Stheraven typedef _BinaryOp<greater<value_type>, _Expr1, _Expr2> _Op; 4320227825Stheraven return __val_expr<_Op>(_Op(greater<value_type>(), __x, __y)); 4321227825Stheraven} 4322227825Stheraven 4323227825Stheraventemplate<class _Expr> 4324227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4325227825Stheraventypename enable_if 4326227825Stheraven< 4327227825Stheraven __is_val_expr<_Expr>::value, 4328227825Stheraven __val_expr<_BinaryOp<greater<typename _Expr::value_type>, 4329227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 4330227825Stheraven>::type 4331227825Stheravenoperator>(const _Expr& __x, const typename _Expr::value_type& __y) 4332227825Stheraven{ 4333227825Stheraven typedef typename _Expr::value_type value_type; 4334227825Stheraven typedef _BinaryOp<greater<value_type>, _Expr, __scalar_expr<value_type> > _Op; 4335227825Stheraven return __val_expr<_Op>(_Op(greater<value_type>(), 4336227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 4337227825Stheraven} 4338227825Stheraven 4339227825Stheraventemplate<class _Expr> 4340227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4341227825Stheraventypename enable_if 4342227825Stheraven< 4343227825Stheraven __is_val_expr<_Expr>::value, 4344227825Stheraven __val_expr<_BinaryOp<greater<typename _Expr::value_type>, 4345227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 4346227825Stheraven>::type 4347227825Stheravenoperator>(const typename _Expr::value_type& __x, const _Expr& __y) 4348227825Stheraven{ 4349227825Stheraven typedef typename _Expr::value_type value_type; 4350227825Stheraven typedef _BinaryOp<greater<value_type>, __scalar_expr<value_type>, _Expr> _Op; 4351227825Stheraven return __val_expr<_Op>(_Op(greater<value_type>(), 4352227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 4353227825Stheraven} 4354227825Stheraven 4355227825Stheraventemplate<class _Expr1, class _Expr2> 4356227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4357227825Stheraventypename enable_if 4358227825Stheraven< 4359227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 4360227825Stheraven __val_expr<_BinaryOp<less_equal<typename _Expr1::value_type>, _Expr1, _Expr2> > 4361227825Stheraven>::type 4362227825Stheravenoperator<=(const _Expr1& __x, const _Expr2& __y) 4363227825Stheraven{ 4364227825Stheraven typedef typename _Expr1::value_type value_type; 4365227825Stheraven typedef _BinaryOp<less_equal<value_type>, _Expr1, _Expr2> _Op; 4366227825Stheraven return __val_expr<_Op>(_Op(less_equal<value_type>(), __x, __y)); 4367227825Stheraven} 4368227825Stheraven 4369227825Stheraventemplate<class _Expr> 4370227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4371227825Stheraventypename enable_if 4372227825Stheraven< 4373227825Stheraven __is_val_expr<_Expr>::value, 4374227825Stheraven __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>, 4375227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 4376227825Stheraven>::type 4377227825Stheravenoperator<=(const _Expr& __x, const typename _Expr::value_type& __y) 4378227825Stheraven{ 4379227825Stheraven typedef typename _Expr::value_type value_type; 4380227825Stheraven typedef _BinaryOp<less_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op; 4381227825Stheraven return __val_expr<_Op>(_Op(less_equal<value_type>(), 4382227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 4383227825Stheraven} 4384227825Stheraven 4385227825Stheraventemplate<class _Expr> 4386227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4387227825Stheraventypename enable_if 4388227825Stheraven< 4389227825Stheraven __is_val_expr<_Expr>::value, 4390227825Stheraven __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>, 4391227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 4392227825Stheraven>::type 4393227825Stheravenoperator<=(const typename _Expr::value_type& __x, const _Expr& __y) 4394227825Stheraven{ 4395227825Stheraven typedef typename _Expr::value_type value_type; 4396227825Stheraven typedef _BinaryOp<less_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op; 4397227825Stheraven return __val_expr<_Op>(_Op(less_equal<value_type>(), 4398227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 4399227825Stheraven} 4400227825Stheraven 4401227825Stheraventemplate<class _Expr1, class _Expr2> 4402227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4403227825Stheraventypename enable_if 4404227825Stheraven< 4405227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 4406227825Stheraven __val_expr<_BinaryOp<greater_equal<typename _Expr1::value_type>, _Expr1, _Expr2> > 4407227825Stheraven>::type 4408227825Stheravenoperator>=(const _Expr1& __x, const _Expr2& __y) 4409227825Stheraven{ 4410227825Stheraven typedef typename _Expr1::value_type value_type; 4411227825Stheraven typedef _BinaryOp<greater_equal<value_type>, _Expr1, _Expr2> _Op; 4412227825Stheraven return __val_expr<_Op>(_Op(greater_equal<value_type>(), __x, __y)); 4413227825Stheraven} 4414227825Stheraven 4415227825Stheraventemplate<class _Expr> 4416227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4417227825Stheraventypename enable_if 4418227825Stheraven< 4419227825Stheraven __is_val_expr<_Expr>::value, 4420227825Stheraven __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>, 4421227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 4422227825Stheraven>::type 4423227825Stheravenoperator>=(const _Expr& __x, const typename _Expr::value_type& __y) 4424227825Stheraven{ 4425227825Stheraven typedef typename _Expr::value_type value_type; 4426227825Stheraven typedef _BinaryOp<greater_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op; 4427227825Stheraven return __val_expr<_Op>(_Op(greater_equal<value_type>(), 4428227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 4429227825Stheraven} 4430227825Stheraven 4431227825Stheraventemplate<class _Expr> 4432227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4433227825Stheraventypename enable_if 4434227825Stheraven< 4435227825Stheraven __is_val_expr<_Expr>::value, 4436227825Stheraven __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>, 4437227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 4438227825Stheraven>::type 4439227825Stheravenoperator>=(const typename _Expr::value_type& __x, const _Expr& __y) 4440227825Stheraven{ 4441227825Stheraven typedef typename _Expr::value_type value_type; 4442227825Stheraven typedef _BinaryOp<greater_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op; 4443227825Stheraven return __val_expr<_Op>(_Op(greater_equal<value_type>(), 4444227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 4445227825Stheraven} 4446227825Stheraven 4447227825Stheraventemplate<class _Expr> 4448227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4449227825Stheraventypename enable_if 4450227825Stheraven< 4451227825Stheraven __is_val_expr<_Expr>::value, 4452227825Stheraven __val_expr<_UnaryOp<__abs_expr<typename _Expr::value_type>, _Expr> > 4453227825Stheraven>::type 4454227825Stheravenabs(const _Expr& __x) 4455227825Stheraven{ 4456227825Stheraven typedef typename _Expr::value_type value_type; 4457227825Stheraven typedef _UnaryOp<__abs_expr<value_type>, _Expr> _Op; 4458227825Stheraven return __val_expr<_Op>(_Op(__abs_expr<value_type>(), __x)); 4459227825Stheraven} 4460227825Stheraven 4461227825Stheraventemplate<class _Expr> 4462227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4463227825Stheraventypename enable_if 4464227825Stheraven< 4465227825Stheraven __is_val_expr<_Expr>::value, 4466227825Stheraven __val_expr<_UnaryOp<__acos_expr<typename _Expr::value_type>, _Expr> > 4467227825Stheraven>::type 4468227825Stheravenacos(const _Expr& __x) 4469227825Stheraven{ 4470227825Stheraven typedef typename _Expr::value_type value_type; 4471227825Stheraven typedef _UnaryOp<__acos_expr<value_type>, _Expr> _Op; 4472227825Stheraven return __val_expr<_Op>(_Op(__acos_expr<value_type>(), __x)); 4473227825Stheraven} 4474227825Stheraven 4475227825Stheraventemplate<class _Expr> 4476227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4477227825Stheraventypename enable_if 4478227825Stheraven< 4479227825Stheraven __is_val_expr<_Expr>::value, 4480227825Stheraven __val_expr<_UnaryOp<__asin_expr<typename _Expr::value_type>, _Expr> > 4481227825Stheraven>::type 4482227825Stheravenasin(const _Expr& __x) 4483227825Stheraven{ 4484227825Stheraven typedef typename _Expr::value_type value_type; 4485227825Stheraven typedef _UnaryOp<__asin_expr<value_type>, _Expr> _Op; 4486227825Stheraven return __val_expr<_Op>(_Op(__asin_expr<value_type>(), __x)); 4487227825Stheraven} 4488227825Stheraven 4489227825Stheraventemplate<class _Expr> 4490227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4491227825Stheraventypename enable_if 4492227825Stheraven< 4493227825Stheraven __is_val_expr<_Expr>::value, 4494227825Stheraven __val_expr<_UnaryOp<__atan_expr<typename _Expr::value_type>, _Expr> > 4495227825Stheraven>::type 4496227825Stheravenatan(const _Expr& __x) 4497227825Stheraven{ 4498227825Stheraven typedef typename _Expr::value_type value_type; 4499227825Stheraven typedef _UnaryOp<__atan_expr<value_type>, _Expr> _Op; 4500227825Stheraven return __val_expr<_Op>(_Op(__atan_expr<value_type>(), __x)); 4501227825Stheraven} 4502227825Stheraven 4503227825Stheraventemplate<class _Expr1, class _Expr2> 4504227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4505227825Stheraventypename enable_if 4506227825Stheraven< 4507227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 4508227825Stheraven __val_expr<_BinaryOp<__atan2_expr<typename _Expr1::value_type>, _Expr1, _Expr2> > 4509227825Stheraven>::type 4510227825Stheravenatan2(const _Expr1& __x, const _Expr2& __y) 4511227825Stheraven{ 4512227825Stheraven typedef typename _Expr1::value_type value_type; 4513227825Stheraven typedef _BinaryOp<__atan2_expr<value_type>, _Expr1, _Expr2> _Op; 4514227825Stheraven return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __x, __y)); 4515227825Stheraven} 4516227825Stheraven 4517227825Stheraventemplate<class _Expr> 4518227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4519227825Stheraventypename enable_if 4520227825Stheraven< 4521227825Stheraven __is_val_expr<_Expr>::value, 4522227825Stheraven __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>, 4523227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 4524227825Stheraven>::type 4525227825Stheravenatan2(const _Expr& __x, const typename _Expr::value_type& __y) 4526227825Stheraven{ 4527227825Stheraven typedef typename _Expr::value_type value_type; 4528227825Stheraven typedef _BinaryOp<__atan2_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op; 4529227825Stheraven return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), 4530227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 4531227825Stheraven} 4532227825Stheraven 4533227825Stheraventemplate<class _Expr> 4534227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4535227825Stheraventypename enable_if 4536227825Stheraven< 4537227825Stheraven __is_val_expr<_Expr>::value, 4538227825Stheraven __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>, 4539227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 4540227825Stheraven>::type 4541227825Stheravenatan2(const typename _Expr::value_type& __x, const _Expr& __y) 4542227825Stheraven{ 4543227825Stheraven typedef typename _Expr::value_type value_type; 4544227825Stheraven typedef _BinaryOp<__atan2_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op; 4545227825Stheraven return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), 4546227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 4547227825Stheraven} 4548227825Stheraven 4549227825Stheraventemplate<class _Expr> 4550227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4551227825Stheraventypename enable_if 4552227825Stheraven< 4553227825Stheraven __is_val_expr<_Expr>::value, 4554227825Stheraven __val_expr<_UnaryOp<__cos_expr<typename _Expr::value_type>, _Expr> > 4555227825Stheraven>::type 4556227825Stheravencos(const _Expr& __x) 4557227825Stheraven{ 4558227825Stheraven typedef typename _Expr::value_type value_type; 4559227825Stheraven typedef _UnaryOp<__cos_expr<value_type>, _Expr> _Op; 4560227825Stheraven return __val_expr<_Op>(_Op(__cos_expr<value_type>(), __x)); 4561227825Stheraven} 4562227825Stheraven 4563227825Stheraventemplate<class _Expr> 4564227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4565227825Stheraventypename enable_if 4566227825Stheraven< 4567227825Stheraven __is_val_expr<_Expr>::value, 4568227825Stheraven __val_expr<_UnaryOp<__cosh_expr<typename _Expr::value_type>, _Expr> > 4569227825Stheraven>::type 4570227825Stheravencosh(const _Expr& __x) 4571227825Stheraven{ 4572227825Stheraven typedef typename _Expr::value_type value_type; 4573227825Stheraven typedef _UnaryOp<__cosh_expr<value_type>, _Expr> _Op; 4574227825Stheraven return __val_expr<_Op>(_Op(__cosh_expr<value_type>(), __x)); 4575227825Stheraven} 4576227825Stheraven 4577227825Stheraventemplate<class _Expr> 4578227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4579227825Stheraventypename enable_if 4580227825Stheraven< 4581227825Stheraven __is_val_expr<_Expr>::value, 4582227825Stheraven __val_expr<_UnaryOp<__exp_expr<typename _Expr::value_type>, _Expr> > 4583227825Stheraven>::type 4584227825Stheravenexp(const _Expr& __x) 4585227825Stheraven{ 4586227825Stheraven typedef typename _Expr::value_type value_type; 4587227825Stheraven typedef _UnaryOp<__exp_expr<value_type>, _Expr> _Op; 4588227825Stheraven return __val_expr<_Op>(_Op(__exp_expr<value_type>(), __x)); 4589227825Stheraven} 4590227825Stheraven 4591227825Stheraventemplate<class _Expr> 4592227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4593227825Stheraventypename enable_if 4594227825Stheraven< 4595227825Stheraven __is_val_expr<_Expr>::value, 4596227825Stheraven __val_expr<_UnaryOp<__log_expr<typename _Expr::value_type>, _Expr> > 4597227825Stheraven>::type 4598227825Stheravenlog(const _Expr& __x) 4599227825Stheraven{ 4600227825Stheraven typedef typename _Expr::value_type value_type; 4601227825Stheraven typedef _UnaryOp<__log_expr<value_type>, _Expr> _Op; 4602227825Stheraven return __val_expr<_Op>(_Op(__log_expr<value_type>(), __x)); 4603227825Stheraven} 4604227825Stheraven 4605227825Stheraventemplate<class _Expr> 4606227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4607227825Stheraventypename enable_if 4608227825Stheraven< 4609227825Stheraven __is_val_expr<_Expr>::value, 4610227825Stheraven __val_expr<_UnaryOp<__log10_expr<typename _Expr::value_type>, _Expr> > 4611227825Stheraven>::type 4612227825Stheravenlog10(const _Expr& __x) 4613227825Stheraven{ 4614227825Stheraven typedef typename _Expr::value_type value_type; 4615227825Stheraven typedef _UnaryOp<__log10_expr<value_type>, _Expr> _Op; 4616227825Stheraven return __val_expr<_Op>(_Op(__log10_expr<value_type>(), __x)); 4617227825Stheraven} 4618227825Stheraven 4619227825Stheraventemplate<class _Expr1, class _Expr2> 4620227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4621227825Stheraventypename enable_if 4622227825Stheraven< 4623227825Stheraven __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, 4624227825Stheraven __val_expr<_BinaryOp<__pow_expr<typename _Expr1::value_type>, _Expr1, _Expr2> > 4625227825Stheraven>::type 4626227825Stheravenpow(const _Expr1& __x, const _Expr2& __y) 4627227825Stheraven{ 4628227825Stheraven typedef typename _Expr1::value_type value_type; 4629227825Stheraven typedef _BinaryOp<__pow_expr<value_type>, _Expr1, _Expr2> _Op; 4630227825Stheraven return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __x, __y)); 4631227825Stheraven} 4632227825Stheraven 4633227825Stheraventemplate<class _Expr> 4634227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4635227825Stheraventypename enable_if 4636227825Stheraven< 4637227825Stheraven __is_val_expr<_Expr>::value, 4638227825Stheraven __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>, 4639227825Stheraven _Expr, __scalar_expr<typename _Expr::value_type> > > 4640227825Stheraven>::type 4641227825Stheravenpow(const _Expr& __x, const typename _Expr::value_type& __y) 4642227825Stheraven{ 4643227825Stheraven typedef typename _Expr::value_type value_type; 4644227825Stheraven typedef _BinaryOp<__pow_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op; 4645227825Stheraven return __val_expr<_Op>(_Op(__pow_expr<value_type>(), 4646227825Stheraven __x, __scalar_expr<value_type>(__y, __x.size()))); 4647227825Stheraven} 4648227825Stheraven 4649227825Stheraventemplate<class _Expr> 4650227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4651227825Stheraventypename enable_if 4652227825Stheraven< 4653227825Stheraven __is_val_expr<_Expr>::value, 4654227825Stheraven __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>, 4655227825Stheraven __scalar_expr<typename _Expr::value_type>, _Expr> > 4656227825Stheraven>::type 4657227825Stheravenpow(const typename _Expr::value_type& __x, const _Expr& __y) 4658227825Stheraven{ 4659227825Stheraven typedef typename _Expr::value_type value_type; 4660227825Stheraven typedef _BinaryOp<__pow_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op; 4661227825Stheraven return __val_expr<_Op>(_Op(__pow_expr<value_type>(), 4662227825Stheraven __scalar_expr<value_type>(__x, __y.size()), __y)); 4663227825Stheraven} 4664227825Stheraven 4665227825Stheraventemplate<class _Expr> 4666227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4667227825Stheraventypename enable_if 4668227825Stheraven< 4669227825Stheraven __is_val_expr<_Expr>::value, 4670227825Stheraven __val_expr<_UnaryOp<__sin_expr<typename _Expr::value_type>, _Expr> > 4671227825Stheraven>::type 4672227825Stheravensin(const _Expr& __x) 4673227825Stheraven{ 4674227825Stheraven typedef typename _Expr::value_type value_type; 4675227825Stheraven typedef _UnaryOp<__sin_expr<value_type>, _Expr> _Op; 4676227825Stheraven return __val_expr<_Op>(_Op(__sin_expr<value_type>(), __x)); 4677227825Stheraven} 4678227825Stheraven 4679227825Stheraventemplate<class _Expr> 4680227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4681227825Stheraventypename enable_if 4682227825Stheraven< 4683227825Stheraven __is_val_expr<_Expr>::value, 4684227825Stheraven __val_expr<_UnaryOp<__sinh_expr<typename _Expr::value_type>, _Expr> > 4685227825Stheraven>::type 4686227825Stheravensinh(const _Expr& __x) 4687227825Stheraven{ 4688227825Stheraven typedef typename _Expr::value_type value_type; 4689227825Stheraven typedef _UnaryOp<__sinh_expr<value_type>, _Expr> _Op; 4690227825Stheraven return __val_expr<_Op>(_Op(__sinh_expr<value_type>(), __x)); 4691227825Stheraven} 4692227825Stheraven 4693227825Stheraventemplate<class _Expr> 4694227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4695227825Stheraventypename enable_if 4696227825Stheraven< 4697227825Stheraven __is_val_expr<_Expr>::value, 4698227825Stheraven __val_expr<_UnaryOp<__sqrt_expr<typename _Expr::value_type>, _Expr> > 4699227825Stheraven>::type 4700227825Stheravensqrt(const _Expr& __x) 4701227825Stheraven{ 4702227825Stheraven typedef typename _Expr::value_type value_type; 4703227825Stheraven typedef _UnaryOp<__sqrt_expr<value_type>, _Expr> _Op; 4704227825Stheraven return __val_expr<_Op>(_Op(__sqrt_expr<value_type>(), __x)); 4705227825Stheraven} 4706227825Stheraven 4707227825Stheraventemplate<class _Expr> 4708227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4709227825Stheraventypename enable_if 4710227825Stheraven< 4711227825Stheraven __is_val_expr<_Expr>::value, 4712227825Stheraven __val_expr<_UnaryOp<__tan_expr<typename _Expr::value_type>, _Expr> > 4713227825Stheraven>::type 4714227825Stheraventan(const _Expr& __x) 4715227825Stheraven{ 4716227825Stheraven typedef typename _Expr::value_type value_type; 4717227825Stheraven typedef _UnaryOp<__tan_expr<value_type>, _Expr> _Op; 4718227825Stheraven return __val_expr<_Op>(_Op(__tan_expr<value_type>(), __x)); 4719227825Stheraven} 4720227825Stheraven 4721227825Stheraventemplate<class _Expr> 4722227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4723227825Stheraventypename enable_if 4724227825Stheraven< 4725227825Stheraven __is_val_expr<_Expr>::value, 4726227825Stheraven __val_expr<_UnaryOp<__tanh_expr<typename _Expr::value_type>, _Expr> > 4727227825Stheraven>::type 4728227825Stheraventanh(const _Expr& __x) 4729227825Stheraven{ 4730227825Stheraven typedef typename _Expr::value_type value_type; 4731227825Stheraven typedef _UnaryOp<__tanh_expr<value_type>, _Expr> _Op; 4732227825Stheraven return __val_expr<_Op>(_Op(__tanh_expr<value_type>(), __x)); 4733227825Stheraven} 4734227825Stheraven 4735227825Stheraventemplate <class _Tp> 4736227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4737227825Stheraven_Tp* 4738227825Stheravenbegin(valarray<_Tp>& __v) 4739227825Stheraven{ 4740227825Stheraven return __v.__begin_; 4741227825Stheraven} 4742227825Stheraven 4743227825Stheraventemplate <class _Tp> 4744227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4745227825Stheravenconst _Tp* 4746227825Stheravenbegin(const valarray<_Tp>& __v) 4747227825Stheraven{ 4748227825Stheraven return __v.__begin_; 4749227825Stheraven} 4750227825Stheraven 4751227825Stheraventemplate <class _Tp> 4752227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4753227825Stheraven_Tp* 4754227825Stheravenend(valarray<_Tp>& __v) 4755227825Stheraven{ 4756227825Stheraven return __v.__end_; 4757227825Stheraven} 4758227825Stheraven 4759227825Stheraventemplate <class _Tp> 4760227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 4761227825Stheravenconst _Tp* 4762227825Stheravenend(const valarray<_Tp>& __v) 4763227825Stheraven{ 4764227825Stheraven return __v.__end_; 4765227825Stheraven} 4766227825Stheraven 4767227825Stheravenextern template valarray<size_t>::valarray(size_t); 4768227825Stheravenextern template valarray<size_t>::~valarray(); 4769227825Stheravenextern template void valarray<size_t>::resize(size_t, size_t); 4770227825Stheraven 4771227825Stheraven_LIBCPP_END_NAMESPACE_STD 4772227825Stheraven 4773227825Stheraven#endif // _LIBCPP_VALARRAY 4774