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