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