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