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