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