xref: /minix3/external/bsd/libc++/dist/libcxx/include/valarray (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
14684ddb6SLionel Sambuc// -*- C++ -*-
24684ddb6SLionel Sambuc//===-------------------------- valarray ----------------------------------===//
34684ddb6SLionel Sambuc//
44684ddb6SLionel Sambuc//                     The LLVM Compiler Infrastructure
54684ddb6SLionel Sambuc//
64684ddb6SLionel Sambuc// This file is dual licensed under the MIT and the University of Illinois Open
74684ddb6SLionel Sambuc// Source Licenses. See LICENSE.TXT for details.
84684ddb6SLionel Sambuc//
94684ddb6SLionel Sambuc//===----------------------------------------------------------------------===//
104684ddb6SLionel Sambuc
114684ddb6SLionel Sambuc#ifndef _LIBCPP_VALARRAY
124684ddb6SLionel Sambuc#define _LIBCPP_VALARRAY
134684ddb6SLionel Sambuc
144684ddb6SLionel Sambuc/*
154684ddb6SLionel Sambuc    valarray synopsis
164684ddb6SLionel Sambuc
174684ddb6SLionel Sambucnamespace std
184684ddb6SLionel Sambuc{
194684ddb6SLionel Sambuc
204684ddb6SLionel Sambuctemplate<class T>
214684ddb6SLionel Sambucclass valarray
224684ddb6SLionel Sambuc{
234684ddb6SLionel Sambucpublic:
244684ddb6SLionel Sambuc    typedef T value_type;
254684ddb6SLionel Sambuc
264684ddb6SLionel Sambuc    // construct/destroy:
274684ddb6SLionel Sambuc    valarray();
284684ddb6SLionel Sambuc    explicit valarray(size_t n);
294684ddb6SLionel Sambuc    valarray(const value_type& x, size_t n);
304684ddb6SLionel Sambuc    valarray(const value_type* px, size_t n);
314684ddb6SLionel Sambuc    valarray(const valarray& v);
324684ddb6SLionel Sambuc    valarray(valarray&& v) noexcept;
334684ddb6SLionel Sambuc    valarray(const slice_array<value_type>& sa);
344684ddb6SLionel Sambuc    valarray(const gslice_array<value_type>& ga);
354684ddb6SLionel Sambuc    valarray(const mask_array<value_type>& ma);
364684ddb6SLionel Sambuc    valarray(const indirect_array<value_type>& ia);
374684ddb6SLionel Sambuc    valarray(initializer_list<value_type> il);
384684ddb6SLionel Sambuc    ~valarray();
394684ddb6SLionel Sambuc
404684ddb6SLionel Sambuc    // assignment:
414684ddb6SLionel Sambuc    valarray& operator=(const valarray& v);
424684ddb6SLionel Sambuc    valarray& operator=(valarray&& v) noexcept;
434684ddb6SLionel Sambuc    valarray& operator=(initializer_list<value_type> il);
444684ddb6SLionel Sambuc    valarray& operator=(const value_type& x);
454684ddb6SLionel Sambuc    valarray& operator=(const slice_array<value_type>& sa);
464684ddb6SLionel Sambuc    valarray& operator=(const gslice_array<value_type>& ga);
474684ddb6SLionel Sambuc    valarray& operator=(const mask_array<value_type>& ma);
484684ddb6SLionel Sambuc    valarray& operator=(const indirect_array<value_type>& ia);
494684ddb6SLionel Sambuc
504684ddb6SLionel Sambuc    // element access:
514684ddb6SLionel Sambuc    const value_type& operator[](size_t i) const;
524684ddb6SLionel Sambuc    value_type&       operator[](size_t i);
534684ddb6SLionel Sambuc
544684ddb6SLionel Sambuc    // subset operations:
554684ddb6SLionel Sambuc    valarray                   operator[](slice s) const;
564684ddb6SLionel Sambuc    slice_array<value_type>    operator[](slice s);
574684ddb6SLionel Sambuc    valarray                   operator[](const gslice& gs) const;
584684ddb6SLionel Sambuc    gslice_array<value_type>   operator[](const gslice& gs);
594684ddb6SLionel Sambuc    valarray                   operator[](const valarray<bool>& vb) const;
604684ddb6SLionel Sambuc    mask_array<value_type>     operator[](const valarray<bool>& vb);
614684ddb6SLionel Sambuc    valarray                   operator[](const valarray<size_t>& vs) const;
624684ddb6SLionel Sambuc    indirect_array<value_type> operator[](const valarray<size_t>& vs);
634684ddb6SLionel Sambuc
644684ddb6SLionel Sambuc    // unary operators:
654684ddb6SLionel Sambuc    valarray       operator+() const;
664684ddb6SLionel Sambuc    valarray       operator-() const;
674684ddb6SLionel Sambuc    valarray       operator~() const;
684684ddb6SLionel Sambuc    valarray<bool> operator!() const;
694684ddb6SLionel Sambuc
704684ddb6SLionel Sambuc    // computed assignment:
714684ddb6SLionel Sambuc    valarray& operator*= (const value_type& x);
724684ddb6SLionel Sambuc    valarray& operator/= (const value_type& x);
734684ddb6SLionel Sambuc    valarray& operator%= (const value_type& x);
744684ddb6SLionel Sambuc    valarray& operator+= (const value_type& x);
754684ddb6SLionel Sambuc    valarray& operator-= (const value_type& x);
764684ddb6SLionel Sambuc    valarray& operator^= (const value_type& x);
774684ddb6SLionel Sambuc    valarray& operator&= (const value_type& x);
784684ddb6SLionel Sambuc    valarray& operator|= (const value_type& x);
794684ddb6SLionel Sambuc    valarray& operator<<=(const value_type& x);
804684ddb6SLionel Sambuc    valarray& operator>>=(const value_type& x);
814684ddb6SLionel Sambuc
824684ddb6SLionel Sambuc    valarray& operator*= (const valarray& v);
834684ddb6SLionel Sambuc    valarray& operator/= (const valarray& v);
844684ddb6SLionel Sambuc    valarray& operator%= (const valarray& v);
854684ddb6SLionel Sambuc    valarray& operator+= (const valarray& v);
864684ddb6SLionel Sambuc    valarray& operator-= (const valarray& v);
874684ddb6SLionel Sambuc    valarray& operator^= (const valarray& v);
884684ddb6SLionel Sambuc    valarray& operator|= (const valarray& v);
894684ddb6SLionel Sambuc    valarray& operator&= (const valarray& v);
904684ddb6SLionel Sambuc    valarray& operator<<=(const valarray& v);
914684ddb6SLionel Sambuc    valarray& operator>>=(const valarray& v);
924684ddb6SLionel Sambuc
934684ddb6SLionel Sambuc    // member functions:
944684ddb6SLionel Sambuc    void swap(valarray& v) noexcept;
954684ddb6SLionel Sambuc
964684ddb6SLionel Sambuc    size_t size() const;
974684ddb6SLionel Sambuc
984684ddb6SLionel Sambuc    value_type sum() const;
994684ddb6SLionel Sambuc    value_type min() const;
1004684ddb6SLionel Sambuc    value_type max() const;
1014684ddb6SLionel Sambuc
1024684ddb6SLionel Sambuc    valarray shift (int i) const;
1034684ddb6SLionel Sambuc    valarray cshift(int i) const;
1044684ddb6SLionel Sambuc    valarray apply(value_type f(value_type)) const;
1054684ddb6SLionel Sambuc    valarray apply(value_type f(const value_type&)) const;
1064684ddb6SLionel Sambuc    void resize(size_t n, value_type x = value_type());
1074684ddb6SLionel Sambuc};
1084684ddb6SLionel Sambuc
1094684ddb6SLionel Sambucclass slice
1104684ddb6SLionel Sambuc{
1114684ddb6SLionel Sambucpublic:
1124684ddb6SLionel Sambuc    slice();
1134684ddb6SLionel Sambuc    slice(size_t start, size_t size, size_t stride);
1144684ddb6SLionel Sambuc
1154684ddb6SLionel Sambuc    size_t start()  const;
1164684ddb6SLionel Sambuc    size_t size()   const;
1174684ddb6SLionel Sambuc    size_t stride() const;
1184684ddb6SLionel Sambuc};
1194684ddb6SLionel Sambuc
1204684ddb6SLionel Sambuctemplate <class T>
1214684ddb6SLionel Sambucclass slice_array
1224684ddb6SLionel Sambuc{
1234684ddb6SLionel Sambucpublic:
1244684ddb6SLionel Sambuc    typedef T value_type;
1254684ddb6SLionel Sambuc
1264684ddb6SLionel Sambuc    const slice_array& operator=(const slice_array& sa) const;
1274684ddb6SLionel Sambuc    void operator=  (const valarray<value_type>& v) const;
1284684ddb6SLionel Sambuc    void operator*= (const valarray<value_type>& v) const;
1294684ddb6SLionel Sambuc    void operator/= (const valarray<value_type>& v) const;
1304684ddb6SLionel Sambuc    void operator%= (const valarray<value_type>& v) const;
1314684ddb6SLionel Sambuc    void operator+= (const valarray<value_type>& v) const;
1324684ddb6SLionel Sambuc    void operator-= (const valarray<value_type>& v) const;
1334684ddb6SLionel Sambuc    void operator^= (const valarray<value_type>& v) const;
1344684ddb6SLionel Sambuc    void operator&= (const valarray<value_type>& v) const;
1354684ddb6SLionel Sambuc    void operator|= (const valarray<value_type>& v) const;
1364684ddb6SLionel Sambuc    void operator<<=(const valarray<value_type>& v) const;
1374684ddb6SLionel Sambuc    void operator>>=(const valarray<value_type>& v) const;
1384684ddb6SLionel Sambuc
1394684ddb6SLionel Sambuc    void operator=(const value_type& x) const;
1404684ddb6SLionel Sambuc
1414684ddb6SLionel Sambuc    slice_array() = delete;
1424684ddb6SLionel Sambuc};
1434684ddb6SLionel Sambuc
1444684ddb6SLionel Sambucclass gslice
1454684ddb6SLionel Sambuc{
1464684ddb6SLionel Sambucpublic:
1474684ddb6SLionel Sambuc    gslice();
1484684ddb6SLionel Sambuc    gslice(size_t start, const valarray<size_t>& size,
1494684ddb6SLionel Sambuc                         const valarray<size_t>& stride);
1504684ddb6SLionel Sambuc
1514684ddb6SLionel Sambuc    size_t           start()  const;
1524684ddb6SLionel Sambuc    valarray<size_t> size()   const;
1534684ddb6SLionel Sambuc    valarray<size_t> stride() const;
1544684ddb6SLionel Sambuc};
1554684ddb6SLionel Sambuc
1564684ddb6SLionel Sambuctemplate <class T>
1574684ddb6SLionel Sambucclass gslice_array
1584684ddb6SLionel Sambuc{
1594684ddb6SLionel Sambucpublic:
1604684ddb6SLionel Sambuc    typedef T value_type;
1614684ddb6SLionel Sambuc
1624684ddb6SLionel Sambuc    void operator=  (const valarray<value_type>& v) const;
1634684ddb6SLionel Sambuc    void operator*= (const valarray<value_type>& v) const;
1644684ddb6SLionel Sambuc    void operator/= (const valarray<value_type>& v) const;
1654684ddb6SLionel Sambuc    void operator%= (const valarray<value_type>& v) const;
1664684ddb6SLionel Sambuc    void operator+= (const valarray<value_type>& v) const;
1674684ddb6SLionel Sambuc    void operator-= (const valarray<value_type>& v) const;
1684684ddb6SLionel Sambuc    void operator^= (const valarray<value_type>& v) const;
1694684ddb6SLionel Sambuc    void operator&= (const valarray<value_type>& v) const;
1704684ddb6SLionel Sambuc    void operator|= (const valarray<value_type>& v) const;
1714684ddb6SLionel Sambuc    void operator<<=(const valarray<value_type>& v) const;
1724684ddb6SLionel Sambuc    void operator>>=(const valarray<value_type>& v) const;
1734684ddb6SLionel Sambuc
1744684ddb6SLionel Sambuc    gslice_array(const gslice_array& ga);
1754684ddb6SLionel Sambuc    ~gslice_array();
1764684ddb6SLionel Sambuc    const gslice_array& operator=(const gslice_array& ga) const;
1774684ddb6SLionel Sambuc    void operator=(const value_type& x) const;
1784684ddb6SLionel Sambuc
1794684ddb6SLionel Sambuc    gslice_array() = delete;
1804684ddb6SLionel Sambuc};
1814684ddb6SLionel Sambuc
1824684ddb6SLionel Sambuctemplate <class T>
1834684ddb6SLionel Sambucclass mask_array
1844684ddb6SLionel Sambuc{
1854684ddb6SLionel Sambucpublic:
1864684ddb6SLionel Sambuc    typedef T value_type;
1874684ddb6SLionel Sambuc
1884684ddb6SLionel Sambuc    void operator=  (const valarray<value_type>& v) const;
1894684ddb6SLionel Sambuc    void operator*= (const valarray<value_type>& v) const;
1904684ddb6SLionel Sambuc    void operator/= (const valarray<value_type>& v) const;
1914684ddb6SLionel Sambuc    void operator%= (const valarray<value_type>& v) const;
1924684ddb6SLionel Sambuc    void operator+= (const valarray<value_type>& v) const;
1934684ddb6SLionel Sambuc    void operator-= (const valarray<value_type>& v) const;
1944684ddb6SLionel Sambuc    void operator^= (const valarray<value_type>& v) const;
1954684ddb6SLionel Sambuc    void operator&= (const valarray<value_type>& v) const;
1964684ddb6SLionel Sambuc    void operator|= (const valarray<value_type>& v) const;
1974684ddb6SLionel Sambuc    void operator<<=(const valarray<value_type>& v) const;
1984684ddb6SLionel Sambuc    void operator>>=(const valarray<value_type>& v) const;
1994684ddb6SLionel Sambuc
2004684ddb6SLionel Sambuc    mask_array(const mask_array& ma);
2014684ddb6SLionel Sambuc    ~mask_array();
2024684ddb6SLionel Sambuc    const mask_array& operator=(const mask_array& ma) const;
2034684ddb6SLionel Sambuc    void operator=(const value_type& x) const;
2044684ddb6SLionel Sambuc
2054684ddb6SLionel Sambuc    mask_array() = delete;
2064684ddb6SLionel Sambuc};
2074684ddb6SLionel Sambuc
2084684ddb6SLionel Sambuctemplate <class T>
2094684ddb6SLionel Sambucclass indirect_array
2104684ddb6SLionel Sambuc{
2114684ddb6SLionel Sambucpublic:
2124684ddb6SLionel Sambuc    typedef T value_type;
2134684ddb6SLionel Sambuc
2144684ddb6SLionel Sambuc    void operator=  (const valarray<value_type>& v) const;
2154684ddb6SLionel Sambuc    void operator*= (const valarray<value_type>& v) const;
2164684ddb6SLionel Sambuc    void operator/= (const valarray<value_type>& v) const;
2174684ddb6SLionel Sambuc    void operator%= (const valarray<value_type>& v) const;
2184684ddb6SLionel Sambuc    void operator+= (const valarray<value_type>& v) const;
2194684ddb6SLionel Sambuc    void operator-= (const valarray<value_type>& v) const;
2204684ddb6SLionel Sambuc    void operator^= (const valarray<value_type>& v) const;
2214684ddb6SLionel Sambuc    void operator&= (const valarray<value_type>& v) const;
2224684ddb6SLionel Sambuc    void operator|= (const valarray<value_type>& v) const;
2234684ddb6SLionel Sambuc    void operator<<=(const valarray<value_type>& v) const;
2244684ddb6SLionel Sambuc    void operator>>=(const valarray<value_type>& v) const;
2254684ddb6SLionel Sambuc
2264684ddb6SLionel Sambuc    indirect_array(const indirect_array& ia);
2274684ddb6SLionel Sambuc    ~indirect_array();
2284684ddb6SLionel Sambuc    const indirect_array& operator=(const indirect_array& ia) const;
2294684ddb6SLionel Sambuc    void operator=(const value_type& x) const;
2304684ddb6SLionel Sambuc
2314684ddb6SLionel Sambuc    indirect_array() = delete;
2324684ddb6SLionel Sambuc};
2334684ddb6SLionel Sambuc
2344684ddb6SLionel Sambuctemplate<class T> void swap(valarray<T>& x, valarray<T>& y) noexcept;
2354684ddb6SLionel Sambuc
2364684ddb6SLionel Sambuctemplate<class T> valarray<T> operator* (const valarray<T>& x, const valarray<T>& y);
2374684ddb6SLionel Sambuctemplate<class T> valarray<T> operator* (const valarray<T>& x, const T& y);
2384684ddb6SLionel Sambuctemplate<class T> valarray<T> operator* (const T& x, const valarray<T>& y);
2394684ddb6SLionel Sambuc
2404684ddb6SLionel Sambuctemplate<class T> valarray<T> operator/ (const valarray<T>& x, const valarray<T>& y);
2414684ddb6SLionel Sambuctemplate<class T> valarray<T> operator/ (const valarray<T>& x, const T& y);
2424684ddb6SLionel Sambuctemplate<class T> valarray<T> operator/ (const T& x, const valarray<T>& y);
2434684ddb6SLionel Sambuc
2444684ddb6SLionel Sambuctemplate<class T> valarray<T> operator% (const valarray<T>& x, const valarray<T>& y);
2454684ddb6SLionel Sambuctemplate<class T> valarray<T> operator% (const valarray<T>& x, const T& y);
2464684ddb6SLionel Sambuctemplate<class T> valarray<T> operator% (const T& x, const valarray<T>& y);
2474684ddb6SLionel Sambuc
2484684ddb6SLionel Sambuctemplate<class T> valarray<T> operator+ (const valarray<T>& x, const valarray<T>& y);
2494684ddb6SLionel Sambuctemplate<class T> valarray<T> operator+ (const valarray<T>& x, const T& y);
2504684ddb6SLionel Sambuctemplate<class T> valarray<T> operator+ (const T& x, const valarray<T>& y);
2514684ddb6SLionel Sambuc
2524684ddb6SLionel Sambuctemplate<class T> valarray<T> operator- (const valarray<T>& x, const valarray<T>& y);
2534684ddb6SLionel Sambuctemplate<class T> valarray<T> operator- (const valarray<T>& x, const T& y);
2544684ddb6SLionel Sambuctemplate<class T> valarray<T> operator- (const T& x, const valarray<T>& y);
2554684ddb6SLionel Sambuc
2564684ddb6SLionel Sambuctemplate<class T> valarray<T> operator^ (const valarray<T>& x, const valarray<T>& y);
2574684ddb6SLionel Sambuctemplate<class T> valarray<T> operator^ (const valarray<T>& x, const T& y);
2584684ddb6SLionel Sambuctemplate<class T> valarray<T> operator^ (const T& x, const valarray<T>& y);
2594684ddb6SLionel Sambuc
2604684ddb6SLionel Sambuctemplate<class T> valarray<T> operator& (const valarray<T>& x, const valarray<T>& y);
2614684ddb6SLionel Sambuctemplate<class T> valarray<T> operator& (const valarray<T>& x, const T& y);
2624684ddb6SLionel Sambuctemplate<class T> valarray<T> operator& (const T& x, const valarray<T>& y);
2634684ddb6SLionel Sambuc
2644684ddb6SLionel Sambuctemplate<class T> valarray<T> operator| (const valarray<T>& x, const valarray<T>& y);
2654684ddb6SLionel Sambuctemplate<class T> valarray<T> operator| (const valarray<T>& x, const T& y);
2664684ddb6SLionel Sambuctemplate<class T> valarray<T> operator| (const T& x, const valarray<T>& y);
2674684ddb6SLionel Sambuc
2684684ddb6SLionel Sambuctemplate<class T> valarray<T> operator<<(const valarray<T>& x, const valarray<T>& y);
2694684ddb6SLionel Sambuctemplate<class T> valarray<T> operator<<(const valarray<T>& x, const T& y);
2704684ddb6SLionel Sambuctemplate<class T> valarray<T> operator<<(const T& x, const valarray<T>& y);
2714684ddb6SLionel Sambuc
2724684ddb6SLionel Sambuctemplate<class T> valarray<T> operator>>(const valarray<T>& x, const valarray<T>& y);
2734684ddb6SLionel Sambuctemplate<class T> valarray<T> operator>>(const valarray<T>& x, const T& y);
2744684ddb6SLionel Sambuctemplate<class T> valarray<T> operator>>(const T& x, const valarray<T>& y);
2754684ddb6SLionel Sambuc
2764684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator&&(const valarray<T>& x, const valarray<T>& y);
2774684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator&&(const valarray<T>& x, const T& y);
2784684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator&&(const T& x, const valarray<T>& y);
2794684ddb6SLionel Sambuc
2804684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator||(const valarray<T>& x, const valarray<T>& y);
2814684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator||(const valarray<T>& x, const T& y);
2824684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator||(const T& x, const valarray<T>& y);
2834684ddb6SLionel Sambuc
2844684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator==(const valarray<T>& x, const valarray<T>& y);
2854684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator==(const valarray<T>& x, const T& y);
2864684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator==(const T& x, const valarray<T>& y);
2874684ddb6SLionel Sambuc
2884684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator!=(const valarray<T>& x, const valarray<T>& y);
2894684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator!=(const valarray<T>& x, const T& y);
2904684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator!=(const T& x, const valarray<T>& y);
2914684ddb6SLionel Sambuc
2924684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator< (const valarray<T>& x, const valarray<T>& y);
2934684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator< (const valarray<T>& x, const T& y);
2944684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator< (const T& x, const valarray<T>& y);
2954684ddb6SLionel Sambuc
2964684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator> (const valarray<T>& x, const valarray<T>& y);
2974684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator> (const valarray<T>& x, const T& y);
2984684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator> (const T& x, const valarray<T>& y);
2994684ddb6SLionel Sambuc
3004684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator<=(const valarray<T>& x, const valarray<T>& y);
3014684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator<=(const valarray<T>& x, const T& y);
3024684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator<=(const T& x, const valarray<T>& y);
3034684ddb6SLionel Sambuc
3044684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator>=(const valarray<T>& x, const valarray<T>& y);
3054684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator>=(const valarray<T>& x, const T& y);
3064684ddb6SLionel Sambuctemplate<class T> valarray<bool> operator>=(const T& x, const valarray<T>& y);
3074684ddb6SLionel Sambuc
3084684ddb6SLionel Sambuctemplate<class T> valarray<T> abs (const valarray<T>& x);
3094684ddb6SLionel Sambuctemplate<class T> valarray<T> acos (const valarray<T>& x);
3104684ddb6SLionel Sambuctemplate<class T> valarray<T> asin (const valarray<T>& x);
3114684ddb6SLionel Sambuctemplate<class T> valarray<T> atan (const valarray<T>& x);
3124684ddb6SLionel Sambuc
3134684ddb6SLionel Sambuctemplate<class T> valarray<T> atan2(const valarray<T>& x, const valarray<T>& y);
3144684ddb6SLionel Sambuctemplate<class T> valarray<T> atan2(const valarray<T>& x, const T& y);
3154684ddb6SLionel Sambuctemplate<class T> valarray<T> atan2(const T& x, const valarray<T>& y);
3164684ddb6SLionel Sambuc
3174684ddb6SLionel Sambuctemplate<class T> valarray<T> cos (const valarray<T>& x);
3184684ddb6SLionel Sambuctemplate<class T> valarray<T> cosh (const valarray<T>& x);
3194684ddb6SLionel Sambuctemplate<class T> valarray<T> exp (const valarray<T>& x);
3204684ddb6SLionel Sambuctemplate<class T> valarray<T> log (const valarray<T>& x);
3214684ddb6SLionel Sambuctemplate<class T> valarray<T> log10(const valarray<T>& x);
3224684ddb6SLionel Sambuc
3234684ddb6SLionel Sambuctemplate<class T> valarray<T> pow(const valarray<T>& x, const valarray<T>& y);
3244684ddb6SLionel Sambuctemplate<class T> valarray<T> pow(const valarray<T>& x, const T& y);
3254684ddb6SLionel Sambuctemplate<class T> valarray<T> pow(const T& x, const valarray<T>& y);
3264684ddb6SLionel Sambuc
3274684ddb6SLionel Sambuctemplate<class T> valarray<T> sin (const valarray<T>& x);
3284684ddb6SLionel Sambuctemplate<class T> valarray<T> sinh (const valarray<T>& x);
3294684ddb6SLionel Sambuctemplate<class T> valarray<T> sqrt (const valarray<T>& x);
3304684ddb6SLionel Sambuctemplate<class T> valarray<T> tan (const valarray<T>& x);
3314684ddb6SLionel Sambuctemplate<class T> valarray<T> tanh (const valarray<T>& x);
3324684ddb6SLionel Sambuc
3334684ddb6SLionel Sambuctemplate <class T> unspecified1 begin(valarray<T>& v);
3344684ddb6SLionel Sambuctemplate <class T> unspecified2 begin(const valarray<T>& v);
3354684ddb6SLionel Sambuctemplate <class T> unspecified1 end(valarray<T>& v);
3364684ddb6SLionel Sambuctemplate <class T> unspecified2 end(const valarray<T>& v);
3374684ddb6SLionel Sambuc
3384684ddb6SLionel Sambuc}  // std
3394684ddb6SLionel Sambuc
3404684ddb6SLionel Sambuc*/
3414684ddb6SLionel Sambuc
3424684ddb6SLionel Sambuc#include <__config>
3434684ddb6SLionel Sambuc#include <cstddef>
3444684ddb6SLionel Sambuc#include <cmath>
3454684ddb6SLionel Sambuc#include <initializer_list>
3464684ddb6SLionel Sambuc#include <algorithm>
3474684ddb6SLionel Sambuc#include <functional>
348*0a6a1f1dSLionel Sambuc#include <new>
3494684ddb6SLionel Sambuc
3504684ddb6SLionel Sambuc#include <__undef_min_max>
351*0a6a1f1dSLionel Sambuc#include <__undef___deallocate>
3524684ddb6SLionel Sambuc
3534684ddb6SLionel Sambuc#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
3544684ddb6SLionel Sambuc#pragma GCC system_header
3554684ddb6SLionel Sambuc#endif
3564684ddb6SLionel Sambuc
3574684ddb6SLionel Sambuc_LIBCPP_BEGIN_NAMESPACE_STD
3584684ddb6SLionel Sambuc
3594684ddb6SLionel Sambuctemplate<class _Tp> class _LIBCPP_TYPE_VIS_ONLY valarray;
3604684ddb6SLionel Sambuc
3614684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY slice
3624684ddb6SLionel Sambuc{
3634684ddb6SLionel Sambuc    size_t __start_;
3644684ddb6SLionel Sambuc    size_t __size_;
3654684ddb6SLionel Sambuc    size_t __stride_;
3664684ddb6SLionel Sambucpublic:
3674684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
3684684ddb6SLionel Sambuc    slice()
3694684ddb6SLionel Sambuc        : __start_(0),
3704684ddb6SLionel Sambuc          __size_(0),
3714684ddb6SLionel Sambuc          __stride_(0)
3724684ddb6SLionel Sambuc          {}
3734684ddb6SLionel Sambuc
3744684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
3754684ddb6SLionel Sambuc    slice(size_t __start, size_t __size, size_t __stride)
3764684ddb6SLionel Sambuc        : __start_(__start),
3774684ddb6SLionel Sambuc          __size_(__size),
3784684ddb6SLionel Sambuc          __stride_(__stride)
3794684ddb6SLionel Sambuc          {}
3804684ddb6SLionel Sambuc
3814684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY size_t start()  const {return __start_;}
3824684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY size_t size()   const {return __size_;}
3834684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY size_t stride() const {return __stride_;}
3844684ddb6SLionel Sambuc};
3854684ddb6SLionel Sambuc
3864684ddb6SLionel Sambuctemplate <class _Tp> class _LIBCPP_TYPE_VIS_ONLY slice_array;
3874684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS gslice;
3884684ddb6SLionel Sambuctemplate <class _Tp> class _LIBCPP_TYPE_VIS_ONLY gslice_array;
3894684ddb6SLionel Sambuctemplate <class _Tp> class _LIBCPP_TYPE_VIS_ONLY mask_array;
3904684ddb6SLionel Sambuctemplate <class _Tp> class _LIBCPP_TYPE_VIS_ONLY indirect_array;
3914684ddb6SLionel Sambuc
3924684ddb6SLionel Sambuctemplate <class _Tp>
3934684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY
3944684ddb6SLionel Sambuc_Tp*
3954684ddb6SLionel Sambucbegin(valarray<_Tp>& __v);
3964684ddb6SLionel Sambuc
3974684ddb6SLionel Sambuctemplate <class _Tp>
3984684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY
3994684ddb6SLionel Sambucconst _Tp*
4004684ddb6SLionel Sambucbegin(const valarray<_Tp>& __v);
4014684ddb6SLionel Sambuc
4024684ddb6SLionel Sambuctemplate <class _Tp>
4034684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY
4044684ddb6SLionel Sambuc_Tp*
4054684ddb6SLionel Sambucend(valarray<_Tp>& __v);
4064684ddb6SLionel Sambuc
4074684ddb6SLionel Sambuctemplate <class _Tp>
4084684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY
4094684ddb6SLionel Sambucconst _Tp*
4104684ddb6SLionel Sambucend(const valarray<_Tp>& __v);
4114684ddb6SLionel Sambuc
4124684ddb6SLionel Sambuctemplate <class _Op, class _A0>
4134684ddb6SLionel Sambucstruct _UnaryOp
4144684ddb6SLionel Sambuc{
4154684ddb6SLionel Sambuc    typedef typename _Op::result_type result_type;
4164684ddb6SLionel Sambuc    typedef typename _A0::value_type value_type;
4174684ddb6SLionel Sambuc
4184684ddb6SLionel Sambuc    _Op __op_;
4194684ddb6SLionel Sambuc    _A0 __a0_;
4204684ddb6SLionel Sambuc
4214684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
4224684ddb6SLionel Sambuc    _UnaryOp(const _Op& __op, const _A0& __a0) : __op_(__op), __a0_(__a0) {}
4234684ddb6SLionel Sambuc
4244684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
4254684ddb6SLionel Sambuc    result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
4264684ddb6SLionel Sambuc
4274684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
4284684ddb6SLionel Sambuc    size_t size() const {return __a0_.size();}
4294684ddb6SLionel Sambuc};
4304684ddb6SLionel Sambuc
4314684ddb6SLionel Sambuctemplate <class _Op, class _A0, class _A1>
4324684ddb6SLionel Sambucstruct _BinaryOp
4334684ddb6SLionel Sambuc{
4344684ddb6SLionel Sambuc    typedef typename _Op::result_type result_type;
4354684ddb6SLionel Sambuc    typedef typename _A0::value_type value_type;
4364684ddb6SLionel Sambuc
4374684ddb6SLionel Sambuc    _Op __op_;
4384684ddb6SLionel Sambuc    _A0 __a0_;
4394684ddb6SLionel Sambuc    _A1 __a1_;
4404684ddb6SLionel Sambuc
4414684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
4424684ddb6SLionel Sambuc    _BinaryOp(const _Op& __op, const _A0& __a0, const _A1& __a1)
4434684ddb6SLionel Sambuc        : __op_(__op), __a0_(__a0), __a1_(__a1) {}
4444684ddb6SLionel Sambuc
4454684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
4464684ddb6SLionel Sambuc    value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
4474684ddb6SLionel Sambuc
4484684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
4494684ddb6SLionel Sambuc    size_t size() const {return __a0_.size();}
4504684ddb6SLionel Sambuc};
4514684ddb6SLionel Sambuc
4524684ddb6SLionel Sambuctemplate <class _Tp>
4534684ddb6SLionel Sambucclass __scalar_expr
4544684ddb6SLionel Sambuc{
4554684ddb6SLionel Sambucpublic:
4564684ddb6SLionel Sambuc    typedef _Tp        value_type;
4574684ddb6SLionel Sambuc    typedef const _Tp& result_type;
4584684ddb6SLionel Sambucprivate:
4594684ddb6SLionel Sambuc    const value_type& __t_;
4604684ddb6SLionel Sambuc    size_t __s_;
4614684ddb6SLionel Sambucpublic:
4624684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
4634684ddb6SLionel Sambuc    explicit __scalar_expr(const value_type& __t, size_t __s) : __t_(__t), __s_(__s) {}
4644684ddb6SLionel Sambuc
4654684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
4664684ddb6SLionel Sambuc    result_type operator[](size_t) const {return __t_;}
4674684ddb6SLionel Sambuc
4684684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
4694684ddb6SLionel Sambuc    size_t size() const {return __s_;}
4704684ddb6SLionel Sambuc};
4714684ddb6SLionel Sambuc
4724684ddb6SLionel Sambuctemplate <class _Tp>
4734684ddb6SLionel Sambucstruct __unary_plus : unary_function<_Tp, _Tp>
4744684ddb6SLionel Sambuc{
4754684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
4764684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x) const
4774684ddb6SLionel Sambuc        {return +__x;}
4784684ddb6SLionel Sambuc};
4794684ddb6SLionel Sambuc
4804684ddb6SLionel Sambuctemplate <class _Tp>
4814684ddb6SLionel Sambucstruct __bit_not  : unary_function<_Tp, _Tp>
4824684ddb6SLionel Sambuc{
4834684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
4844684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x) const
4854684ddb6SLionel Sambuc        {return ~__x;}
4864684ddb6SLionel Sambuc};
4874684ddb6SLionel Sambuc
4884684ddb6SLionel Sambuctemplate <class _Tp>
4894684ddb6SLionel Sambucstruct __bit_shift_left : binary_function<_Tp, _Tp, _Tp>
4904684ddb6SLionel Sambuc{
4914684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
4924684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x, const _Tp& __y) const
4934684ddb6SLionel Sambuc        {return __x << __y;}
4944684ddb6SLionel Sambuc};
4954684ddb6SLionel Sambuc
4964684ddb6SLionel Sambuctemplate <class _Tp>
4974684ddb6SLionel Sambucstruct __bit_shift_right : binary_function<_Tp, _Tp, _Tp>
4984684ddb6SLionel Sambuc{
4994684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
5004684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x, const _Tp& __y) const
5014684ddb6SLionel Sambuc        {return __x >> __y;}
5024684ddb6SLionel Sambuc};
5034684ddb6SLionel Sambuc
5044684ddb6SLionel Sambuctemplate <class _Tp, class _Fp>
5054684ddb6SLionel Sambucstruct __apply_expr   : unary_function<_Tp, _Tp>
5064684ddb6SLionel Sambuc{
5074684ddb6SLionel Sambucprivate:
5084684ddb6SLionel Sambuc    _Fp __f_;
5094684ddb6SLionel Sambucpublic:
5104684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
5114684ddb6SLionel Sambuc    explicit __apply_expr(_Fp __f) : __f_(__f) {}
5124684ddb6SLionel Sambuc
5134684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
5144684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x) const
5154684ddb6SLionel Sambuc        {return __f_(__x);}
5164684ddb6SLionel Sambuc};
5174684ddb6SLionel Sambuc
5184684ddb6SLionel Sambuctemplate <class _Tp>
5194684ddb6SLionel Sambucstruct __abs_expr : unary_function<_Tp, _Tp>
5204684ddb6SLionel Sambuc{
5214684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
5224684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x) const
5234684ddb6SLionel Sambuc        {return abs(__x);}
5244684ddb6SLionel Sambuc};
5254684ddb6SLionel Sambuc
5264684ddb6SLionel Sambuctemplate <class _Tp>
5274684ddb6SLionel Sambucstruct __acos_expr : unary_function<_Tp, _Tp>
5284684ddb6SLionel Sambuc{
5294684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
5304684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x) const
5314684ddb6SLionel Sambuc        {return acos(__x);}
5324684ddb6SLionel Sambuc};
5334684ddb6SLionel Sambuc
5344684ddb6SLionel Sambuctemplate <class _Tp>
5354684ddb6SLionel Sambucstruct __asin_expr : unary_function<_Tp, _Tp>
5364684ddb6SLionel Sambuc{
5374684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
5384684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x) const
5394684ddb6SLionel Sambuc        {return asin(__x);}
5404684ddb6SLionel Sambuc};
5414684ddb6SLionel Sambuc
5424684ddb6SLionel Sambuctemplate <class _Tp>
5434684ddb6SLionel Sambucstruct __atan_expr : unary_function<_Tp, _Tp>
5444684ddb6SLionel Sambuc{
5454684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
5464684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x) const
5474684ddb6SLionel Sambuc        {return atan(__x);}
5484684ddb6SLionel Sambuc};
5494684ddb6SLionel Sambuc
5504684ddb6SLionel Sambuctemplate <class _Tp>
5514684ddb6SLionel Sambucstruct __atan2_expr : binary_function<_Tp, _Tp, _Tp>
5524684ddb6SLionel Sambuc{
5534684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
5544684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x, const _Tp& __y) const
5554684ddb6SLionel Sambuc        {return atan2(__x, __y);}
5564684ddb6SLionel Sambuc};
5574684ddb6SLionel Sambuc
5584684ddb6SLionel Sambuctemplate <class _Tp>
5594684ddb6SLionel Sambucstruct __cos_expr : unary_function<_Tp, _Tp>
5604684ddb6SLionel Sambuc{
5614684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
5624684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x) const
5634684ddb6SLionel Sambuc        {return cos(__x);}
5644684ddb6SLionel Sambuc};
5654684ddb6SLionel Sambuc
5664684ddb6SLionel Sambuctemplate <class _Tp>
5674684ddb6SLionel Sambucstruct __cosh_expr : unary_function<_Tp, _Tp>
5684684ddb6SLionel Sambuc{
5694684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
5704684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x) const
5714684ddb6SLionel Sambuc        {return cosh(__x);}
5724684ddb6SLionel Sambuc};
5734684ddb6SLionel Sambuc
5744684ddb6SLionel Sambuctemplate <class _Tp>
5754684ddb6SLionel Sambucstruct __exp_expr : unary_function<_Tp, _Tp>
5764684ddb6SLionel Sambuc{
5774684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
5784684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x) const
5794684ddb6SLionel Sambuc        {return exp(__x);}
5804684ddb6SLionel Sambuc};
5814684ddb6SLionel Sambuc
5824684ddb6SLionel Sambuctemplate <class _Tp>
5834684ddb6SLionel Sambucstruct __log_expr : unary_function<_Tp, _Tp>
5844684ddb6SLionel Sambuc{
5854684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
5864684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x) const
5874684ddb6SLionel Sambuc        {return log(__x);}
5884684ddb6SLionel Sambuc};
5894684ddb6SLionel Sambuc
5904684ddb6SLionel Sambuctemplate <class _Tp>
5914684ddb6SLionel Sambucstruct __log10_expr : unary_function<_Tp, _Tp>
5924684ddb6SLionel Sambuc{
5934684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
5944684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x) const
5954684ddb6SLionel Sambuc        {return log10(__x);}
5964684ddb6SLionel Sambuc};
5974684ddb6SLionel Sambuc
5984684ddb6SLionel Sambuctemplate <class _Tp>
5994684ddb6SLionel Sambucstruct __pow_expr : binary_function<_Tp, _Tp, _Tp>
6004684ddb6SLionel Sambuc{
6014684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6024684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x, const _Tp& __y) const
6034684ddb6SLionel Sambuc        {return pow(__x, __y);}
6044684ddb6SLionel Sambuc};
6054684ddb6SLionel Sambuc
6064684ddb6SLionel Sambuctemplate <class _Tp>
6074684ddb6SLionel Sambucstruct __sin_expr : unary_function<_Tp, _Tp>
6084684ddb6SLionel Sambuc{
6094684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6104684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x) const
6114684ddb6SLionel Sambuc        {return sin(__x);}
6124684ddb6SLionel Sambuc};
6134684ddb6SLionel Sambuc
6144684ddb6SLionel Sambuctemplate <class _Tp>
6154684ddb6SLionel Sambucstruct __sinh_expr : unary_function<_Tp, _Tp>
6164684ddb6SLionel Sambuc{
6174684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6184684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x) const
6194684ddb6SLionel Sambuc        {return sinh(__x);}
6204684ddb6SLionel Sambuc};
6214684ddb6SLionel Sambuc
6224684ddb6SLionel Sambuctemplate <class _Tp>
6234684ddb6SLionel Sambucstruct __sqrt_expr : unary_function<_Tp, _Tp>
6244684ddb6SLionel Sambuc{
6254684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6264684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x) const
6274684ddb6SLionel Sambuc        {return sqrt(__x);}
6284684ddb6SLionel Sambuc};
6294684ddb6SLionel Sambuc
6304684ddb6SLionel Sambuctemplate <class _Tp>
6314684ddb6SLionel Sambucstruct __tan_expr : unary_function<_Tp, _Tp>
6324684ddb6SLionel Sambuc{
6334684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6344684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x) const
6354684ddb6SLionel Sambuc        {return tan(__x);}
6364684ddb6SLionel Sambuc};
6374684ddb6SLionel Sambuc
6384684ddb6SLionel Sambuctemplate <class _Tp>
6394684ddb6SLionel Sambucstruct __tanh_expr : unary_function<_Tp, _Tp>
6404684ddb6SLionel Sambuc{
6414684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6424684ddb6SLionel Sambuc    _Tp operator()(const _Tp& __x) const
6434684ddb6SLionel Sambuc        {return tanh(__x);}
6444684ddb6SLionel Sambuc};
6454684ddb6SLionel Sambuc
6464684ddb6SLionel Sambuctemplate <class _ValExpr>
6474684ddb6SLionel Sambucclass __slice_expr
6484684ddb6SLionel Sambuc{
6494684ddb6SLionel Sambuc    typedef typename remove_reference<_ValExpr>::type  _RmExpr;
6504684ddb6SLionel Sambucpublic:
6514684ddb6SLionel Sambuc    typedef typename _RmExpr::value_type value_type;
6524684ddb6SLionel Sambuc    typedef value_type result_type;
6534684ddb6SLionel Sambuc
6544684ddb6SLionel Sambucprivate:
6554684ddb6SLionel Sambuc    _ValExpr __expr_;
6564684ddb6SLionel Sambuc    size_t __start_;
6574684ddb6SLionel Sambuc    size_t __size_;
6584684ddb6SLionel Sambuc    size_t __stride_;
6594684ddb6SLionel Sambuc
6604684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6614684ddb6SLionel Sambuc    __slice_expr(const slice& __sl, const _RmExpr& __e)
6624684ddb6SLionel Sambuc        : __expr_(__e),
6634684ddb6SLionel Sambuc          __start_(__sl.start()),
6644684ddb6SLionel Sambuc          __size_(__sl.size()),
6654684ddb6SLionel Sambuc          __stride_(__sl.stride())
6664684ddb6SLionel Sambuc        {}
6674684ddb6SLionel Sambucpublic:
6684684ddb6SLionel Sambuc
6694684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6704684ddb6SLionel Sambuc    result_type operator[](size_t __i) const
6714684ddb6SLionel Sambuc        {return __expr_[__start_ + __i * __stride_];}
6724684ddb6SLionel Sambuc
6734684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6744684ddb6SLionel Sambuc    size_t size() const {return __size_;}
6754684ddb6SLionel Sambuc
6764684ddb6SLionel Sambuc    template <class> friend class _LIBCPP_TYPE_VIS_ONLY valarray;
6774684ddb6SLionel Sambuc};
6784684ddb6SLionel Sambuc
6794684ddb6SLionel Sambuctemplate <class _ValExpr>
6804684ddb6SLionel Sambucclass __mask_expr;
6814684ddb6SLionel Sambuc
6824684ddb6SLionel Sambuctemplate <class _ValExpr>
6834684ddb6SLionel Sambucclass __indirect_expr;
6844684ddb6SLionel Sambuc
6854684ddb6SLionel Sambuctemplate <class _ValExpr>
6864684ddb6SLionel Sambucclass __shift_expr
6874684ddb6SLionel Sambuc{
6884684ddb6SLionel Sambuc    typedef typename remove_reference<_ValExpr>::type  _RmExpr;
6894684ddb6SLionel Sambucpublic:
6904684ddb6SLionel Sambuc    typedef typename _RmExpr::value_type value_type;
6914684ddb6SLionel Sambuc    typedef value_type result_type;
6924684ddb6SLionel Sambuc
6934684ddb6SLionel Sambucprivate:
6944684ddb6SLionel Sambuc    _ValExpr __expr_;
6954684ddb6SLionel Sambuc    size_t __size_;
6964684ddb6SLionel Sambuc    ptrdiff_t __ul_;
6974684ddb6SLionel Sambuc    ptrdiff_t __sn_;
6984684ddb6SLionel Sambuc    ptrdiff_t __n_;
6994684ddb6SLionel Sambuc    static const ptrdiff_t _Np = static_cast<ptrdiff_t>(
7004684ddb6SLionel Sambuc                                    sizeof(ptrdiff_t) * __CHAR_BIT__ - 1);
7014684ddb6SLionel Sambuc
7024684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
7034684ddb6SLionel Sambuc    __shift_expr(int __n, const _RmExpr& __e)
7044684ddb6SLionel Sambuc        : __expr_(__e),
7054684ddb6SLionel Sambuc          __size_(__e.size()),
7064684ddb6SLionel Sambuc          __n_(__n)
7074684ddb6SLionel Sambuc        {
7084684ddb6SLionel Sambuc            ptrdiff_t __neg_n = static_cast<ptrdiff_t>(__n_ >> _Np);
7094684ddb6SLionel Sambuc            __sn_ = __neg_n | static_cast<ptrdiff_t>(static_cast<size_t>(-__n_) >> _Np);
7104684ddb6SLionel Sambuc            __ul_ = ((__size_ - __n_) & ~__neg_n) | ((__n_ + 1) & __neg_n);
7114684ddb6SLionel Sambuc        }
7124684ddb6SLionel Sambucpublic:
7134684ddb6SLionel Sambuc
7144684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
7154684ddb6SLionel Sambuc    result_type operator[](size_t __j) const
7164684ddb6SLionel Sambuc        {
7174684ddb6SLionel Sambuc            ptrdiff_t __i = static_cast<ptrdiff_t>(__j);
7184684ddb6SLionel Sambuc            ptrdiff_t __m = (__sn_ * __i - __ul_) >> _Np;
7194684ddb6SLionel Sambuc            return (__expr_[(__i + __n_) & __m] & __m) | (value_type() & ~__m);
7204684ddb6SLionel Sambuc        }
7214684ddb6SLionel Sambuc
7224684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
7234684ddb6SLionel Sambuc    size_t size() const {return __size_;}
7244684ddb6SLionel Sambuc
7254684ddb6SLionel Sambuc    template <class> friend class __val_expr;
7264684ddb6SLionel Sambuc};
7274684ddb6SLionel Sambuc
7284684ddb6SLionel Sambuctemplate <class _ValExpr>
7294684ddb6SLionel Sambucclass __cshift_expr
7304684ddb6SLionel Sambuc{
7314684ddb6SLionel Sambuc    typedef typename remove_reference<_ValExpr>::type  _RmExpr;
7324684ddb6SLionel Sambucpublic:
7334684ddb6SLionel Sambuc    typedef typename _RmExpr::value_type value_type;
7344684ddb6SLionel Sambuc    typedef value_type result_type;
7354684ddb6SLionel Sambuc
7364684ddb6SLionel Sambucprivate:
7374684ddb6SLionel Sambuc    _ValExpr __expr_;
7384684ddb6SLionel Sambuc    size_t __size_;
7394684ddb6SLionel Sambuc    size_t __m_;
7404684ddb6SLionel Sambuc    size_t __o1_;
7414684ddb6SLionel Sambuc    size_t __o2_;
7424684ddb6SLionel Sambuc
7434684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
7444684ddb6SLionel Sambuc    __cshift_expr(int __n, const _RmExpr& __e)
7454684ddb6SLionel Sambuc        : __expr_(__e),
7464684ddb6SLionel Sambuc          __size_(__e.size())
7474684ddb6SLionel Sambuc        {
7484684ddb6SLionel Sambuc            __n %= static_cast<int>(__size_);
7494684ddb6SLionel Sambuc            if (__n >= 0)
7504684ddb6SLionel Sambuc            {
7514684ddb6SLionel Sambuc                __m_ = __size_ - __n;
7524684ddb6SLionel Sambuc                __o1_ = __n;
7534684ddb6SLionel Sambuc                __o2_ = __n - __size_;
7544684ddb6SLionel Sambuc            }
7554684ddb6SLionel Sambuc            else
7564684ddb6SLionel Sambuc            {
7574684ddb6SLionel Sambuc                __m_ = -__n;
7584684ddb6SLionel Sambuc                __o1_ = __n + __size_;
7594684ddb6SLionel Sambuc                __o2_ = __n;
7604684ddb6SLionel Sambuc            }
7614684ddb6SLionel Sambuc        }
7624684ddb6SLionel Sambucpublic:
7634684ddb6SLionel Sambuc
7644684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
7654684ddb6SLionel Sambuc    result_type operator[](size_t __i) const
7664684ddb6SLionel Sambuc        {
7674684ddb6SLionel Sambuc            if (__i < __m_)
7684684ddb6SLionel Sambuc                return __expr_[__i + __o1_];
7694684ddb6SLionel Sambuc            return __expr_[__i + __o2_];
7704684ddb6SLionel Sambuc        }
7714684ddb6SLionel Sambuc
7724684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
7734684ddb6SLionel Sambuc    size_t size() const {return __size_;}
7744684ddb6SLionel Sambuc
7754684ddb6SLionel Sambuc    template <class> friend class __val_expr;
7764684ddb6SLionel Sambuc};
7774684ddb6SLionel Sambuc
7784684ddb6SLionel Sambuctemplate<class _ValExpr>
7794684ddb6SLionel Sambucclass __val_expr;
7804684ddb6SLionel Sambuc
7814684ddb6SLionel Sambuctemplate<class _ValExpr>
7824684ddb6SLionel Sambucstruct __is_val_expr : false_type {};
7834684ddb6SLionel Sambuc
7844684ddb6SLionel Sambuctemplate<class _ValExpr>
7854684ddb6SLionel Sambucstruct __is_val_expr<__val_expr<_ValExpr> > : true_type {};
7864684ddb6SLionel Sambuc
7874684ddb6SLionel Sambuctemplate<class _Tp>
7884684ddb6SLionel Sambucstruct __is_val_expr<valarray<_Tp> > : true_type {};
7894684ddb6SLionel Sambuc
7904684ddb6SLionel Sambuctemplate<class _Tp>
7914684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY valarray
7924684ddb6SLionel Sambuc{
7934684ddb6SLionel Sambucpublic:
7944684ddb6SLionel Sambuc    typedef _Tp value_type;
7954684ddb6SLionel Sambuc    typedef _Tp result_type;
7964684ddb6SLionel Sambuc
7974684ddb6SLionel Sambucprivate:
7984684ddb6SLionel Sambuc    value_type* __begin_;
7994684ddb6SLionel Sambuc    value_type* __end_;
8004684ddb6SLionel Sambuc
8014684ddb6SLionel Sambucpublic:
8024684ddb6SLionel Sambuc    // construct/destroy:
8034684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
8044684ddb6SLionel Sambuc    valarray() : __begin_(0), __end_(0) {}
8054684ddb6SLionel Sambuc    explicit valarray(size_t __n);
8064684ddb6SLionel Sambuc    valarray(const value_type& __x, size_t __n);
8074684ddb6SLionel Sambuc    valarray(const value_type* __p, size_t __n);
8084684ddb6SLionel Sambuc    valarray(const valarray& __v);
8094684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
8104684ddb6SLionel Sambuc    valarray(valarray&& __v) _NOEXCEPT;
8114684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
8124684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
8134684ddb6SLionel Sambuc    valarray(initializer_list<value_type> __il);
8144684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
8154684ddb6SLionel Sambuc    valarray(const slice_array<value_type>& __sa);
8164684ddb6SLionel Sambuc    valarray(const gslice_array<value_type>& __ga);
8174684ddb6SLionel Sambuc    valarray(const mask_array<value_type>& __ma);
8184684ddb6SLionel Sambuc    valarray(const indirect_array<value_type>& __ia);
8194684ddb6SLionel Sambuc    ~valarray();
8204684ddb6SLionel Sambuc
8214684ddb6SLionel Sambuc    // assignment:
8224684ddb6SLionel Sambuc    valarray& operator=(const valarray& __v);
8234684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
8244684ddb6SLionel Sambuc    valarray& operator=(valarray&& __v) _NOEXCEPT;
8254684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
8264684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
8274684ddb6SLionel Sambuc    valarray& operator=(initializer_list<value_type>);
8284684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
8294684ddb6SLionel Sambuc    valarray& operator=(const value_type& __x);
8304684ddb6SLionel Sambuc    valarray& operator=(const slice_array<value_type>& __sa);
8314684ddb6SLionel Sambuc    valarray& operator=(const gslice_array<value_type>& __ga);
8324684ddb6SLionel Sambuc    valarray& operator=(const mask_array<value_type>& __ma);
8334684ddb6SLionel Sambuc    valarray& operator=(const indirect_array<value_type>& __ia);
8344684ddb6SLionel Sambuc    template <class _ValExpr>
8354684ddb6SLionel Sambuc        valarray& operator=(const __val_expr<_ValExpr>& __v);
8364684ddb6SLionel Sambuc
8374684ddb6SLionel Sambuc    // element access:
8384684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
8394684ddb6SLionel Sambuc    const value_type& operator[](size_t __i) const {return __begin_[__i];}
8404684ddb6SLionel Sambuc
8414684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
8424684ddb6SLionel Sambuc    value_type&       operator[](size_t __i)       {return __begin_[__i];}
8434684ddb6SLionel Sambuc
8444684ddb6SLionel Sambuc    // subset operations:
8454684ddb6SLionel Sambuc    __val_expr<__slice_expr<const valarray&> >    operator[](slice __s) const;
8464684ddb6SLionel Sambuc    slice_array<value_type>                       operator[](slice __s);
8474684ddb6SLionel Sambuc    __val_expr<__indirect_expr<const valarray&> > operator[](const gslice& __gs) const;
8484684ddb6SLionel Sambuc    gslice_array<value_type>   operator[](const gslice& __gs);
8494684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
8504684ddb6SLionel Sambuc    __val_expr<__indirect_expr<const valarray&> > operator[](gslice&& __gs) const;
8514684ddb6SLionel Sambuc    gslice_array<value_type>                      operator[](gslice&& __gs);
8524684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
8534684ddb6SLionel Sambuc    __val_expr<__mask_expr<const valarray&> >     operator[](const valarray<bool>& __vb) const;
8544684ddb6SLionel Sambuc    mask_array<value_type>                        operator[](const valarray<bool>& __vb);
8554684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
8564684ddb6SLionel Sambuc    __val_expr<__mask_expr<const valarray&> >     operator[](valarray<bool>&& __vb) const;
8574684ddb6SLionel Sambuc    mask_array<value_type>                        operator[](valarray<bool>&& __vb);
8584684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
8594684ddb6SLionel Sambuc    __val_expr<__indirect_expr<const valarray&> > operator[](const valarray<size_t>& __vs) const;
8604684ddb6SLionel Sambuc    indirect_array<value_type>                    operator[](const valarray<size_t>& __vs);
8614684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
8624684ddb6SLionel Sambuc    __val_expr<__indirect_expr<const valarray&> > operator[](valarray<size_t>&& __vs) const;
8634684ddb6SLionel Sambuc    indirect_array<value_type>                    operator[](valarray<size_t>&& __vs);
8644684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
8654684ddb6SLionel Sambuc
8664684ddb6SLionel Sambuc    // unary operators:
8674684ddb6SLionel Sambuc    valarray       operator+() const;
8684684ddb6SLionel Sambuc    valarray       operator-() const;
8694684ddb6SLionel Sambuc    valarray       operator~() const;
8704684ddb6SLionel Sambuc    valarray<bool> operator!() const;
8714684ddb6SLionel Sambuc
8724684ddb6SLionel Sambuc    // computed assignment:
8734684ddb6SLionel Sambuc    valarray& operator*= (const value_type& __x);
8744684ddb6SLionel Sambuc    valarray& operator/= (const value_type& __x);
8754684ddb6SLionel Sambuc    valarray& operator%= (const value_type& __x);
8764684ddb6SLionel Sambuc    valarray& operator+= (const value_type& __x);
8774684ddb6SLionel Sambuc    valarray& operator-= (const value_type& __x);
8784684ddb6SLionel Sambuc    valarray& operator^= (const value_type& __x);
8794684ddb6SLionel Sambuc    valarray& operator&= (const value_type& __x);
8804684ddb6SLionel Sambuc    valarray& operator|= (const value_type& __x);
8814684ddb6SLionel Sambuc    valarray& operator<<=(const value_type& __x);
8824684ddb6SLionel Sambuc    valarray& operator>>=(const value_type& __x);
8834684ddb6SLionel Sambuc
8844684ddb6SLionel Sambuc    template <class _Expr>
8854684ddb6SLionel Sambuc    typename enable_if
8864684ddb6SLionel Sambuc    <
8874684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
8884684ddb6SLionel Sambuc        valarray&
8894684ddb6SLionel Sambuc    >::type
8904684ddb6SLionel Sambuc    operator*= (const _Expr& __v);
8914684ddb6SLionel Sambuc
8924684ddb6SLionel Sambuc    template <class _Expr>
8934684ddb6SLionel Sambuc    typename enable_if
8944684ddb6SLionel Sambuc    <
8954684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
8964684ddb6SLionel Sambuc        valarray&
8974684ddb6SLionel Sambuc    >::type
8984684ddb6SLionel Sambuc    operator/= (const _Expr& __v);
8994684ddb6SLionel Sambuc
9004684ddb6SLionel Sambuc    template <class _Expr>
9014684ddb6SLionel Sambuc    typename enable_if
9024684ddb6SLionel Sambuc    <
9034684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
9044684ddb6SLionel Sambuc        valarray&
9054684ddb6SLionel Sambuc    >::type
9064684ddb6SLionel Sambuc    operator%= (const _Expr& __v);
9074684ddb6SLionel Sambuc
9084684ddb6SLionel Sambuc    template <class _Expr>
9094684ddb6SLionel Sambuc    typename enable_if
9104684ddb6SLionel Sambuc    <
9114684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
9124684ddb6SLionel Sambuc        valarray&
9134684ddb6SLionel Sambuc    >::type
9144684ddb6SLionel Sambuc    operator+= (const _Expr& __v);
9154684ddb6SLionel Sambuc
9164684ddb6SLionel Sambuc    template <class _Expr>
9174684ddb6SLionel Sambuc    typename enable_if
9184684ddb6SLionel Sambuc    <
9194684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
9204684ddb6SLionel Sambuc        valarray&
9214684ddb6SLionel Sambuc    >::type
9224684ddb6SLionel Sambuc    operator-= (const _Expr& __v);
9234684ddb6SLionel Sambuc
9244684ddb6SLionel Sambuc    template <class _Expr>
9254684ddb6SLionel Sambuc    typename enable_if
9264684ddb6SLionel Sambuc    <
9274684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
9284684ddb6SLionel Sambuc        valarray&
9294684ddb6SLionel Sambuc    >::type
9304684ddb6SLionel Sambuc    operator^= (const _Expr& __v);
9314684ddb6SLionel Sambuc
9324684ddb6SLionel Sambuc    template <class _Expr>
9334684ddb6SLionel Sambuc    typename enable_if
9344684ddb6SLionel Sambuc    <
9354684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
9364684ddb6SLionel Sambuc        valarray&
9374684ddb6SLionel Sambuc    >::type
9384684ddb6SLionel Sambuc    operator|= (const _Expr& __v);
9394684ddb6SLionel Sambuc
9404684ddb6SLionel Sambuc    template <class _Expr>
9414684ddb6SLionel Sambuc    typename enable_if
9424684ddb6SLionel Sambuc    <
9434684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
9444684ddb6SLionel Sambuc        valarray&
9454684ddb6SLionel Sambuc    >::type
9464684ddb6SLionel Sambuc    operator&= (const _Expr& __v);
9474684ddb6SLionel Sambuc
9484684ddb6SLionel Sambuc    template <class _Expr>
9494684ddb6SLionel Sambuc    typename enable_if
9504684ddb6SLionel Sambuc    <
9514684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
9524684ddb6SLionel Sambuc        valarray&
9534684ddb6SLionel Sambuc    >::type
9544684ddb6SLionel Sambuc    operator<<= (const _Expr& __v);
9554684ddb6SLionel Sambuc
9564684ddb6SLionel Sambuc    template <class _Expr>
9574684ddb6SLionel Sambuc    typename enable_if
9584684ddb6SLionel Sambuc    <
9594684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
9604684ddb6SLionel Sambuc        valarray&
9614684ddb6SLionel Sambuc    >::type
9624684ddb6SLionel Sambuc    operator>>= (const _Expr& __v);
9634684ddb6SLionel Sambuc
9644684ddb6SLionel Sambuc    // member functions:
9654684ddb6SLionel Sambuc    void swap(valarray& __v) _NOEXCEPT;
9664684ddb6SLionel Sambuc
9674684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
9684684ddb6SLionel Sambuc    size_t size() const {return static_cast<size_t>(__end_ - __begin_);}
9694684ddb6SLionel Sambuc
9704684ddb6SLionel Sambuc    value_type sum() const;
9714684ddb6SLionel Sambuc    value_type min() const;
9724684ddb6SLionel Sambuc    value_type max() const;
9734684ddb6SLionel Sambuc
9744684ddb6SLionel Sambuc    valarray shift (int __i) const;
9754684ddb6SLionel Sambuc    valarray cshift(int __i) const;
9764684ddb6SLionel Sambuc    valarray apply(value_type __f(value_type)) const;
9774684ddb6SLionel Sambuc    valarray apply(value_type __f(const value_type&)) const;
9784684ddb6SLionel Sambuc    void     resize(size_t __n, value_type __x = value_type());
9794684ddb6SLionel Sambuc
9804684ddb6SLionel Sambucprivate:
9814684ddb6SLionel Sambuc    template <class> friend class _LIBCPP_TYPE_VIS_ONLY valarray;
9824684ddb6SLionel Sambuc    template <class> friend class _LIBCPP_TYPE_VIS_ONLY slice_array;
9834684ddb6SLionel Sambuc    template <class> friend class _LIBCPP_TYPE_VIS_ONLY gslice_array;
9844684ddb6SLionel Sambuc    template <class> friend class _LIBCPP_TYPE_VIS_ONLY mask_array;
9854684ddb6SLionel Sambuc    template <class> friend class __mask_expr;
9864684ddb6SLionel Sambuc    template <class> friend class _LIBCPP_TYPE_VIS_ONLY indirect_array;
9874684ddb6SLionel Sambuc    template <class> friend class __indirect_expr;
9884684ddb6SLionel Sambuc    template <class> friend class __val_expr;
9894684ddb6SLionel Sambuc
9904684ddb6SLionel Sambuc    template <class _Up>
9914684ddb6SLionel Sambuc    friend
9924684ddb6SLionel Sambuc    _Up*
9934684ddb6SLionel Sambuc    begin(valarray<_Up>& __v);
9944684ddb6SLionel Sambuc
9954684ddb6SLionel Sambuc    template <class _Up>
9964684ddb6SLionel Sambuc    friend
9974684ddb6SLionel Sambuc    const _Up*
9984684ddb6SLionel Sambuc    begin(const valarray<_Up>& __v);
9994684ddb6SLionel Sambuc
10004684ddb6SLionel Sambuc    template <class _Up>
10014684ddb6SLionel Sambuc    friend
10024684ddb6SLionel Sambuc    _Up*
10034684ddb6SLionel Sambuc    end(valarray<_Up>& __v);
10044684ddb6SLionel Sambuc
10054684ddb6SLionel Sambuc    template <class _Up>
10064684ddb6SLionel Sambuc    friend
10074684ddb6SLionel Sambuc    const _Up*
10084684ddb6SLionel Sambuc    end(const valarray<_Up>& __v);
10094684ddb6SLionel Sambuc};
10104684ddb6SLionel Sambuc
10114684ddb6SLionel Sambuc_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::valarray(size_t))
10124684ddb6SLionel Sambuc_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::~valarray())
10134684ddb6SLionel Sambuc_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void valarray<size_t>::resize(size_t, size_t))
10144684ddb6SLionel Sambuc
10154684ddb6SLionel Sambuctemplate <class _Op, class _Tp>
10164684ddb6SLionel Sambucstruct _UnaryOp<_Op, valarray<_Tp> >
10174684ddb6SLionel Sambuc{
10184684ddb6SLionel Sambuc    typedef typename _Op::result_type result_type;
10194684ddb6SLionel Sambuc    typedef _Tp value_type;
10204684ddb6SLionel Sambuc
10214684ddb6SLionel Sambuc    _Op __op_;
10224684ddb6SLionel Sambuc    const valarray<_Tp>& __a0_;
10234684ddb6SLionel Sambuc
10244684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
10254684ddb6SLionel Sambuc    _UnaryOp(const _Op& __op, const valarray<_Tp>& __a0) : __op_(__op), __a0_(__a0) {}
10264684ddb6SLionel Sambuc
10274684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
10284684ddb6SLionel Sambuc    result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
10294684ddb6SLionel Sambuc
10304684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
10314684ddb6SLionel Sambuc    size_t size() const {return __a0_.size();}
10324684ddb6SLionel Sambuc};
10334684ddb6SLionel Sambuc
10344684ddb6SLionel Sambuctemplate <class _Op, class _Tp, class _A1>
10354684ddb6SLionel Sambucstruct _BinaryOp<_Op, valarray<_Tp>, _A1>
10364684ddb6SLionel Sambuc{
10374684ddb6SLionel Sambuc    typedef typename _Op::result_type result_type;
10384684ddb6SLionel Sambuc    typedef _Tp value_type;
10394684ddb6SLionel Sambuc
10404684ddb6SLionel Sambuc    _Op __op_;
10414684ddb6SLionel Sambuc    const valarray<_Tp>& __a0_;
10424684ddb6SLionel Sambuc    _A1 __a1_;
10434684ddb6SLionel Sambuc
10444684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
10454684ddb6SLionel Sambuc    _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const _A1& __a1)
10464684ddb6SLionel Sambuc        : __op_(__op), __a0_(__a0), __a1_(__a1) {}
10474684ddb6SLionel Sambuc
10484684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
10494684ddb6SLionel Sambuc    value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
10504684ddb6SLionel Sambuc
10514684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
10524684ddb6SLionel Sambuc    size_t size() const {return __a0_.size();}
10534684ddb6SLionel Sambuc};
10544684ddb6SLionel Sambuc
10554684ddb6SLionel Sambuctemplate <class _Op, class _A0, class _Tp>
10564684ddb6SLionel Sambucstruct _BinaryOp<_Op, _A0, valarray<_Tp> >
10574684ddb6SLionel Sambuc{
10584684ddb6SLionel Sambuc    typedef typename _Op::result_type result_type;
10594684ddb6SLionel Sambuc    typedef _Tp value_type;
10604684ddb6SLionel Sambuc
10614684ddb6SLionel Sambuc    _Op __op_;
10624684ddb6SLionel Sambuc    _A0 __a0_;
10634684ddb6SLionel Sambuc    const valarray<_Tp>& __a1_;
10644684ddb6SLionel Sambuc
10654684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
10664684ddb6SLionel Sambuc    _BinaryOp(const _Op& __op, const _A0& __a0, const valarray<_Tp>& __a1)
10674684ddb6SLionel Sambuc        : __op_(__op), __a0_(__a0), __a1_(__a1) {}
10684684ddb6SLionel Sambuc
10694684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
10704684ddb6SLionel Sambuc    value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
10714684ddb6SLionel Sambuc
10724684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
10734684ddb6SLionel Sambuc    size_t size() const {return __a0_.size();}
10744684ddb6SLionel Sambuc};
10754684ddb6SLionel Sambuc
10764684ddb6SLionel Sambuctemplate <class _Op, class _Tp>
10774684ddb6SLionel Sambucstruct _BinaryOp<_Op, valarray<_Tp>, valarray<_Tp> >
10784684ddb6SLionel Sambuc{
10794684ddb6SLionel Sambuc    typedef typename _Op::result_type result_type;
10804684ddb6SLionel Sambuc    typedef _Tp value_type;
10814684ddb6SLionel Sambuc
10824684ddb6SLionel Sambuc    _Op __op_;
10834684ddb6SLionel Sambuc    const valarray<_Tp>& __a0_;
10844684ddb6SLionel Sambuc    const valarray<_Tp>& __a1_;
10854684ddb6SLionel Sambuc
10864684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
10874684ddb6SLionel Sambuc    _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const valarray<_Tp>& __a1)
10884684ddb6SLionel Sambuc        : __op_(__op), __a0_(__a0), __a1_(__a1) {}
10894684ddb6SLionel Sambuc
10904684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
10914684ddb6SLionel Sambuc    value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
10924684ddb6SLionel Sambuc
10934684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
10944684ddb6SLionel Sambuc    size_t size() const {return __a0_.size();}
10954684ddb6SLionel Sambuc};
10964684ddb6SLionel Sambuc
10974684ddb6SLionel Sambuc// slice_array
10984684ddb6SLionel Sambuc
10994684ddb6SLionel Sambuctemplate <class _Tp>
11004684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY slice_array
11014684ddb6SLionel Sambuc{
11024684ddb6SLionel Sambucpublic:
11034684ddb6SLionel Sambuc    typedef _Tp value_type;
11044684ddb6SLionel Sambuc
11054684ddb6SLionel Sambucprivate:
11064684ddb6SLionel Sambuc    value_type* __vp_;
11074684ddb6SLionel Sambuc    size_t __size_;
11084684ddb6SLionel Sambuc    size_t __stride_;
11094684ddb6SLionel Sambuc
11104684ddb6SLionel Sambucpublic:
11114684ddb6SLionel Sambuc    template <class _Expr>
11124684ddb6SLionel Sambuc    typename enable_if
11134684ddb6SLionel Sambuc    <
11144684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
11154684ddb6SLionel Sambuc        void
11164684ddb6SLionel Sambuc    >::type
11174684ddb6SLionel Sambuc    operator=(const _Expr& __v) const;
11184684ddb6SLionel Sambuc
11194684ddb6SLionel Sambuc    template <class _Expr>
11204684ddb6SLionel Sambuc    typename enable_if
11214684ddb6SLionel Sambuc    <
11224684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
11234684ddb6SLionel Sambuc        void
11244684ddb6SLionel Sambuc    >::type
11254684ddb6SLionel Sambuc    operator*=(const _Expr& __v) const;
11264684ddb6SLionel Sambuc
11274684ddb6SLionel Sambuc    template <class _Expr>
11284684ddb6SLionel Sambuc    typename enable_if
11294684ddb6SLionel Sambuc    <
11304684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
11314684ddb6SLionel Sambuc        void
11324684ddb6SLionel Sambuc    >::type
11334684ddb6SLionel Sambuc    operator/=(const _Expr& __v) const;
11344684ddb6SLionel Sambuc
11354684ddb6SLionel Sambuc    template <class _Expr>
11364684ddb6SLionel Sambuc    typename enable_if
11374684ddb6SLionel Sambuc    <
11384684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
11394684ddb6SLionel Sambuc        void
11404684ddb6SLionel Sambuc    >::type
11414684ddb6SLionel Sambuc    operator%=(const _Expr& __v) const;
11424684ddb6SLionel Sambuc
11434684ddb6SLionel Sambuc    template <class _Expr>
11444684ddb6SLionel Sambuc    typename enable_if
11454684ddb6SLionel Sambuc    <
11464684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
11474684ddb6SLionel Sambuc        void
11484684ddb6SLionel Sambuc    >::type
11494684ddb6SLionel Sambuc    operator+=(const _Expr& __v) const;
11504684ddb6SLionel Sambuc
11514684ddb6SLionel Sambuc    template <class _Expr>
11524684ddb6SLionel Sambuc    typename enable_if
11534684ddb6SLionel Sambuc    <
11544684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
11554684ddb6SLionel Sambuc        void
11564684ddb6SLionel Sambuc    >::type
11574684ddb6SLionel Sambuc    operator-=(const _Expr& __v) const;
11584684ddb6SLionel Sambuc
11594684ddb6SLionel Sambuc    template <class _Expr>
11604684ddb6SLionel Sambuc    typename enable_if
11614684ddb6SLionel Sambuc    <
11624684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
11634684ddb6SLionel Sambuc        void
11644684ddb6SLionel Sambuc    >::type
11654684ddb6SLionel Sambuc    operator^=(const _Expr& __v) const;
11664684ddb6SLionel Sambuc
11674684ddb6SLionel Sambuc    template <class _Expr>
11684684ddb6SLionel Sambuc    typename enable_if
11694684ddb6SLionel Sambuc    <
11704684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
11714684ddb6SLionel Sambuc        void
11724684ddb6SLionel Sambuc    >::type
11734684ddb6SLionel Sambuc    operator&=(const _Expr& __v) const;
11744684ddb6SLionel Sambuc
11754684ddb6SLionel Sambuc    template <class _Expr>
11764684ddb6SLionel Sambuc    typename enable_if
11774684ddb6SLionel Sambuc    <
11784684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
11794684ddb6SLionel Sambuc        void
11804684ddb6SLionel Sambuc    >::type
11814684ddb6SLionel Sambuc    operator|=(const _Expr& __v) const;
11824684ddb6SLionel Sambuc
11834684ddb6SLionel Sambuc    template <class _Expr>
11844684ddb6SLionel Sambuc    typename enable_if
11854684ddb6SLionel Sambuc    <
11864684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
11874684ddb6SLionel Sambuc        void
11884684ddb6SLionel Sambuc    >::type
11894684ddb6SLionel Sambuc    operator<<=(const _Expr& __v) const;
11904684ddb6SLionel Sambuc
11914684ddb6SLionel Sambuc    template <class _Expr>
11924684ddb6SLionel Sambuc    typename enable_if
11934684ddb6SLionel Sambuc    <
11944684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
11954684ddb6SLionel Sambuc        void
11964684ddb6SLionel Sambuc    >::type
11974684ddb6SLionel Sambuc    operator>>=(const _Expr& __v) const;
11984684ddb6SLionel Sambuc
11994684ddb6SLionel Sambuc    const slice_array& operator=(const slice_array& __sa) const;
12004684ddb6SLionel Sambuc
12014684ddb6SLionel Sambuc    void operator=(const value_type& __x) const;
12024684ddb6SLionel Sambuc
12034684ddb6SLionel Sambucprivate:
12044684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
12054684ddb6SLionel Sambuc    slice_array(const slice& __sl, const valarray<value_type>& __v)
12064684ddb6SLionel Sambuc        : __vp_(const_cast<value_type*>(__v.__begin_ + __sl.start())),
12074684ddb6SLionel Sambuc          __size_(__sl.size()),
12084684ddb6SLionel Sambuc          __stride_(__sl.stride())
12094684ddb6SLionel Sambuc        {}
12104684ddb6SLionel Sambuc
12114684ddb6SLionel Sambuc    template <class> friend class valarray;
12124684ddb6SLionel Sambuc    template <class> friend class sliceExpr;
12134684ddb6SLionel Sambuc};
12144684ddb6SLionel Sambuc
12154684ddb6SLionel Sambuctemplate <class _Tp>
12164684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
12174684ddb6SLionel Sambucconst slice_array<_Tp>&
12184684ddb6SLionel Sambucslice_array<_Tp>::operator=(const slice_array& __sa) const
12194684ddb6SLionel Sambuc{
12204684ddb6SLionel Sambuc    value_type* __t = __vp_;
12214684ddb6SLionel Sambuc    const value_type* __s = __sa.__vp_;
12224684ddb6SLionel Sambuc    for (size_t __n = __size_; __n; --__n, __t += __stride_, __s += __sa.__stride_)
12234684ddb6SLionel Sambuc        *__t = *__s;
1224*0a6a1f1dSLionel Sambuc    return *this;
12254684ddb6SLionel Sambuc}
12264684ddb6SLionel Sambuc
12274684ddb6SLionel Sambuctemplate <class _Tp>
12284684ddb6SLionel Sambuctemplate <class _Expr>
12294684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
12304684ddb6SLionel Sambuctypename enable_if
12314684ddb6SLionel Sambuc<
12324684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
12334684ddb6SLionel Sambuc    void
12344684ddb6SLionel Sambuc>::type
12354684ddb6SLionel Sambucslice_array<_Tp>::operator=(const _Expr& __v) const
12364684ddb6SLionel Sambuc{
12374684ddb6SLionel Sambuc    value_type* __t = __vp_;
12384684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
12394684ddb6SLionel Sambuc        *__t = __v[__i];
12404684ddb6SLionel Sambuc}
12414684ddb6SLionel Sambuc
12424684ddb6SLionel Sambuctemplate <class _Tp>
12434684ddb6SLionel Sambuctemplate <class _Expr>
12444684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
12454684ddb6SLionel Sambuctypename enable_if
12464684ddb6SLionel Sambuc<
12474684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
12484684ddb6SLionel Sambuc    void
12494684ddb6SLionel Sambuc>::type
12504684ddb6SLionel Sambucslice_array<_Tp>::operator*=(const _Expr& __v) const
12514684ddb6SLionel Sambuc{
12524684ddb6SLionel Sambuc    value_type* __t = __vp_;
12534684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
12544684ddb6SLionel Sambuc        *__t *= __v[__i];
12554684ddb6SLionel Sambuc}
12564684ddb6SLionel Sambuc
12574684ddb6SLionel Sambuctemplate <class _Tp>
12584684ddb6SLionel Sambuctemplate <class _Expr>
12594684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
12604684ddb6SLionel Sambuctypename enable_if
12614684ddb6SLionel Sambuc<
12624684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
12634684ddb6SLionel Sambuc    void
12644684ddb6SLionel Sambuc>::type
12654684ddb6SLionel Sambucslice_array<_Tp>::operator/=(const _Expr& __v) const
12664684ddb6SLionel Sambuc{
12674684ddb6SLionel Sambuc    value_type* __t = __vp_;
12684684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
12694684ddb6SLionel Sambuc        *__t /= __v[__i];
12704684ddb6SLionel Sambuc}
12714684ddb6SLionel Sambuc
12724684ddb6SLionel Sambuctemplate <class _Tp>
12734684ddb6SLionel Sambuctemplate <class _Expr>
12744684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
12754684ddb6SLionel Sambuctypename enable_if
12764684ddb6SLionel Sambuc<
12774684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
12784684ddb6SLionel Sambuc    void
12794684ddb6SLionel Sambuc>::type
12804684ddb6SLionel Sambucslice_array<_Tp>::operator%=(const _Expr& __v) const
12814684ddb6SLionel Sambuc{
12824684ddb6SLionel Sambuc    value_type* __t = __vp_;
12834684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
12844684ddb6SLionel Sambuc        *__t %= __v[__i];
12854684ddb6SLionel Sambuc}
12864684ddb6SLionel Sambuc
12874684ddb6SLionel Sambuctemplate <class _Tp>
12884684ddb6SLionel Sambuctemplate <class _Expr>
12894684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
12904684ddb6SLionel Sambuctypename enable_if
12914684ddb6SLionel Sambuc<
12924684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
12934684ddb6SLionel Sambuc    void
12944684ddb6SLionel Sambuc>::type
12954684ddb6SLionel Sambucslice_array<_Tp>::operator+=(const _Expr& __v) const
12964684ddb6SLionel Sambuc{
12974684ddb6SLionel Sambuc    value_type* __t = __vp_;
12984684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
12994684ddb6SLionel Sambuc        *__t += __v[__i];
13004684ddb6SLionel Sambuc}
13014684ddb6SLionel Sambuc
13024684ddb6SLionel Sambuctemplate <class _Tp>
13034684ddb6SLionel Sambuctemplate <class _Expr>
13044684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
13054684ddb6SLionel Sambuctypename enable_if
13064684ddb6SLionel Sambuc<
13074684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
13084684ddb6SLionel Sambuc    void
13094684ddb6SLionel Sambuc>::type
13104684ddb6SLionel Sambucslice_array<_Tp>::operator-=(const _Expr& __v) const
13114684ddb6SLionel Sambuc{
13124684ddb6SLionel Sambuc    value_type* __t = __vp_;
13134684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
13144684ddb6SLionel Sambuc        *__t -= __v[__i];
13154684ddb6SLionel Sambuc}
13164684ddb6SLionel Sambuc
13174684ddb6SLionel Sambuctemplate <class _Tp>
13184684ddb6SLionel Sambuctemplate <class _Expr>
13194684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
13204684ddb6SLionel Sambuctypename enable_if
13214684ddb6SLionel Sambuc<
13224684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
13234684ddb6SLionel Sambuc    void
13244684ddb6SLionel Sambuc>::type
13254684ddb6SLionel Sambucslice_array<_Tp>::operator^=(const _Expr& __v) const
13264684ddb6SLionel Sambuc{
13274684ddb6SLionel Sambuc    value_type* __t = __vp_;
13284684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
13294684ddb6SLionel Sambuc        *__t ^= __v[__i];
13304684ddb6SLionel Sambuc}
13314684ddb6SLionel Sambuc
13324684ddb6SLionel Sambuctemplate <class _Tp>
13334684ddb6SLionel Sambuctemplate <class _Expr>
13344684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
13354684ddb6SLionel Sambuctypename enable_if
13364684ddb6SLionel Sambuc<
13374684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
13384684ddb6SLionel Sambuc    void
13394684ddb6SLionel Sambuc>::type
13404684ddb6SLionel Sambucslice_array<_Tp>::operator&=(const _Expr& __v) const
13414684ddb6SLionel Sambuc{
13424684ddb6SLionel Sambuc    value_type* __t = __vp_;
13434684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
13444684ddb6SLionel Sambuc        *__t &= __v[__i];
13454684ddb6SLionel Sambuc}
13464684ddb6SLionel Sambuc
13474684ddb6SLionel Sambuctemplate <class _Tp>
13484684ddb6SLionel Sambuctemplate <class _Expr>
13494684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
13504684ddb6SLionel Sambuctypename enable_if
13514684ddb6SLionel Sambuc<
13524684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
13534684ddb6SLionel Sambuc    void
13544684ddb6SLionel Sambuc>::type
13554684ddb6SLionel Sambucslice_array<_Tp>::operator|=(const _Expr& __v) const
13564684ddb6SLionel Sambuc{
13574684ddb6SLionel Sambuc    value_type* __t = __vp_;
13584684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
13594684ddb6SLionel Sambuc        *__t |= __v[__i];
13604684ddb6SLionel Sambuc}
13614684ddb6SLionel Sambuc
13624684ddb6SLionel Sambuctemplate <class _Tp>
13634684ddb6SLionel Sambuctemplate <class _Expr>
13644684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
13654684ddb6SLionel Sambuctypename enable_if
13664684ddb6SLionel Sambuc<
13674684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
13684684ddb6SLionel Sambuc    void
13694684ddb6SLionel Sambuc>::type
13704684ddb6SLionel Sambucslice_array<_Tp>::operator<<=(const _Expr& __v) const
13714684ddb6SLionel Sambuc{
13724684ddb6SLionel Sambuc    value_type* __t = __vp_;
13734684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
13744684ddb6SLionel Sambuc        *__t <<= __v[__i];
13754684ddb6SLionel Sambuc}
13764684ddb6SLionel Sambuc
13774684ddb6SLionel Sambuctemplate <class _Tp>
13784684ddb6SLionel Sambuctemplate <class _Expr>
13794684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
13804684ddb6SLionel Sambuctypename enable_if
13814684ddb6SLionel Sambuc<
13824684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
13834684ddb6SLionel Sambuc    void
13844684ddb6SLionel Sambuc>::type
13854684ddb6SLionel Sambucslice_array<_Tp>::operator>>=(const _Expr& __v) const
13864684ddb6SLionel Sambuc{
13874684ddb6SLionel Sambuc    value_type* __t = __vp_;
13884684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
13894684ddb6SLionel Sambuc        *__t >>= __v[__i];
13904684ddb6SLionel Sambuc}
13914684ddb6SLionel Sambuc
13924684ddb6SLionel Sambuctemplate <class _Tp>
13934684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
13944684ddb6SLionel Sambucvoid
13954684ddb6SLionel Sambucslice_array<_Tp>::operator=(const value_type& __x) const
13964684ddb6SLionel Sambuc{
13974684ddb6SLionel Sambuc    value_type* __t = __vp_;
13984684ddb6SLionel Sambuc    for (size_t __n = __size_; __n; --__n, __t += __stride_)
13994684ddb6SLionel Sambuc        *__t = __x;
14004684ddb6SLionel Sambuc}
14014684ddb6SLionel Sambuc
14024684ddb6SLionel Sambuc// gslice
14034684ddb6SLionel Sambuc
14044684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS gslice
14054684ddb6SLionel Sambuc{
14064684ddb6SLionel Sambuc    valarray<size_t> __size_;
14074684ddb6SLionel Sambuc    valarray<size_t> __stride_;
14084684ddb6SLionel Sambuc    valarray<size_t> __1d_;
14094684ddb6SLionel Sambuc
14104684ddb6SLionel Sambucpublic:
14114684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
14124684ddb6SLionel Sambuc    gslice() {}
14134684ddb6SLionel Sambuc
14144684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
14154684ddb6SLionel Sambuc    gslice(size_t __start, const valarray<size_t>& __size,
14164684ddb6SLionel Sambuc                           const valarray<size_t>& __stride)
14174684ddb6SLionel Sambuc        : __size_(__size),
14184684ddb6SLionel Sambuc          __stride_(__stride)
14194684ddb6SLionel Sambuc        {__init(__start);}
14204684ddb6SLionel Sambuc
14214684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
14224684ddb6SLionel Sambuc
14234684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
14244684ddb6SLionel Sambuc    gslice(size_t __start, const valarray<size_t>&  __size,
14254684ddb6SLionel Sambuc                                 valarray<size_t>&& __stride)
14264684ddb6SLionel Sambuc        : __size_(__size),
14274684ddb6SLionel Sambuc          __stride_(move(__stride))
14284684ddb6SLionel Sambuc        {__init(__start);}
14294684ddb6SLionel Sambuc
14304684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
14314684ddb6SLionel Sambuc    gslice(size_t __start,       valarray<size_t>&& __size,
14324684ddb6SLionel Sambuc                           const valarray<size_t>&  __stride)
14334684ddb6SLionel Sambuc        : __size_(move(__size)),
14344684ddb6SLionel Sambuc          __stride_(__stride)
14354684ddb6SLionel Sambuc        {__init(__start);}
14364684ddb6SLionel Sambuc
14374684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
14384684ddb6SLionel Sambuc    gslice(size_t __start,       valarray<size_t>&& __size,
14394684ddb6SLionel Sambuc                                 valarray<size_t>&& __stride)
14404684ddb6SLionel Sambuc        : __size_(move(__size)),
14414684ddb6SLionel Sambuc          __stride_(move(__stride))
14424684ddb6SLionel Sambuc        {__init(__start);}
14434684ddb6SLionel Sambuc
14444684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
14454684ddb6SLionel Sambuc
14464684ddb6SLionel Sambuc//  gslice(const gslice&)            = default;
14474684ddb6SLionel Sambuc//  gslice(gslice&&)                 = default;
14484684ddb6SLionel Sambuc//  gslice& operator=(const gslice&) = default;
14494684ddb6SLionel Sambuc//  gslice& operator=(gslice&&)      = default;
14504684ddb6SLionel Sambuc
14514684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
14524684ddb6SLionel Sambuc    size_t           start()  const {return __1d_.size() ? __1d_[0] : 0;}
14534684ddb6SLionel Sambuc
14544684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
14554684ddb6SLionel Sambuc    valarray<size_t> size()   const {return __size_;}
14564684ddb6SLionel Sambuc
14574684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
14584684ddb6SLionel Sambuc    valarray<size_t> stride() const {return __stride_;}
14594684ddb6SLionel Sambuc
14604684ddb6SLionel Sambucprivate:
14614684ddb6SLionel Sambuc    void __init(size_t __start);
14624684ddb6SLionel Sambuc
14634684ddb6SLionel Sambuc    template <class> friend class gslice_array;
14644684ddb6SLionel Sambuc    template <class> friend class valarray;
14654684ddb6SLionel Sambuc    template <class> friend class __val_expr;
14664684ddb6SLionel Sambuc};
14674684ddb6SLionel Sambuc
14684684ddb6SLionel Sambuc// gslice_array
14694684ddb6SLionel Sambuc
14704684ddb6SLionel Sambuctemplate <class _Tp>
14714684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY gslice_array
14724684ddb6SLionel Sambuc{
14734684ddb6SLionel Sambucpublic:
14744684ddb6SLionel Sambuc    typedef _Tp value_type;
14754684ddb6SLionel Sambuc
14764684ddb6SLionel Sambucprivate:
14774684ddb6SLionel Sambuc    value_type*      __vp_;
14784684ddb6SLionel Sambuc    valarray<size_t> __1d_;
14794684ddb6SLionel Sambuc
14804684ddb6SLionel Sambucpublic:
14814684ddb6SLionel Sambuc    template <class _Expr>
14824684ddb6SLionel Sambuc    typename enable_if
14834684ddb6SLionel Sambuc    <
14844684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
14854684ddb6SLionel Sambuc        void
14864684ddb6SLionel Sambuc    >::type
14874684ddb6SLionel Sambuc    operator=(const _Expr& __v) const;
14884684ddb6SLionel Sambuc
14894684ddb6SLionel Sambuc    template <class _Expr>
14904684ddb6SLionel Sambuc    typename enable_if
14914684ddb6SLionel Sambuc    <
14924684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
14934684ddb6SLionel Sambuc        void
14944684ddb6SLionel Sambuc    >::type
14954684ddb6SLionel Sambuc    operator*=(const _Expr& __v) const;
14964684ddb6SLionel Sambuc
14974684ddb6SLionel Sambuc    template <class _Expr>
14984684ddb6SLionel Sambuc    typename enable_if
14994684ddb6SLionel Sambuc    <
15004684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
15014684ddb6SLionel Sambuc        void
15024684ddb6SLionel Sambuc    >::type
15034684ddb6SLionel Sambuc    operator/=(const _Expr& __v) const;
15044684ddb6SLionel Sambuc
15054684ddb6SLionel Sambuc    template <class _Expr>
15064684ddb6SLionel Sambuc    typename enable_if
15074684ddb6SLionel Sambuc    <
15084684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
15094684ddb6SLionel Sambuc        void
15104684ddb6SLionel Sambuc    >::type
15114684ddb6SLionel Sambuc    operator%=(const _Expr& __v) const;
15124684ddb6SLionel Sambuc
15134684ddb6SLionel Sambuc    template <class _Expr>
15144684ddb6SLionel Sambuc    typename enable_if
15154684ddb6SLionel Sambuc    <
15164684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
15174684ddb6SLionel Sambuc        void
15184684ddb6SLionel Sambuc    >::type
15194684ddb6SLionel Sambuc    operator+=(const _Expr& __v) const;
15204684ddb6SLionel Sambuc
15214684ddb6SLionel Sambuc    template <class _Expr>
15224684ddb6SLionel Sambuc    typename enable_if
15234684ddb6SLionel Sambuc    <
15244684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
15254684ddb6SLionel Sambuc        void
15264684ddb6SLionel Sambuc    >::type
15274684ddb6SLionel Sambuc    operator-=(const _Expr& __v) const;
15284684ddb6SLionel Sambuc
15294684ddb6SLionel Sambuc    template <class _Expr>
15304684ddb6SLionel Sambuc    typename enable_if
15314684ddb6SLionel Sambuc    <
15324684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
15334684ddb6SLionel Sambuc        void
15344684ddb6SLionel Sambuc    >::type
15354684ddb6SLionel Sambuc    operator^=(const _Expr& __v) const;
15364684ddb6SLionel Sambuc
15374684ddb6SLionel Sambuc    template <class _Expr>
15384684ddb6SLionel Sambuc    typename enable_if
15394684ddb6SLionel Sambuc    <
15404684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
15414684ddb6SLionel Sambuc        void
15424684ddb6SLionel Sambuc    >::type
15434684ddb6SLionel Sambuc    operator&=(const _Expr& __v) const;
15444684ddb6SLionel Sambuc
15454684ddb6SLionel Sambuc    template <class _Expr>
15464684ddb6SLionel Sambuc    typename enable_if
15474684ddb6SLionel Sambuc    <
15484684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
15494684ddb6SLionel Sambuc        void
15504684ddb6SLionel Sambuc    >::type
15514684ddb6SLionel Sambuc    operator|=(const _Expr& __v) const;
15524684ddb6SLionel Sambuc
15534684ddb6SLionel Sambuc    template <class _Expr>
15544684ddb6SLionel Sambuc    typename enable_if
15554684ddb6SLionel Sambuc    <
15564684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
15574684ddb6SLionel Sambuc        void
15584684ddb6SLionel Sambuc    >::type
15594684ddb6SLionel Sambuc    operator<<=(const _Expr& __v) const;
15604684ddb6SLionel Sambuc
15614684ddb6SLionel Sambuc    template <class _Expr>
15624684ddb6SLionel Sambuc    typename enable_if
15634684ddb6SLionel Sambuc    <
15644684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
15654684ddb6SLionel Sambuc        void
15664684ddb6SLionel Sambuc    >::type
15674684ddb6SLionel Sambuc    operator>>=(const _Expr& __v) const;
15684684ddb6SLionel Sambuc
15694684ddb6SLionel Sambuc    const gslice_array& operator=(const gslice_array& __ga) const;
15704684ddb6SLionel Sambuc
15714684ddb6SLionel Sambuc    void operator=(const value_type& __x) const;
15724684ddb6SLionel Sambuc
15734684ddb6SLionel Sambuc//  gslice_array(const gslice_array&)            = default;
15744684ddb6SLionel Sambuc//  gslice_array(gslice_array&&)                 = default;
15754684ddb6SLionel Sambuc//  gslice_array& operator=(const gslice_array&) = default;
15764684ddb6SLionel Sambuc//  gslice_array& operator=(gslice_array&&)      = default;
15774684ddb6SLionel Sambuc
15784684ddb6SLionel Sambucprivate:
15794684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
15804684ddb6SLionel Sambuc    gslice_array(const gslice& __gs, const valarray<value_type>& __v)
15814684ddb6SLionel Sambuc        : __vp_(const_cast<value_type*>(__v.__begin_)),
15824684ddb6SLionel Sambuc          __1d_(__gs.__1d_)
15834684ddb6SLionel Sambuc        {}
15844684ddb6SLionel Sambuc
15854684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
15864684ddb6SLionel Sambuc
15874684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
15884684ddb6SLionel Sambuc    gslice_array(gslice&& __gs, const valarray<value_type>& __v)
15894684ddb6SLionel Sambuc        : __vp_(const_cast<value_type*>(__v.__begin_)),
15904684ddb6SLionel Sambuc          __1d_(move(__gs.__1d_))
15914684ddb6SLionel Sambuc        {}
15924684ddb6SLionel Sambuc
15934684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
15944684ddb6SLionel Sambuc
15954684ddb6SLionel Sambuc    template <class> friend class valarray;
15964684ddb6SLionel Sambuc};
15974684ddb6SLionel Sambuc
15984684ddb6SLionel Sambuctemplate <class _Tp>
15994684ddb6SLionel Sambuctemplate <class _Expr>
16004684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
16014684ddb6SLionel Sambuctypename enable_if
16024684ddb6SLionel Sambuc<
16034684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
16044684ddb6SLionel Sambuc    void
16054684ddb6SLionel Sambuc>::type
16064684ddb6SLionel Sambucgslice_array<_Tp>::operator=(const _Expr& __v) const
16074684ddb6SLionel Sambuc{
16084684ddb6SLionel Sambuc    typedef const size_t* _Ip;
16094684ddb6SLionel Sambuc    size_t __j = 0;
16104684ddb6SLionel Sambuc    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
16114684ddb6SLionel Sambuc        __vp_[*__i] = __v[__j];
16124684ddb6SLionel Sambuc}
16134684ddb6SLionel Sambuc
16144684ddb6SLionel Sambuctemplate <class _Tp>
16154684ddb6SLionel Sambuctemplate <class _Expr>
16164684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
16174684ddb6SLionel Sambuctypename enable_if
16184684ddb6SLionel Sambuc<
16194684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
16204684ddb6SLionel Sambuc    void
16214684ddb6SLionel Sambuc>::type
16224684ddb6SLionel Sambucgslice_array<_Tp>::operator*=(const _Expr& __v) const
16234684ddb6SLionel Sambuc{
16244684ddb6SLionel Sambuc    typedef const size_t* _Ip;
16254684ddb6SLionel Sambuc    size_t __j = 0;
16264684ddb6SLionel Sambuc    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
16274684ddb6SLionel Sambuc        __vp_[*__i] *= __v[__j];
16284684ddb6SLionel Sambuc}
16294684ddb6SLionel Sambuc
16304684ddb6SLionel Sambuctemplate <class _Tp>
16314684ddb6SLionel Sambuctemplate <class _Expr>
16324684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
16334684ddb6SLionel Sambuctypename enable_if
16344684ddb6SLionel Sambuc<
16354684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
16364684ddb6SLionel Sambuc    void
16374684ddb6SLionel Sambuc>::type
16384684ddb6SLionel Sambucgslice_array<_Tp>::operator/=(const _Expr& __v) const
16394684ddb6SLionel Sambuc{
16404684ddb6SLionel Sambuc    typedef const size_t* _Ip;
16414684ddb6SLionel Sambuc    size_t __j = 0;
16424684ddb6SLionel Sambuc    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
16434684ddb6SLionel Sambuc        __vp_[*__i] /= __v[__j];
16444684ddb6SLionel Sambuc}
16454684ddb6SLionel Sambuc
16464684ddb6SLionel Sambuctemplate <class _Tp>
16474684ddb6SLionel Sambuctemplate <class _Expr>
16484684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
16494684ddb6SLionel Sambuctypename enable_if
16504684ddb6SLionel Sambuc<
16514684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
16524684ddb6SLionel Sambuc    void
16534684ddb6SLionel Sambuc>::type
16544684ddb6SLionel Sambucgslice_array<_Tp>::operator%=(const _Expr& __v) const
16554684ddb6SLionel Sambuc{
16564684ddb6SLionel Sambuc    typedef const size_t* _Ip;
16574684ddb6SLionel Sambuc    size_t __j = 0;
16584684ddb6SLionel Sambuc    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
16594684ddb6SLionel Sambuc        __vp_[*__i] %= __v[__j];
16604684ddb6SLionel Sambuc}
16614684ddb6SLionel Sambuc
16624684ddb6SLionel Sambuctemplate <class _Tp>
16634684ddb6SLionel Sambuctemplate <class _Expr>
16644684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
16654684ddb6SLionel Sambuctypename enable_if
16664684ddb6SLionel Sambuc<
16674684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
16684684ddb6SLionel Sambuc    void
16694684ddb6SLionel Sambuc>::type
16704684ddb6SLionel Sambucgslice_array<_Tp>::operator+=(const _Expr& __v) const
16714684ddb6SLionel Sambuc{
16724684ddb6SLionel Sambuc    typedef const size_t* _Ip;
16734684ddb6SLionel Sambuc    size_t __j = 0;
16744684ddb6SLionel Sambuc    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
16754684ddb6SLionel Sambuc        __vp_[*__i] += __v[__j];
16764684ddb6SLionel Sambuc}
16774684ddb6SLionel Sambuc
16784684ddb6SLionel Sambuctemplate <class _Tp>
16794684ddb6SLionel Sambuctemplate <class _Expr>
16804684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
16814684ddb6SLionel Sambuctypename enable_if
16824684ddb6SLionel Sambuc<
16834684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
16844684ddb6SLionel Sambuc    void
16854684ddb6SLionel Sambuc>::type
16864684ddb6SLionel Sambucgslice_array<_Tp>::operator-=(const _Expr& __v) const
16874684ddb6SLionel Sambuc{
16884684ddb6SLionel Sambuc    typedef const size_t* _Ip;
16894684ddb6SLionel Sambuc    size_t __j = 0;
16904684ddb6SLionel Sambuc    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
16914684ddb6SLionel Sambuc        __vp_[*__i] -= __v[__j];
16924684ddb6SLionel Sambuc}
16934684ddb6SLionel Sambuc
16944684ddb6SLionel Sambuctemplate <class _Tp>
16954684ddb6SLionel Sambuctemplate <class _Expr>
16964684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
16974684ddb6SLionel Sambuctypename enable_if
16984684ddb6SLionel Sambuc<
16994684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
17004684ddb6SLionel Sambuc    void
17014684ddb6SLionel Sambuc>::type
17024684ddb6SLionel Sambucgslice_array<_Tp>::operator^=(const _Expr& __v) const
17034684ddb6SLionel Sambuc{
17044684ddb6SLionel Sambuc    typedef const size_t* _Ip;
17054684ddb6SLionel Sambuc    size_t __j = 0;
17064684ddb6SLionel Sambuc    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
17074684ddb6SLionel Sambuc        __vp_[*__i] ^= __v[__j];
17084684ddb6SLionel Sambuc}
17094684ddb6SLionel Sambuc
17104684ddb6SLionel Sambuctemplate <class _Tp>
17114684ddb6SLionel Sambuctemplate <class _Expr>
17124684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
17134684ddb6SLionel Sambuctypename enable_if
17144684ddb6SLionel Sambuc<
17154684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
17164684ddb6SLionel Sambuc    void
17174684ddb6SLionel Sambuc>::type
17184684ddb6SLionel Sambucgslice_array<_Tp>::operator&=(const _Expr& __v) const
17194684ddb6SLionel Sambuc{
17204684ddb6SLionel Sambuc    typedef const size_t* _Ip;
17214684ddb6SLionel Sambuc    size_t __j = 0;
17224684ddb6SLionel Sambuc    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
17234684ddb6SLionel Sambuc        __vp_[*__i] &= __v[__j];
17244684ddb6SLionel Sambuc}
17254684ddb6SLionel Sambuc
17264684ddb6SLionel Sambuctemplate <class _Tp>
17274684ddb6SLionel Sambuctemplate <class _Expr>
17284684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
17294684ddb6SLionel Sambuctypename enable_if
17304684ddb6SLionel Sambuc<
17314684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
17324684ddb6SLionel Sambuc    void
17334684ddb6SLionel Sambuc>::type
17344684ddb6SLionel Sambucgslice_array<_Tp>::operator|=(const _Expr& __v) const
17354684ddb6SLionel Sambuc{
17364684ddb6SLionel Sambuc    typedef const size_t* _Ip;
17374684ddb6SLionel Sambuc    size_t __j = 0;
17384684ddb6SLionel Sambuc    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
17394684ddb6SLionel Sambuc        __vp_[*__i] |= __v[__j];
17404684ddb6SLionel Sambuc}
17414684ddb6SLionel Sambuc
17424684ddb6SLionel Sambuctemplate <class _Tp>
17434684ddb6SLionel Sambuctemplate <class _Expr>
17444684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
17454684ddb6SLionel Sambuctypename enable_if
17464684ddb6SLionel Sambuc<
17474684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
17484684ddb6SLionel Sambuc    void
17494684ddb6SLionel Sambuc>::type
17504684ddb6SLionel Sambucgslice_array<_Tp>::operator<<=(const _Expr& __v) const
17514684ddb6SLionel Sambuc{
17524684ddb6SLionel Sambuc    typedef const size_t* _Ip;
17534684ddb6SLionel Sambuc    size_t __j = 0;
17544684ddb6SLionel Sambuc    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
17554684ddb6SLionel Sambuc        __vp_[*__i] <<= __v[__j];
17564684ddb6SLionel Sambuc}
17574684ddb6SLionel Sambuc
17584684ddb6SLionel Sambuctemplate <class _Tp>
17594684ddb6SLionel Sambuctemplate <class _Expr>
17604684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
17614684ddb6SLionel Sambuctypename enable_if
17624684ddb6SLionel Sambuc<
17634684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
17644684ddb6SLionel Sambuc    void
17654684ddb6SLionel Sambuc>::type
17664684ddb6SLionel Sambucgslice_array<_Tp>::operator>>=(const _Expr& __v) const
17674684ddb6SLionel Sambuc{
17684684ddb6SLionel Sambuc    typedef const size_t* _Ip;
17694684ddb6SLionel Sambuc    size_t __j = 0;
17704684ddb6SLionel Sambuc    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
17714684ddb6SLionel Sambuc        __vp_[*__i] >>= __v[__j];
17724684ddb6SLionel Sambuc}
17734684ddb6SLionel Sambuc
17744684ddb6SLionel Sambuctemplate <class _Tp>
17754684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
17764684ddb6SLionel Sambucconst gslice_array<_Tp>&
17774684ddb6SLionel Sambucgslice_array<_Tp>::operator=(const gslice_array& __ga) const
17784684ddb6SLionel Sambuc{
17794684ddb6SLionel Sambuc    typedef const size_t* _Ip;
17804684ddb6SLionel Sambuc    const value_type* __s = __ga.__vp_;
17814684ddb6SLionel Sambuc    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ga.__1d_.__begin_;
17824684ddb6SLionel Sambuc            __i != __e; ++__i, ++__j)
17834684ddb6SLionel Sambuc        __vp_[*__i] = __s[*__j];
17844684ddb6SLionel Sambuc    return *this;
17854684ddb6SLionel Sambuc}
17864684ddb6SLionel Sambuc
17874684ddb6SLionel Sambuctemplate <class _Tp>
17884684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
17894684ddb6SLionel Sambucvoid
17904684ddb6SLionel Sambucgslice_array<_Tp>::operator=(const value_type& __x) const
17914684ddb6SLionel Sambuc{
17924684ddb6SLionel Sambuc    typedef const size_t* _Ip;
17934684ddb6SLionel Sambuc    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
17944684ddb6SLionel Sambuc        __vp_[*__i] = __x;
17954684ddb6SLionel Sambuc}
17964684ddb6SLionel Sambuc
17974684ddb6SLionel Sambuc// mask_array
17984684ddb6SLionel Sambuc
17994684ddb6SLionel Sambuctemplate <class _Tp>
18004684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY mask_array
18014684ddb6SLionel Sambuc{
18024684ddb6SLionel Sambucpublic:
18034684ddb6SLionel Sambuc    typedef _Tp value_type;
18044684ddb6SLionel Sambuc
18054684ddb6SLionel Sambucprivate:
18064684ddb6SLionel Sambuc    value_type*      __vp_;
18074684ddb6SLionel Sambuc    valarray<size_t> __1d_;
18084684ddb6SLionel Sambuc
18094684ddb6SLionel Sambucpublic:
18104684ddb6SLionel Sambuc    template <class _Expr>
18114684ddb6SLionel Sambuc    typename enable_if
18124684ddb6SLionel Sambuc    <
18134684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
18144684ddb6SLionel Sambuc        void
18154684ddb6SLionel Sambuc    >::type
18164684ddb6SLionel Sambuc    operator=(const _Expr& __v) const;
18174684ddb6SLionel Sambuc
18184684ddb6SLionel Sambuc    template <class _Expr>
18194684ddb6SLionel Sambuc    typename enable_if
18204684ddb6SLionel Sambuc    <
18214684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
18224684ddb6SLionel Sambuc        void
18234684ddb6SLionel Sambuc    >::type
18244684ddb6SLionel Sambuc    operator*=(const _Expr& __v) const;
18254684ddb6SLionel Sambuc
18264684ddb6SLionel Sambuc    template <class _Expr>
18274684ddb6SLionel Sambuc    typename enable_if
18284684ddb6SLionel Sambuc    <
18294684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
18304684ddb6SLionel Sambuc        void
18314684ddb6SLionel Sambuc    >::type
18324684ddb6SLionel Sambuc    operator/=(const _Expr& __v) const;
18334684ddb6SLionel Sambuc
18344684ddb6SLionel Sambuc    template <class _Expr>
18354684ddb6SLionel Sambuc    typename enable_if
18364684ddb6SLionel Sambuc    <
18374684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
18384684ddb6SLionel Sambuc        void
18394684ddb6SLionel Sambuc    >::type
18404684ddb6SLionel Sambuc    operator%=(const _Expr& __v) const;
18414684ddb6SLionel Sambuc
18424684ddb6SLionel Sambuc    template <class _Expr>
18434684ddb6SLionel Sambuc    typename enable_if
18444684ddb6SLionel Sambuc    <
18454684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
18464684ddb6SLionel Sambuc        void
18474684ddb6SLionel Sambuc    >::type
18484684ddb6SLionel Sambuc    operator+=(const _Expr& __v) const;
18494684ddb6SLionel Sambuc
18504684ddb6SLionel Sambuc    template <class _Expr>
18514684ddb6SLionel Sambuc    typename enable_if
18524684ddb6SLionel Sambuc    <
18534684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
18544684ddb6SLionel Sambuc        void
18554684ddb6SLionel Sambuc    >::type
18564684ddb6SLionel Sambuc    operator-=(const _Expr& __v) const;
18574684ddb6SLionel Sambuc
18584684ddb6SLionel Sambuc    template <class _Expr>
18594684ddb6SLionel Sambuc    typename enable_if
18604684ddb6SLionel Sambuc    <
18614684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
18624684ddb6SLionel Sambuc        void
18634684ddb6SLionel Sambuc    >::type
18644684ddb6SLionel Sambuc    operator^=(const _Expr& __v) const;
18654684ddb6SLionel Sambuc
18664684ddb6SLionel Sambuc    template <class _Expr>
18674684ddb6SLionel Sambuc    typename enable_if
18684684ddb6SLionel Sambuc    <
18694684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
18704684ddb6SLionel Sambuc        void
18714684ddb6SLionel Sambuc    >::type
18724684ddb6SLionel Sambuc    operator&=(const _Expr& __v) const;
18734684ddb6SLionel Sambuc
18744684ddb6SLionel Sambuc    template <class _Expr>
18754684ddb6SLionel Sambuc    typename enable_if
18764684ddb6SLionel Sambuc    <
18774684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
18784684ddb6SLionel Sambuc        void
18794684ddb6SLionel Sambuc    >::type
18804684ddb6SLionel Sambuc    operator|=(const _Expr& __v) const;
18814684ddb6SLionel Sambuc
18824684ddb6SLionel Sambuc    template <class _Expr>
18834684ddb6SLionel Sambuc    typename enable_if
18844684ddb6SLionel Sambuc    <
18854684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
18864684ddb6SLionel Sambuc        void
18874684ddb6SLionel Sambuc    >::type
18884684ddb6SLionel Sambuc    operator<<=(const _Expr& __v) const;
18894684ddb6SLionel Sambuc
18904684ddb6SLionel Sambuc    template <class _Expr>
18914684ddb6SLionel Sambuc    typename enable_if
18924684ddb6SLionel Sambuc    <
18934684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
18944684ddb6SLionel Sambuc        void
18954684ddb6SLionel Sambuc    >::type
18964684ddb6SLionel Sambuc    operator>>=(const _Expr& __v) const;
18974684ddb6SLionel Sambuc
18984684ddb6SLionel Sambuc    const mask_array& operator=(const mask_array& __ma) const;
18994684ddb6SLionel Sambuc
19004684ddb6SLionel Sambuc    void operator=(const value_type& __x) const;
19014684ddb6SLionel Sambuc
19024684ddb6SLionel Sambuc//  mask_array(const mask_array&)            = default;
19034684ddb6SLionel Sambuc//  mask_array(mask_array&&)                 = default;
19044684ddb6SLionel Sambuc//  mask_array& operator=(const mask_array&) = default;
19054684ddb6SLionel Sambuc//  mask_array& operator=(mask_array&&)      = default;
19064684ddb6SLionel Sambuc
19074684ddb6SLionel Sambucprivate:
19084684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
19094684ddb6SLionel Sambuc    mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v)
19104684ddb6SLionel Sambuc        : __vp_(const_cast<value_type*>(__v.__begin_)),
19114684ddb6SLionel Sambuc          __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
19124684ddb6SLionel Sambuc          {
19134684ddb6SLionel Sambuc              size_t __j = 0;
19144684ddb6SLionel Sambuc              for (size_t __i = 0; __i < __vb.size(); ++__i)
19154684ddb6SLionel Sambuc                  if (__vb[__i])
19164684ddb6SLionel Sambuc                      __1d_[__j++] = __i;
19174684ddb6SLionel Sambuc          }
19184684ddb6SLionel Sambuc
19194684ddb6SLionel Sambuc    template <class> friend class valarray;
19204684ddb6SLionel Sambuc};
19214684ddb6SLionel Sambuc
19224684ddb6SLionel Sambuctemplate <class _Tp>
19234684ddb6SLionel Sambuctemplate <class _Expr>
19244684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
19254684ddb6SLionel Sambuctypename enable_if
19264684ddb6SLionel Sambuc<
19274684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
19284684ddb6SLionel Sambuc    void
19294684ddb6SLionel Sambuc>::type
19304684ddb6SLionel Sambucmask_array<_Tp>::operator=(const _Expr& __v) const
19314684ddb6SLionel Sambuc{
19324684ddb6SLionel Sambuc    size_t __n = __1d_.size();
19334684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
19344684ddb6SLionel Sambuc        __vp_[__1d_[__i]] = __v[__i];
19354684ddb6SLionel Sambuc}
19364684ddb6SLionel Sambuc
19374684ddb6SLionel Sambuctemplate <class _Tp>
19384684ddb6SLionel Sambuctemplate <class _Expr>
19394684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
19404684ddb6SLionel Sambuctypename enable_if
19414684ddb6SLionel Sambuc<
19424684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
19434684ddb6SLionel Sambuc    void
19444684ddb6SLionel Sambuc>::type
19454684ddb6SLionel Sambucmask_array<_Tp>::operator*=(const _Expr& __v) const
19464684ddb6SLionel Sambuc{
19474684ddb6SLionel Sambuc    size_t __n = __1d_.size();
19484684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
19494684ddb6SLionel Sambuc        __vp_[__1d_[__i]] *= __v[__i];
19504684ddb6SLionel Sambuc}
19514684ddb6SLionel Sambuc
19524684ddb6SLionel Sambuctemplate <class _Tp>
19534684ddb6SLionel Sambuctemplate <class _Expr>
19544684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
19554684ddb6SLionel Sambuctypename enable_if
19564684ddb6SLionel Sambuc<
19574684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
19584684ddb6SLionel Sambuc    void
19594684ddb6SLionel Sambuc>::type
19604684ddb6SLionel Sambucmask_array<_Tp>::operator/=(const _Expr& __v) const
19614684ddb6SLionel Sambuc{
19624684ddb6SLionel Sambuc    size_t __n = __1d_.size();
19634684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
19644684ddb6SLionel Sambuc        __vp_[__1d_[__i]] /= __v[__i];
19654684ddb6SLionel Sambuc}
19664684ddb6SLionel Sambuc
19674684ddb6SLionel Sambuctemplate <class _Tp>
19684684ddb6SLionel Sambuctemplate <class _Expr>
19694684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
19704684ddb6SLionel Sambuctypename enable_if
19714684ddb6SLionel Sambuc<
19724684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
19734684ddb6SLionel Sambuc    void
19744684ddb6SLionel Sambuc>::type
19754684ddb6SLionel Sambucmask_array<_Tp>::operator%=(const _Expr& __v) const
19764684ddb6SLionel Sambuc{
19774684ddb6SLionel Sambuc    size_t __n = __1d_.size();
19784684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
19794684ddb6SLionel Sambuc        __vp_[__1d_[__i]] %= __v[__i];
19804684ddb6SLionel Sambuc}
19814684ddb6SLionel Sambuc
19824684ddb6SLionel Sambuctemplate <class _Tp>
19834684ddb6SLionel Sambuctemplate <class _Expr>
19844684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
19854684ddb6SLionel Sambuctypename enable_if
19864684ddb6SLionel Sambuc<
19874684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
19884684ddb6SLionel Sambuc    void
19894684ddb6SLionel Sambuc>::type
19904684ddb6SLionel Sambucmask_array<_Tp>::operator+=(const _Expr& __v) const
19914684ddb6SLionel Sambuc{
19924684ddb6SLionel Sambuc    size_t __n = __1d_.size();
19934684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
19944684ddb6SLionel Sambuc        __vp_[__1d_[__i]] += __v[__i];
19954684ddb6SLionel Sambuc}
19964684ddb6SLionel Sambuc
19974684ddb6SLionel Sambuctemplate <class _Tp>
19984684ddb6SLionel Sambuctemplate <class _Expr>
19994684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
20004684ddb6SLionel Sambuctypename enable_if
20014684ddb6SLionel Sambuc<
20024684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
20034684ddb6SLionel Sambuc    void
20044684ddb6SLionel Sambuc>::type
20054684ddb6SLionel Sambucmask_array<_Tp>::operator-=(const _Expr& __v) const
20064684ddb6SLionel Sambuc{
20074684ddb6SLionel Sambuc    size_t __n = __1d_.size();
20084684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
20094684ddb6SLionel Sambuc        __vp_[__1d_[__i]] -= __v[__i];
20104684ddb6SLionel Sambuc}
20114684ddb6SLionel Sambuc
20124684ddb6SLionel Sambuctemplate <class _Tp>
20134684ddb6SLionel Sambuctemplate <class _Expr>
20144684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
20154684ddb6SLionel Sambuctypename enable_if
20164684ddb6SLionel Sambuc<
20174684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
20184684ddb6SLionel Sambuc    void
20194684ddb6SLionel Sambuc>::type
20204684ddb6SLionel Sambucmask_array<_Tp>::operator^=(const _Expr& __v) const
20214684ddb6SLionel Sambuc{
20224684ddb6SLionel Sambuc    size_t __n = __1d_.size();
20234684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
20244684ddb6SLionel Sambuc        __vp_[__1d_[__i]] ^= __v[__i];
20254684ddb6SLionel Sambuc}
20264684ddb6SLionel Sambuc
20274684ddb6SLionel Sambuctemplate <class _Tp>
20284684ddb6SLionel Sambuctemplate <class _Expr>
20294684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
20304684ddb6SLionel Sambuctypename enable_if
20314684ddb6SLionel Sambuc<
20324684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
20334684ddb6SLionel Sambuc    void
20344684ddb6SLionel Sambuc>::type
20354684ddb6SLionel Sambucmask_array<_Tp>::operator&=(const _Expr& __v) const
20364684ddb6SLionel Sambuc{
20374684ddb6SLionel Sambuc    size_t __n = __1d_.size();
20384684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
20394684ddb6SLionel Sambuc        __vp_[__1d_[__i]] &= __v[__i];
20404684ddb6SLionel Sambuc}
20414684ddb6SLionel Sambuc
20424684ddb6SLionel Sambuctemplate <class _Tp>
20434684ddb6SLionel Sambuctemplate <class _Expr>
20444684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
20454684ddb6SLionel Sambuctypename enable_if
20464684ddb6SLionel Sambuc<
20474684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
20484684ddb6SLionel Sambuc    void
20494684ddb6SLionel Sambuc>::type
20504684ddb6SLionel Sambucmask_array<_Tp>::operator|=(const _Expr& __v) const
20514684ddb6SLionel Sambuc{
20524684ddb6SLionel Sambuc    size_t __n = __1d_.size();
20534684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
20544684ddb6SLionel Sambuc        __vp_[__1d_[__i]] |= __v[__i];
20554684ddb6SLionel Sambuc}
20564684ddb6SLionel Sambuc
20574684ddb6SLionel Sambuctemplate <class _Tp>
20584684ddb6SLionel Sambuctemplate <class _Expr>
20594684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
20604684ddb6SLionel Sambuctypename enable_if
20614684ddb6SLionel Sambuc<
20624684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
20634684ddb6SLionel Sambuc    void
20644684ddb6SLionel Sambuc>::type
20654684ddb6SLionel Sambucmask_array<_Tp>::operator<<=(const _Expr& __v) const
20664684ddb6SLionel Sambuc{
20674684ddb6SLionel Sambuc    size_t __n = __1d_.size();
20684684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
20694684ddb6SLionel Sambuc        __vp_[__1d_[__i]] <<= __v[__i];
20704684ddb6SLionel Sambuc}
20714684ddb6SLionel Sambuc
20724684ddb6SLionel Sambuctemplate <class _Tp>
20734684ddb6SLionel Sambuctemplate <class _Expr>
20744684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
20754684ddb6SLionel Sambuctypename enable_if
20764684ddb6SLionel Sambuc<
20774684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
20784684ddb6SLionel Sambuc    void
20794684ddb6SLionel Sambuc>::type
20804684ddb6SLionel Sambucmask_array<_Tp>::operator>>=(const _Expr& __v) const
20814684ddb6SLionel Sambuc{
20824684ddb6SLionel Sambuc    size_t __n = __1d_.size();
20834684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
20844684ddb6SLionel Sambuc        __vp_[__1d_[__i]] >>= __v[__i];
20854684ddb6SLionel Sambuc}
20864684ddb6SLionel Sambuc
20874684ddb6SLionel Sambuctemplate <class _Tp>
20884684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
20894684ddb6SLionel Sambucconst mask_array<_Tp>&
20904684ddb6SLionel Sambucmask_array<_Tp>::operator=(const mask_array& __ma) const
20914684ddb6SLionel Sambuc{
20924684ddb6SLionel Sambuc    size_t __n = __1d_.size();
20934684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
20944684ddb6SLionel Sambuc        __vp_[__1d_[__i]] = __ma.__vp_[__1d_[__i]];
2095*0a6a1f1dSLionel Sambuc    return *this;
20964684ddb6SLionel Sambuc}
20974684ddb6SLionel Sambuc
20984684ddb6SLionel Sambuctemplate <class _Tp>
20994684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
21004684ddb6SLionel Sambucvoid
21014684ddb6SLionel Sambucmask_array<_Tp>::operator=(const value_type& __x) const
21024684ddb6SLionel Sambuc{
21034684ddb6SLionel Sambuc    size_t __n = __1d_.size();
21044684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
21054684ddb6SLionel Sambuc        __vp_[__1d_[__i]] = __x;
21064684ddb6SLionel Sambuc}
21074684ddb6SLionel Sambuc
21084684ddb6SLionel Sambuctemplate <class _ValExpr>
21094684ddb6SLionel Sambucclass __mask_expr
21104684ddb6SLionel Sambuc{
21114684ddb6SLionel Sambuc    typedef typename remove_reference<_ValExpr>::type  _RmExpr;
21124684ddb6SLionel Sambucpublic:
21134684ddb6SLionel Sambuc    typedef typename _RmExpr::value_type value_type;
21144684ddb6SLionel Sambuc    typedef value_type result_type;
21154684ddb6SLionel Sambuc
21164684ddb6SLionel Sambucprivate:
21174684ddb6SLionel Sambuc    _ValExpr __expr_;
21184684ddb6SLionel Sambuc    valarray<size_t> __1d_;
21194684ddb6SLionel Sambuc
21204684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
21214684ddb6SLionel Sambuc    __mask_expr(const valarray<bool>& __vb, const _RmExpr& __e)
21224684ddb6SLionel Sambuc        : __expr_(__e),
21234684ddb6SLionel Sambuc          __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
21244684ddb6SLionel Sambuc          {
21254684ddb6SLionel Sambuc              size_t __j = 0;
21264684ddb6SLionel Sambuc              for (size_t __i = 0; __i < __vb.size(); ++__i)
21274684ddb6SLionel Sambuc                  if (__vb[__i])
21284684ddb6SLionel Sambuc                      __1d_[__j++] = __i;
21294684ddb6SLionel Sambuc          }
21304684ddb6SLionel Sambuc
21314684ddb6SLionel Sambucpublic:
21324684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
21334684ddb6SLionel Sambuc    result_type operator[](size_t __i) const
21344684ddb6SLionel Sambuc        {return __expr_[__1d_[__i]];}
21354684ddb6SLionel Sambuc
21364684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
21374684ddb6SLionel Sambuc    size_t size() const {return __1d_.size();}
21384684ddb6SLionel Sambuc
21394684ddb6SLionel Sambuc    template <class> friend class valarray;
21404684ddb6SLionel Sambuc};
21414684ddb6SLionel Sambuc
21424684ddb6SLionel Sambuc// indirect_array
21434684ddb6SLionel Sambuc
21444684ddb6SLionel Sambuctemplate <class _Tp>
21454684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY indirect_array
21464684ddb6SLionel Sambuc{
21474684ddb6SLionel Sambucpublic:
21484684ddb6SLionel Sambuc    typedef _Tp value_type;
21494684ddb6SLionel Sambuc
21504684ddb6SLionel Sambucprivate:
21514684ddb6SLionel Sambuc    value_type*      __vp_;
21524684ddb6SLionel Sambuc    valarray<size_t> __1d_;
21534684ddb6SLionel Sambuc
21544684ddb6SLionel Sambucpublic:
21554684ddb6SLionel Sambuc    template <class _Expr>
21564684ddb6SLionel Sambuc    typename enable_if
21574684ddb6SLionel Sambuc    <
21584684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
21594684ddb6SLionel Sambuc        void
21604684ddb6SLionel Sambuc    >::type
21614684ddb6SLionel Sambuc    operator=(const _Expr& __v) const;
21624684ddb6SLionel Sambuc
21634684ddb6SLionel Sambuc    template <class _Expr>
21644684ddb6SLionel Sambuc    typename enable_if
21654684ddb6SLionel Sambuc    <
21664684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
21674684ddb6SLionel Sambuc        void
21684684ddb6SLionel Sambuc    >::type
21694684ddb6SLionel Sambuc    operator*=(const _Expr& __v) const;
21704684ddb6SLionel Sambuc
21714684ddb6SLionel Sambuc    template <class _Expr>
21724684ddb6SLionel Sambuc    typename enable_if
21734684ddb6SLionel Sambuc    <
21744684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
21754684ddb6SLionel Sambuc        void
21764684ddb6SLionel Sambuc    >::type
21774684ddb6SLionel Sambuc    operator/=(const _Expr& __v) const;
21784684ddb6SLionel Sambuc
21794684ddb6SLionel Sambuc    template <class _Expr>
21804684ddb6SLionel Sambuc    typename enable_if
21814684ddb6SLionel Sambuc    <
21824684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
21834684ddb6SLionel Sambuc        void
21844684ddb6SLionel Sambuc    >::type
21854684ddb6SLionel Sambuc    operator%=(const _Expr& __v) const;
21864684ddb6SLionel Sambuc
21874684ddb6SLionel Sambuc    template <class _Expr>
21884684ddb6SLionel Sambuc    typename enable_if
21894684ddb6SLionel Sambuc    <
21904684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
21914684ddb6SLionel Sambuc        void
21924684ddb6SLionel Sambuc    >::type
21934684ddb6SLionel Sambuc    operator+=(const _Expr& __v) const;
21944684ddb6SLionel Sambuc
21954684ddb6SLionel Sambuc    template <class _Expr>
21964684ddb6SLionel Sambuc    typename enable_if
21974684ddb6SLionel Sambuc    <
21984684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
21994684ddb6SLionel Sambuc        void
22004684ddb6SLionel Sambuc    >::type
22014684ddb6SLionel Sambuc    operator-=(const _Expr& __v) const;
22024684ddb6SLionel Sambuc
22034684ddb6SLionel Sambuc    template <class _Expr>
22044684ddb6SLionel Sambuc    typename enable_if
22054684ddb6SLionel Sambuc    <
22064684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
22074684ddb6SLionel Sambuc        void
22084684ddb6SLionel Sambuc    >::type
22094684ddb6SLionel Sambuc    operator^=(const _Expr& __v) const;
22104684ddb6SLionel Sambuc
22114684ddb6SLionel Sambuc    template <class _Expr>
22124684ddb6SLionel Sambuc    typename enable_if
22134684ddb6SLionel Sambuc    <
22144684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
22154684ddb6SLionel Sambuc        void
22164684ddb6SLionel Sambuc    >::type
22174684ddb6SLionel Sambuc    operator&=(const _Expr& __v) const;
22184684ddb6SLionel Sambuc
22194684ddb6SLionel Sambuc    template <class _Expr>
22204684ddb6SLionel Sambuc    typename enable_if
22214684ddb6SLionel Sambuc    <
22224684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
22234684ddb6SLionel Sambuc        void
22244684ddb6SLionel Sambuc    >::type
22254684ddb6SLionel Sambuc    operator|=(const _Expr& __v) const;
22264684ddb6SLionel Sambuc
22274684ddb6SLionel Sambuc    template <class _Expr>
22284684ddb6SLionel Sambuc    typename enable_if
22294684ddb6SLionel Sambuc    <
22304684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
22314684ddb6SLionel Sambuc        void
22324684ddb6SLionel Sambuc    >::type
22334684ddb6SLionel Sambuc    operator<<=(const _Expr& __v) const;
22344684ddb6SLionel Sambuc
22354684ddb6SLionel Sambuc    template <class _Expr>
22364684ddb6SLionel Sambuc    typename enable_if
22374684ddb6SLionel Sambuc    <
22384684ddb6SLionel Sambuc        __is_val_expr<_Expr>::value,
22394684ddb6SLionel Sambuc        void
22404684ddb6SLionel Sambuc    >::type
22414684ddb6SLionel Sambuc    operator>>=(const _Expr& __v) const;
22424684ddb6SLionel Sambuc
22434684ddb6SLionel Sambuc    const indirect_array& operator=(const indirect_array& __ia) const;
22444684ddb6SLionel Sambuc
22454684ddb6SLionel Sambuc    void operator=(const value_type& __x) const;
22464684ddb6SLionel Sambuc
22474684ddb6SLionel Sambuc//  indirect_array(const indirect_array&)            = default;
22484684ddb6SLionel Sambuc//  indirect_array(indirect_array&&)                 = default;
22494684ddb6SLionel Sambuc//  indirect_array& operator=(const indirect_array&) = default;
22504684ddb6SLionel Sambuc//  indirect_array& operator=(indirect_array&&)      = default;
22514684ddb6SLionel Sambuc
22524684ddb6SLionel Sambucprivate:
22534684ddb6SLionel Sambuc     _LIBCPP_INLINE_VISIBILITY
22544684ddb6SLionel Sambuc   indirect_array(const valarray<size_t>& __ia, const valarray<value_type>& __v)
22554684ddb6SLionel Sambuc        : __vp_(const_cast<value_type*>(__v.__begin_)),
22564684ddb6SLionel Sambuc          __1d_(__ia)
22574684ddb6SLionel Sambuc        {}
22584684ddb6SLionel Sambuc
22594684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
22604684ddb6SLionel Sambuc
22614684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
22624684ddb6SLionel Sambuc    indirect_array(valarray<size_t>&& __ia, const valarray<value_type>& __v)
22634684ddb6SLionel Sambuc        : __vp_(const_cast<value_type*>(__v.__begin_)),
22644684ddb6SLionel Sambuc          __1d_(move(__ia))
22654684ddb6SLionel Sambuc        {}
22664684ddb6SLionel Sambuc
22674684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
22684684ddb6SLionel Sambuc
22694684ddb6SLionel Sambuc    template <class> friend class valarray;
22704684ddb6SLionel Sambuc};
22714684ddb6SLionel Sambuc
22724684ddb6SLionel Sambuctemplate <class _Tp>
22734684ddb6SLionel Sambuctemplate <class _Expr>
22744684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
22754684ddb6SLionel Sambuctypename enable_if
22764684ddb6SLionel Sambuc<
22774684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
22784684ddb6SLionel Sambuc    void
22794684ddb6SLionel Sambuc>::type
22804684ddb6SLionel Sambucindirect_array<_Tp>::operator=(const _Expr& __v) const
22814684ddb6SLionel Sambuc{
22824684ddb6SLionel Sambuc    size_t __n = __1d_.size();
22834684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
22844684ddb6SLionel Sambuc        __vp_[__1d_[__i]] = __v[__i];
22854684ddb6SLionel Sambuc}
22864684ddb6SLionel Sambuc
22874684ddb6SLionel Sambuctemplate <class _Tp>
22884684ddb6SLionel Sambuctemplate <class _Expr>
22894684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
22904684ddb6SLionel Sambuctypename enable_if
22914684ddb6SLionel Sambuc<
22924684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
22934684ddb6SLionel Sambuc    void
22944684ddb6SLionel Sambuc>::type
22954684ddb6SLionel Sambucindirect_array<_Tp>::operator*=(const _Expr& __v) const
22964684ddb6SLionel Sambuc{
22974684ddb6SLionel Sambuc    size_t __n = __1d_.size();
22984684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
22994684ddb6SLionel Sambuc        __vp_[__1d_[__i]] *= __v[__i];
23004684ddb6SLionel Sambuc}
23014684ddb6SLionel Sambuc
23024684ddb6SLionel Sambuctemplate <class _Tp>
23034684ddb6SLionel Sambuctemplate <class _Expr>
23044684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
23054684ddb6SLionel Sambuctypename enable_if
23064684ddb6SLionel Sambuc<
23074684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
23084684ddb6SLionel Sambuc    void
23094684ddb6SLionel Sambuc>::type
23104684ddb6SLionel Sambucindirect_array<_Tp>::operator/=(const _Expr& __v) const
23114684ddb6SLionel Sambuc{
23124684ddb6SLionel Sambuc    size_t __n = __1d_.size();
23134684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
23144684ddb6SLionel Sambuc        __vp_[__1d_[__i]] /= __v[__i];
23154684ddb6SLionel Sambuc}
23164684ddb6SLionel Sambuc
23174684ddb6SLionel Sambuctemplate <class _Tp>
23184684ddb6SLionel Sambuctemplate <class _Expr>
23194684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
23204684ddb6SLionel Sambuctypename enable_if
23214684ddb6SLionel Sambuc<
23224684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
23234684ddb6SLionel Sambuc    void
23244684ddb6SLionel Sambuc>::type
23254684ddb6SLionel Sambucindirect_array<_Tp>::operator%=(const _Expr& __v) const
23264684ddb6SLionel Sambuc{
23274684ddb6SLionel Sambuc    size_t __n = __1d_.size();
23284684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
23294684ddb6SLionel Sambuc        __vp_[__1d_[__i]] %= __v[__i];
23304684ddb6SLionel Sambuc}
23314684ddb6SLionel Sambuc
23324684ddb6SLionel Sambuctemplate <class _Tp>
23334684ddb6SLionel Sambuctemplate <class _Expr>
23344684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
23354684ddb6SLionel Sambuctypename enable_if
23364684ddb6SLionel Sambuc<
23374684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
23384684ddb6SLionel Sambuc    void
23394684ddb6SLionel Sambuc>::type
23404684ddb6SLionel Sambucindirect_array<_Tp>::operator+=(const _Expr& __v) const
23414684ddb6SLionel Sambuc{
23424684ddb6SLionel Sambuc    size_t __n = __1d_.size();
23434684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
23444684ddb6SLionel Sambuc        __vp_[__1d_[__i]] += __v[__i];
23454684ddb6SLionel Sambuc}
23464684ddb6SLionel Sambuc
23474684ddb6SLionel Sambuctemplate <class _Tp>
23484684ddb6SLionel Sambuctemplate <class _Expr>
23494684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
23504684ddb6SLionel Sambuctypename enable_if
23514684ddb6SLionel Sambuc<
23524684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
23534684ddb6SLionel Sambuc    void
23544684ddb6SLionel Sambuc>::type
23554684ddb6SLionel Sambucindirect_array<_Tp>::operator-=(const _Expr& __v) const
23564684ddb6SLionel Sambuc{
23574684ddb6SLionel Sambuc    size_t __n = __1d_.size();
23584684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
23594684ddb6SLionel Sambuc        __vp_[__1d_[__i]] -= __v[__i];
23604684ddb6SLionel Sambuc}
23614684ddb6SLionel Sambuc
23624684ddb6SLionel Sambuctemplate <class _Tp>
23634684ddb6SLionel Sambuctemplate <class _Expr>
23644684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
23654684ddb6SLionel Sambuctypename enable_if
23664684ddb6SLionel Sambuc<
23674684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
23684684ddb6SLionel Sambuc    void
23694684ddb6SLionel Sambuc>::type
23704684ddb6SLionel Sambucindirect_array<_Tp>::operator^=(const _Expr& __v) const
23714684ddb6SLionel Sambuc{
23724684ddb6SLionel Sambuc    size_t __n = __1d_.size();
23734684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
23744684ddb6SLionel Sambuc        __vp_[__1d_[__i]] ^= __v[__i];
23754684ddb6SLionel Sambuc}
23764684ddb6SLionel Sambuc
23774684ddb6SLionel Sambuctemplate <class _Tp>
23784684ddb6SLionel Sambuctemplate <class _Expr>
23794684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
23804684ddb6SLionel Sambuctypename enable_if
23814684ddb6SLionel Sambuc<
23824684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
23834684ddb6SLionel Sambuc    void
23844684ddb6SLionel Sambuc>::type
23854684ddb6SLionel Sambucindirect_array<_Tp>::operator&=(const _Expr& __v) const
23864684ddb6SLionel Sambuc{
23874684ddb6SLionel Sambuc    size_t __n = __1d_.size();
23884684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
23894684ddb6SLionel Sambuc        __vp_[__1d_[__i]] &= __v[__i];
23904684ddb6SLionel Sambuc}
23914684ddb6SLionel Sambuc
23924684ddb6SLionel Sambuctemplate <class _Tp>
23934684ddb6SLionel Sambuctemplate <class _Expr>
23944684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
23954684ddb6SLionel Sambuctypename enable_if
23964684ddb6SLionel Sambuc<
23974684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
23984684ddb6SLionel Sambuc    void
23994684ddb6SLionel Sambuc>::type
24004684ddb6SLionel Sambucindirect_array<_Tp>::operator|=(const _Expr& __v) const
24014684ddb6SLionel Sambuc{
24024684ddb6SLionel Sambuc    size_t __n = __1d_.size();
24034684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
24044684ddb6SLionel Sambuc        __vp_[__1d_[__i]] |= __v[__i];
24054684ddb6SLionel Sambuc}
24064684ddb6SLionel Sambuc
24074684ddb6SLionel Sambuctemplate <class _Tp>
24084684ddb6SLionel Sambuctemplate <class _Expr>
24094684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
24104684ddb6SLionel Sambuctypename enable_if
24114684ddb6SLionel Sambuc<
24124684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
24134684ddb6SLionel Sambuc    void
24144684ddb6SLionel Sambuc>::type
24154684ddb6SLionel Sambucindirect_array<_Tp>::operator<<=(const _Expr& __v) const
24164684ddb6SLionel Sambuc{
24174684ddb6SLionel Sambuc    size_t __n = __1d_.size();
24184684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
24194684ddb6SLionel Sambuc        __vp_[__1d_[__i]] <<= __v[__i];
24204684ddb6SLionel Sambuc}
24214684ddb6SLionel Sambuc
24224684ddb6SLionel Sambuctemplate <class _Tp>
24234684ddb6SLionel Sambuctemplate <class _Expr>
24244684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
24254684ddb6SLionel Sambuctypename enable_if
24264684ddb6SLionel Sambuc<
24274684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
24284684ddb6SLionel Sambuc    void
24294684ddb6SLionel Sambuc>::type
24304684ddb6SLionel Sambucindirect_array<_Tp>::operator>>=(const _Expr& __v) const
24314684ddb6SLionel Sambuc{
24324684ddb6SLionel Sambuc    size_t __n = __1d_.size();
24334684ddb6SLionel Sambuc    for (size_t __i = 0; __i < __n; ++__i)
24344684ddb6SLionel Sambuc        __vp_[__1d_[__i]] >>= __v[__i];
24354684ddb6SLionel Sambuc}
24364684ddb6SLionel Sambuc
24374684ddb6SLionel Sambuctemplate <class _Tp>
24384684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
24394684ddb6SLionel Sambucconst indirect_array<_Tp>&
24404684ddb6SLionel Sambucindirect_array<_Tp>::operator=(const indirect_array& __ia) const
24414684ddb6SLionel Sambuc{
24424684ddb6SLionel Sambuc    typedef const size_t* _Ip;
24434684ddb6SLionel Sambuc    const value_type* __s = __ia.__vp_;
24444684ddb6SLionel Sambuc    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ia.__1d_.__begin_;
24454684ddb6SLionel Sambuc            __i != __e; ++__i, ++__j)
24464684ddb6SLionel Sambuc        __vp_[*__i] = __s[*__j];
24474684ddb6SLionel Sambuc    return *this;
24484684ddb6SLionel Sambuc}
24494684ddb6SLionel Sambuc
24504684ddb6SLionel Sambuctemplate <class _Tp>
24514684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
24524684ddb6SLionel Sambucvoid
24534684ddb6SLionel Sambucindirect_array<_Tp>::operator=(const value_type& __x) const
24544684ddb6SLionel Sambuc{
24554684ddb6SLionel Sambuc    typedef const size_t* _Ip;
24564684ddb6SLionel Sambuc    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
24574684ddb6SLionel Sambuc        __vp_[*__i] = __x;
24584684ddb6SLionel Sambuc}
24594684ddb6SLionel Sambuc
24604684ddb6SLionel Sambuctemplate <class _ValExpr>
24614684ddb6SLionel Sambucclass __indirect_expr
24624684ddb6SLionel Sambuc{
24634684ddb6SLionel Sambuc    typedef typename remove_reference<_ValExpr>::type  _RmExpr;
24644684ddb6SLionel Sambucpublic:
24654684ddb6SLionel Sambuc    typedef typename _RmExpr::value_type value_type;
24664684ddb6SLionel Sambuc    typedef value_type result_type;
24674684ddb6SLionel Sambuc
24684684ddb6SLionel Sambucprivate:
24694684ddb6SLionel Sambuc    _ValExpr __expr_;
24704684ddb6SLionel Sambuc    valarray<size_t> __1d_;
24714684ddb6SLionel Sambuc
24724684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
24734684ddb6SLionel Sambuc    __indirect_expr(const valarray<size_t>& __ia, const _RmExpr& __e)
24744684ddb6SLionel Sambuc        : __expr_(__e),
24754684ddb6SLionel Sambuc          __1d_(__ia)
24764684ddb6SLionel Sambuc          {}
24774684ddb6SLionel Sambuc
24784684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
24794684ddb6SLionel Sambuc
24804684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
24814684ddb6SLionel Sambuc    __indirect_expr(valarray<size_t>&& __ia, const _RmExpr& __e)
24824684ddb6SLionel Sambuc        : __expr_(__e),
24834684ddb6SLionel Sambuc          __1d_(move(__ia))
24844684ddb6SLionel Sambuc          {}
24854684ddb6SLionel Sambuc
24864684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
24874684ddb6SLionel Sambuc
24884684ddb6SLionel Sambucpublic:
24894684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
24904684ddb6SLionel Sambuc    result_type operator[](size_t __i) const
24914684ddb6SLionel Sambuc        {return __expr_[__1d_[__i]];}
24924684ddb6SLionel Sambuc
24934684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
24944684ddb6SLionel Sambuc    size_t size() const {return __1d_.size();}
24954684ddb6SLionel Sambuc
24964684ddb6SLionel Sambuc    template <class> friend class _LIBCPP_TYPE_VIS_ONLY valarray;
24974684ddb6SLionel Sambuc};
24984684ddb6SLionel Sambuc
24994684ddb6SLionel Sambuctemplate<class _ValExpr>
25004684ddb6SLionel Sambucclass __val_expr
25014684ddb6SLionel Sambuc{
25024684ddb6SLionel Sambuc    typedef typename remove_reference<_ValExpr>::type  _RmExpr;
25034684ddb6SLionel Sambuc
25044684ddb6SLionel Sambuc    _ValExpr __expr_;
25054684ddb6SLionel Sambucpublic:
25064684ddb6SLionel Sambuc    typedef typename _RmExpr::value_type value_type;
25074684ddb6SLionel Sambuc    typedef typename _RmExpr::result_type result_type;
25084684ddb6SLionel Sambuc
25094684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
25104684ddb6SLionel Sambuc    explicit __val_expr(const _RmExpr& __e) : __expr_(__e) {}
25114684ddb6SLionel Sambuc
25124684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
25134684ddb6SLionel Sambuc    result_type operator[](size_t __i) const
25144684ddb6SLionel Sambuc        {return __expr_[__i];}
25154684ddb6SLionel Sambuc
25164684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
25174684ddb6SLionel Sambuc    __val_expr<__slice_expr<_ValExpr> > operator[](slice __s) const
25184684ddb6SLionel Sambuc        {return __val_expr<__slice_expr<_ValExpr> >(__expr_, __s);}
25194684ddb6SLionel Sambuc
25204684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
25214684ddb6SLionel Sambuc    __val_expr<__indirect_expr<_ValExpr> > operator[](const gslice& __gs) const
25224684ddb6SLionel Sambuc        {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __gs.__1d_);}
25234684ddb6SLionel Sambuc
25244684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
25254684ddb6SLionel Sambuc    __val_expr<__mask_expr<_ValExpr> > operator[](const valarray<bool>& __vb) const
25264684ddb6SLionel Sambuc        {return __val_expr<__mask_expr<_ValExpr> >(__expr_, __vb);}
25274684ddb6SLionel Sambuc
25284684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
25294684ddb6SLionel Sambuc    __val_expr<__indirect_expr<_ValExpr> > operator[](const valarray<size_t>& __vs) const
25304684ddb6SLionel Sambuc        {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __vs);}
25314684ddb6SLionel Sambuc
25324684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
25334684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__unary_plus<value_type>, _ValExpr> >
25344684ddb6SLionel Sambuc    operator+() const
25354684ddb6SLionel Sambuc    {
25364684ddb6SLionel Sambuc        typedef _UnaryOp<__unary_plus<value_type>, _ValExpr> _NewExpr;
25374684ddb6SLionel Sambuc        return __val_expr<_NewExpr>(_NewExpr(__unary_plus<value_type>(), __expr_));
25384684ddb6SLionel Sambuc    }
25394684ddb6SLionel Sambuc
25404684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
25414684ddb6SLionel Sambuc    __val_expr<_UnaryOp<negate<value_type>, _ValExpr> >
25424684ddb6SLionel Sambuc    operator-() const
25434684ddb6SLionel Sambuc    {
25444684ddb6SLionel Sambuc        typedef _UnaryOp<negate<value_type>, _ValExpr> _NewExpr;
25454684ddb6SLionel Sambuc        return __val_expr<_NewExpr>(_NewExpr(negate<value_type>(), __expr_));
25464684ddb6SLionel Sambuc    }
25474684ddb6SLionel Sambuc
25484684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
25494684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__bit_not<value_type>, _ValExpr> >
25504684ddb6SLionel Sambuc    operator~() const
25514684ddb6SLionel Sambuc    {
25524684ddb6SLionel Sambuc        typedef _UnaryOp<__bit_not<value_type>, _ValExpr> _NewExpr;
25534684ddb6SLionel Sambuc        return __val_expr<_NewExpr>(_NewExpr(__bit_not<value_type>(), __expr_));
25544684ddb6SLionel Sambuc    }
25554684ddb6SLionel Sambuc
25564684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
25574684ddb6SLionel Sambuc    __val_expr<_UnaryOp<logical_not<value_type>, _ValExpr> >
25584684ddb6SLionel Sambuc    operator!() const
25594684ddb6SLionel Sambuc    {
25604684ddb6SLionel Sambuc        typedef _UnaryOp<logical_not<value_type>, _ValExpr> _NewExpr;
25614684ddb6SLionel Sambuc        return __val_expr<_NewExpr>(_NewExpr(logical_not<value_type>(), __expr_));
25624684ddb6SLionel Sambuc    }
25634684ddb6SLionel Sambuc
25644684ddb6SLionel Sambuc    operator valarray<result_type>() const;
25654684ddb6SLionel Sambuc
25664684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
25674684ddb6SLionel Sambuc    size_t size() const {return __expr_.size();}
25684684ddb6SLionel Sambuc
25694684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
25704684ddb6SLionel Sambuc    result_type sum() const
25714684ddb6SLionel Sambuc    {
25724684ddb6SLionel Sambuc        size_t __n = __expr_.size();
25734684ddb6SLionel Sambuc        result_type __r = __n ? __expr_[0] : result_type();
25744684ddb6SLionel Sambuc        for (size_t __i = 1; __i < __n; ++__i)
25754684ddb6SLionel Sambuc            __r += __expr_[__i];
25764684ddb6SLionel Sambuc        return __r;
25774684ddb6SLionel Sambuc    }
25784684ddb6SLionel Sambuc
25794684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
25804684ddb6SLionel Sambuc    result_type min() const
25814684ddb6SLionel Sambuc    {
25824684ddb6SLionel Sambuc        size_t __n = size();
25834684ddb6SLionel Sambuc        result_type __r = __n ? (*this)[0] : result_type();
25844684ddb6SLionel Sambuc        for (size_t __i = 1; __i < __n; ++__i)
25854684ddb6SLionel Sambuc        {
25864684ddb6SLionel Sambuc            result_type __x = __expr_[__i];
25874684ddb6SLionel Sambuc            if (__x < __r)
25884684ddb6SLionel Sambuc                __r = __x;
25894684ddb6SLionel Sambuc        }
25904684ddb6SLionel Sambuc        return __r;
25914684ddb6SLionel Sambuc    }
25924684ddb6SLionel Sambuc
25934684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
25944684ddb6SLionel Sambuc    result_type max() const
25954684ddb6SLionel Sambuc    {
25964684ddb6SLionel Sambuc        size_t __n = size();
25974684ddb6SLionel Sambuc        result_type __r = __n ? (*this)[0] : result_type();
25984684ddb6SLionel Sambuc        for (size_t __i = 1; __i < __n; ++__i)
25994684ddb6SLionel Sambuc        {
26004684ddb6SLionel Sambuc            result_type __x = __expr_[__i];
26014684ddb6SLionel Sambuc            if (__r < __x)
26024684ddb6SLionel Sambuc                __r = __x;
26034684ddb6SLionel Sambuc        }
26044684ddb6SLionel Sambuc        return __r;
26054684ddb6SLionel Sambuc    }
26064684ddb6SLionel Sambuc
26074684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
26084684ddb6SLionel Sambuc    __val_expr<__shift_expr<_ValExpr> > shift (int __i) const
26094684ddb6SLionel Sambuc        {return __val_expr<__shift_expr<_ValExpr> >(__shift_expr<_ValExpr>(__i, __expr_));}
26104684ddb6SLionel Sambuc
26114684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
26124684ddb6SLionel Sambuc    __val_expr<__cshift_expr<_ValExpr> > cshift(int __i) const
26134684ddb6SLionel Sambuc        {return __val_expr<__cshift_expr<_ValExpr> >(__cshift_expr<_ValExpr>(__i, __expr_));}
26144684ddb6SLionel Sambuc
26154684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
26164684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(value_type)>, _ValExpr> >
26174684ddb6SLionel Sambuc    apply(value_type __f(value_type)) const
26184684ddb6SLionel Sambuc    {
26194684ddb6SLionel Sambuc        typedef __apply_expr<value_type, value_type(*)(value_type)> _Op;
26204684ddb6SLionel Sambuc        typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
26214684ddb6SLionel Sambuc        return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
26224684ddb6SLionel Sambuc    }
26234684ddb6SLionel Sambuc
26244684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
26254684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(const value_type&)>, _ValExpr> >
26264684ddb6SLionel Sambuc    apply(value_type __f(const value_type&)) const
26274684ddb6SLionel Sambuc    {
26284684ddb6SLionel Sambuc        typedef __apply_expr<value_type, value_type(*)(const value_type&)> _Op;
26294684ddb6SLionel Sambuc        typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
26304684ddb6SLionel Sambuc        return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
26314684ddb6SLionel Sambuc    }
26324684ddb6SLionel Sambuc};
26334684ddb6SLionel Sambuc
26344684ddb6SLionel Sambuctemplate<class _ValExpr>
26354684ddb6SLionel Sambuc__val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const
26364684ddb6SLionel Sambuc{
26374684ddb6SLionel Sambuc    valarray<result_type> __r;
26384684ddb6SLionel Sambuc    size_t __n = __expr_.size();
26394684ddb6SLionel Sambuc    if (__n)
26404684ddb6SLionel Sambuc    {
26414684ddb6SLionel Sambuc        __r.__begin_ =
26424684ddb6SLionel Sambuc            __r.__end_ =
2643*0a6a1f1dSLionel Sambuc                static_cast<result_type*>(_VSTD::__allocate(__n * sizeof(result_type)));
26444684ddb6SLionel Sambuc        for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i)
26454684ddb6SLionel Sambuc            ::new (__r.__end_) result_type(__expr_[__i]);
26464684ddb6SLionel Sambuc    }
26474684ddb6SLionel Sambuc    return __r;
26484684ddb6SLionel Sambuc}
26494684ddb6SLionel Sambuc
26504684ddb6SLionel Sambuc// valarray
26514684ddb6SLionel Sambuc
26524684ddb6SLionel Sambuctemplate <class _Tp>
26534684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
26544684ddb6SLionel Sambucvalarray<_Tp>::valarray(size_t __n)
26554684ddb6SLionel Sambuc    : __begin_(0),
26564684ddb6SLionel Sambuc      __end_(0)
26574684ddb6SLionel Sambuc{
26584684ddb6SLionel Sambuc    resize(__n);
26594684ddb6SLionel Sambuc}
26604684ddb6SLionel Sambuc
26614684ddb6SLionel Sambuctemplate <class _Tp>
26624684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
26634684ddb6SLionel Sambucvalarray<_Tp>::valarray(const value_type& __x, size_t __n)
26644684ddb6SLionel Sambuc    : __begin_(0),
26654684ddb6SLionel Sambuc      __end_(0)
26664684ddb6SLionel Sambuc{
26674684ddb6SLionel Sambuc    resize(__n, __x);
26684684ddb6SLionel Sambuc}
26694684ddb6SLionel Sambuc
26704684ddb6SLionel Sambuctemplate <class _Tp>
26714684ddb6SLionel Sambucvalarray<_Tp>::valarray(const value_type* __p, size_t __n)
26724684ddb6SLionel Sambuc    : __begin_(0),
26734684ddb6SLionel Sambuc      __end_(0)
26744684ddb6SLionel Sambuc{
26754684ddb6SLionel Sambuc    if (__n)
26764684ddb6SLionel Sambuc    {
2677*0a6a1f1dSLionel Sambuc        __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
26784684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS
26794684ddb6SLionel Sambuc        try
26804684ddb6SLionel Sambuc        {
26814684ddb6SLionel Sambuc#endif  // _LIBCPP_NO_EXCEPTIONS
26824684ddb6SLionel Sambuc            for (; __n; ++__end_, ++__p, --__n)
26834684ddb6SLionel Sambuc                ::new (__end_) value_type(*__p);
26844684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS
26854684ddb6SLionel Sambuc        }
26864684ddb6SLionel Sambuc        catch (...)
26874684ddb6SLionel Sambuc        {
26884684ddb6SLionel Sambuc            resize(0);
26894684ddb6SLionel Sambuc            throw;
26904684ddb6SLionel Sambuc        }
26914684ddb6SLionel Sambuc#endif  // _LIBCPP_NO_EXCEPTIONS
26924684ddb6SLionel Sambuc    }
26934684ddb6SLionel Sambuc}
26944684ddb6SLionel Sambuc
26954684ddb6SLionel Sambuctemplate <class _Tp>
26964684ddb6SLionel Sambucvalarray<_Tp>::valarray(const valarray& __v)
26974684ddb6SLionel Sambuc    : __begin_(0),
26984684ddb6SLionel Sambuc      __end_(0)
26994684ddb6SLionel Sambuc{
27004684ddb6SLionel Sambuc    if (__v.size())
27014684ddb6SLionel Sambuc    {
2702*0a6a1f1dSLionel Sambuc        __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__v.size() * sizeof(value_type)));
27034684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS
27044684ddb6SLionel Sambuc        try
27054684ddb6SLionel Sambuc        {
27064684ddb6SLionel Sambuc#endif  // _LIBCPP_NO_EXCEPTIONS
27074684ddb6SLionel Sambuc            for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p)
27084684ddb6SLionel Sambuc                ::new (__end_) value_type(*__p);
27094684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS
27104684ddb6SLionel Sambuc        }
27114684ddb6SLionel Sambuc        catch (...)
27124684ddb6SLionel Sambuc        {
27134684ddb6SLionel Sambuc            resize(0);
27144684ddb6SLionel Sambuc            throw;
27154684ddb6SLionel Sambuc        }
27164684ddb6SLionel Sambuc#endif  // _LIBCPP_NO_EXCEPTIONS
27174684ddb6SLionel Sambuc    }
27184684ddb6SLionel Sambuc}
27194684ddb6SLionel Sambuc
27204684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
27214684ddb6SLionel Sambuc
27224684ddb6SLionel Sambuctemplate <class _Tp>
27234684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
27244684ddb6SLionel Sambucvalarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT
27254684ddb6SLionel Sambuc    : __begin_(__v.__begin_),
27264684ddb6SLionel Sambuc      __end_(__v.__end_)
27274684ddb6SLionel Sambuc{
27284684ddb6SLionel Sambuc    __v.__begin_ = __v.__end_ = nullptr;
27294684ddb6SLionel Sambuc}
27304684ddb6SLionel Sambuc
27314684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
27324684ddb6SLionel Sambuc
27334684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
27344684ddb6SLionel Sambuc
27354684ddb6SLionel Sambuctemplate <class _Tp>
27364684ddb6SLionel Sambucvalarray<_Tp>::valarray(initializer_list<value_type> __il)
27374684ddb6SLionel Sambuc    : __begin_(0),
27384684ddb6SLionel Sambuc      __end_(0)
27394684ddb6SLionel Sambuc{
27404684ddb6SLionel Sambuc    size_t __n = __il.size();
27414684ddb6SLionel Sambuc    if (__n)
27424684ddb6SLionel Sambuc    {
2743*0a6a1f1dSLionel Sambuc        __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
27444684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS
27454684ddb6SLionel Sambuc        try
27464684ddb6SLionel Sambuc        {
27474684ddb6SLionel Sambuc#endif  // _LIBCPP_NO_EXCEPTIONS
27484684ddb6SLionel Sambuc            for (const value_type* __p = __il.begin(); __n; ++__end_, ++__p, --__n)
27494684ddb6SLionel Sambuc                ::new (__end_) value_type(*__p);
27504684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS
27514684ddb6SLionel Sambuc        }
27524684ddb6SLionel Sambuc        catch (...)
27534684ddb6SLionel Sambuc        {
27544684ddb6SLionel Sambuc            resize(0);
27554684ddb6SLionel Sambuc            throw;
27564684ddb6SLionel Sambuc        }
27574684ddb6SLionel Sambuc#endif  // _LIBCPP_NO_EXCEPTIONS
27584684ddb6SLionel Sambuc    }
27594684ddb6SLionel Sambuc}
27604684ddb6SLionel Sambuc
27614684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
27624684ddb6SLionel Sambuc
27634684ddb6SLionel Sambuctemplate <class _Tp>
27644684ddb6SLionel Sambucvalarray<_Tp>::valarray(const slice_array<value_type>& __sa)
27654684ddb6SLionel Sambuc    : __begin_(0),
27664684ddb6SLionel Sambuc      __end_(0)
27674684ddb6SLionel Sambuc{
27684684ddb6SLionel Sambuc    size_t __n = __sa.__size_;
27694684ddb6SLionel Sambuc    if (__n)
27704684ddb6SLionel Sambuc    {
2771*0a6a1f1dSLionel Sambuc        __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
27724684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS
27734684ddb6SLionel Sambuc        try
27744684ddb6SLionel Sambuc        {
27754684ddb6SLionel Sambuc#endif  // _LIBCPP_NO_EXCEPTIONS
27764684ddb6SLionel Sambuc            for (const value_type* __p = __sa.__vp_; __n; ++__end_, __p += __sa.__stride_, --__n)
27774684ddb6SLionel Sambuc                ::new (__end_) value_type(*__p);
27784684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS
27794684ddb6SLionel Sambuc        }
27804684ddb6SLionel Sambuc        catch (...)
27814684ddb6SLionel Sambuc        {
27824684ddb6SLionel Sambuc            resize(0);
27834684ddb6SLionel Sambuc            throw;
27844684ddb6SLionel Sambuc        }
27854684ddb6SLionel Sambuc#endif  // _LIBCPP_NO_EXCEPTIONS
27864684ddb6SLionel Sambuc    }
27874684ddb6SLionel Sambuc}
27884684ddb6SLionel Sambuc
27894684ddb6SLionel Sambuctemplate <class _Tp>
27904684ddb6SLionel Sambucvalarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
27914684ddb6SLionel Sambuc    : __begin_(0),
27924684ddb6SLionel Sambuc      __end_(0)
27934684ddb6SLionel Sambuc{
27944684ddb6SLionel Sambuc    size_t __n = __ga.__1d_.size();
27954684ddb6SLionel Sambuc    if (__n)
27964684ddb6SLionel Sambuc    {
2797*0a6a1f1dSLionel Sambuc        __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
27984684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS
27994684ddb6SLionel Sambuc        try
28004684ddb6SLionel Sambuc        {
28014684ddb6SLionel Sambuc#endif  // _LIBCPP_NO_EXCEPTIONS
28024684ddb6SLionel Sambuc            typedef const size_t* _Ip;
28034684ddb6SLionel Sambuc            const value_type* __s = __ga.__vp_;
28044684ddb6SLionel Sambuc            for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
28054684ddb6SLionel Sambuc                    __i != __e; ++__i, ++__end_)
28064684ddb6SLionel Sambuc                ::new (__end_) value_type(__s[*__i]);
28074684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS
28084684ddb6SLionel Sambuc        }
28094684ddb6SLionel Sambuc        catch (...)
28104684ddb6SLionel Sambuc        {
28114684ddb6SLionel Sambuc            resize(0);
28124684ddb6SLionel Sambuc            throw;
28134684ddb6SLionel Sambuc        }
28144684ddb6SLionel Sambuc#endif  // _LIBCPP_NO_EXCEPTIONS
28154684ddb6SLionel Sambuc    }
28164684ddb6SLionel Sambuc}
28174684ddb6SLionel Sambuc
28184684ddb6SLionel Sambuctemplate <class _Tp>
28194684ddb6SLionel Sambucvalarray<_Tp>::valarray(const mask_array<value_type>& __ma)
28204684ddb6SLionel Sambuc    : __begin_(0),
28214684ddb6SLionel Sambuc      __end_(0)
28224684ddb6SLionel Sambuc{
28234684ddb6SLionel Sambuc    size_t __n = __ma.__1d_.size();
28244684ddb6SLionel Sambuc    if (__n)
28254684ddb6SLionel Sambuc    {
2826*0a6a1f1dSLionel Sambuc        __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
28274684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS
28284684ddb6SLionel Sambuc        try
28294684ddb6SLionel Sambuc        {
28304684ddb6SLionel Sambuc#endif  // _LIBCPP_NO_EXCEPTIONS
28314684ddb6SLionel Sambuc            typedef const size_t* _Ip;
28324684ddb6SLionel Sambuc            const value_type* __s = __ma.__vp_;
28334684ddb6SLionel Sambuc            for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
28344684ddb6SLionel Sambuc                    __i != __e; ++__i, ++__end_)
28354684ddb6SLionel Sambuc                ::new (__end_) value_type(__s[*__i]);
28364684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS
28374684ddb6SLionel Sambuc        }
28384684ddb6SLionel Sambuc        catch (...)
28394684ddb6SLionel Sambuc        {
28404684ddb6SLionel Sambuc            resize(0);
28414684ddb6SLionel Sambuc            throw;
28424684ddb6SLionel Sambuc        }
28434684ddb6SLionel Sambuc#endif  // _LIBCPP_NO_EXCEPTIONS
28444684ddb6SLionel Sambuc    }
28454684ddb6SLionel Sambuc}
28464684ddb6SLionel Sambuc
28474684ddb6SLionel Sambuctemplate <class _Tp>
28484684ddb6SLionel Sambucvalarray<_Tp>::valarray(const indirect_array<value_type>& __ia)
28494684ddb6SLionel Sambuc    : __begin_(0),
28504684ddb6SLionel Sambuc      __end_(0)
28514684ddb6SLionel Sambuc{
28524684ddb6SLionel Sambuc    size_t __n = __ia.__1d_.size();
28534684ddb6SLionel Sambuc    if (__n)
28544684ddb6SLionel Sambuc    {
2855*0a6a1f1dSLionel Sambuc        __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
28564684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS
28574684ddb6SLionel Sambuc        try
28584684ddb6SLionel Sambuc        {
28594684ddb6SLionel Sambuc#endif  // _LIBCPP_NO_EXCEPTIONS
28604684ddb6SLionel Sambuc            typedef const size_t* _Ip;
28614684ddb6SLionel Sambuc            const value_type* __s = __ia.__vp_;
28624684ddb6SLionel Sambuc            for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
28634684ddb6SLionel Sambuc                    __i != __e; ++__i, ++__end_)
28644684ddb6SLionel Sambuc                ::new (__end_) value_type(__s[*__i]);
28654684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS
28664684ddb6SLionel Sambuc        }
28674684ddb6SLionel Sambuc        catch (...)
28684684ddb6SLionel Sambuc        {
28694684ddb6SLionel Sambuc            resize(0);
28704684ddb6SLionel Sambuc            throw;
28714684ddb6SLionel Sambuc        }
28724684ddb6SLionel Sambuc#endif  // _LIBCPP_NO_EXCEPTIONS
28734684ddb6SLionel Sambuc    }
28744684ddb6SLionel Sambuc}
28754684ddb6SLionel Sambuc
28764684ddb6SLionel Sambuctemplate <class _Tp>
28774684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
28784684ddb6SLionel Sambucvalarray<_Tp>::~valarray()
28794684ddb6SLionel Sambuc{
28804684ddb6SLionel Sambuc    resize(0);
28814684ddb6SLionel Sambuc}
28824684ddb6SLionel Sambuc
28834684ddb6SLionel Sambuctemplate <class _Tp>
28844684ddb6SLionel Sambucvalarray<_Tp>&
28854684ddb6SLionel Sambucvalarray<_Tp>::operator=(const valarray& __v)
28864684ddb6SLionel Sambuc{
28874684ddb6SLionel Sambuc    if (this != &__v)
28884684ddb6SLionel Sambuc    {
28894684ddb6SLionel Sambuc        if (size() != __v.size())
28904684ddb6SLionel Sambuc            resize(__v.size());
28914684ddb6SLionel Sambuc        _VSTD::copy(__v.__begin_, __v.__end_, __begin_);
28924684ddb6SLionel Sambuc    }
28934684ddb6SLionel Sambuc    return *this;
28944684ddb6SLionel Sambuc}
28954684ddb6SLionel Sambuc
28964684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
28974684ddb6SLionel Sambuc
28984684ddb6SLionel Sambuctemplate <class _Tp>
28994684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
29004684ddb6SLionel Sambucvalarray<_Tp>&
29014684ddb6SLionel Sambucvalarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT
29024684ddb6SLionel Sambuc{
29034684ddb6SLionel Sambuc    resize(0);
29044684ddb6SLionel Sambuc    __begin_ = __v.__begin_;
29054684ddb6SLionel Sambuc    __end_ = __v.__end_;
29064684ddb6SLionel Sambuc    __v.__begin_ = nullptr;
29074684ddb6SLionel Sambuc    __v.__end_ = nullptr;
29084684ddb6SLionel Sambuc    return *this;
29094684ddb6SLionel Sambuc}
29104684ddb6SLionel Sambuc
29114684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
29124684ddb6SLionel Sambuc
29134684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
29144684ddb6SLionel Sambuc
29154684ddb6SLionel Sambuctemplate <class _Tp>
29164684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
29174684ddb6SLionel Sambucvalarray<_Tp>&
29184684ddb6SLionel Sambucvalarray<_Tp>::operator=(initializer_list<value_type> __il)
29194684ddb6SLionel Sambuc{
29204684ddb6SLionel Sambuc    if (size() != __il.size())
29214684ddb6SLionel Sambuc        resize(__il.size());
29224684ddb6SLionel Sambuc    _VSTD::copy(__il.begin(), __il.end(), __begin_);
29234684ddb6SLionel Sambuc    return *this;
29244684ddb6SLionel Sambuc}
29254684ddb6SLionel Sambuc
29264684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
29274684ddb6SLionel Sambuc
29284684ddb6SLionel Sambuctemplate <class _Tp>
29294684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
29304684ddb6SLionel Sambucvalarray<_Tp>&
29314684ddb6SLionel Sambucvalarray<_Tp>::operator=(const value_type& __x)
29324684ddb6SLionel Sambuc{
29334684ddb6SLionel Sambuc    _VSTD::fill(__begin_, __end_, __x);
29344684ddb6SLionel Sambuc    return *this;
29354684ddb6SLionel Sambuc}
29364684ddb6SLionel Sambuc
29374684ddb6SLionel Sambuctemplate <class _Tp>
29384684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
29394684ddb6SLionel Sambucvalarray<_Tp>&
29404684ddb6SLionel Sambucvalarray<_Tp>::operator=(const slice_array<value_type>& __sa)
29414684ddb6SLionel Sambuc{
29424684ddb6SLionel Sambuc    value_type* __t = __begin_;
29434684ddb6SLionel Sambuc    const value_type* __s = __sa.__vp_;
29444684ddb6SLionel Sambuc    for (size_t __n = __sa.__size_; __n; --__n, __s += __sa.__stride_, ++__t)
29454684ddb6SLionel Sambuc        *__t = *__s;
29464684ddb6SLionel Sambuc    return *this;
29474684ddb6SLionel Sambuc}
29484684ddb6SLionel Sambuc
29494684ddb6SLionel Sambuctemplate <class _Tp>
29504684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
29514684ddb6SLionel Sambucvalarray<_Tp>&
29524684ddb6SLionel Sambucvalarray<_Tp>::operator=(const gslice_array<value_type>& __ga)
29534684ddb6SLionel Sambuc{
29544684ddb6SLionel Sambuc    typedef const size_t* _Ip;
29554684ddb6SLionel Sambuc    value_type* __t = __begin_;
29564684ddb6SLionel Sambuc    const value_type* __s = __ga.__vp_;
29574684ddb6SLionel Sambuc    for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
29584684ddb6SLionel Sambuc                    __i != __e; ++__i, ++__t)
29594684ddb6SLionel Sambuc        *__t = __s[*__i];
29604684ddb6SLionel Sambuc    return *this;
29614684ddb6SLionel Sambuc}
29624684ddb6SLionel Sambuc
29634684ddb6SLionel Sambuctemplate <class _Tp>
29644684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
29654684ddb6SLionel Sambucvalarray<_Tp>&
29664684ddb6SLionel Sambucvalarray<_Tp>::operator=(const mask_array<value_type>& __ma)
29674684ddb6SLionel Sambuc{
29684684ddb6SLionel Sambuc    typedef const size_t* _Ip;
29694684ddb6SLionel Sambuc    value_type* __t = __begin_;
29704684ddb6SLionel Sambuc    const value_type* __s = __ma.__vp_;
29714684ddb6SLionel Sambuc    for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
29724684ddb6SLionel Sambuc                    __i != __e; ++__i, ++__t)
29734684ddb6SLionel Sambuc        *__t = __s[*__i];
29744684ddb6SLionel Sambuc    return *this;
29754684ddb6SLionel Sambuc}
29764684ddb6SLionel Sambuc
29774684ddb6SLionel Sambuctemplate <class _Tp>
29784684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
29794684ddb6SLionel Sambucvalarray<_Tp>&
29804684ddb6SLionel Sambucvalarray<_Tp>::operator=(const indirect_array<value_type>& __ia)
29814684ddb6SLionel Sambuc{
29824684ddb6SLionel Sambuc    typedef const size_t* _Ip;
29834684ddb6SLionel Sambuc    value_type* __t = __begin_;
29844684ddb6SLionel Sambuc    const value_type* __s = __ia.__vp_;
29854684ddb6SLionel Sambuc    for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
29864684ddb6SLionel Sambuc                    __i != __e; ++__i, ++__t)
29874684ddb6SLionel Sambuc        *__t = __s[*__i];
29884684ddb6SLionel Sambuc    return *this;
29894684ddb6SLionel Sambuc}
29904684ddb6SLionel Sambuc
29914684ddb6SLionel Sambuctemplate <class _Tp>
29924684ddb6SLionel Sambuctemplate <class _ValExpr>
29934684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
29944684ddb6SLionel Sambucvalarray<_Tp>&
29954684ddb6SLionel Sambucvalarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v)
29964684ddb6SLionel Sambuc{
29974684ddb6SLionel Sambuc    size_t __n = __v.size();
29984684ddb6SLionel Sambuc    if (size() != __n)
29994684ddb6SLionel Sambuc        resize(__n);
30004684ddb6SLionel Sambuc    value_type* __t = __begin_;
30014684ddb6SLionel Sambuc    for (size_t __i = 0; __i != __n; ++__t, ++__i)
30024684ddb6SLionel Sambuc        *__t = result_type(__v[__i]);
30034684ddb6SLionel Sambuc    return *this;
30044684ddb6SLionel Sambuc}
30054684ddb6SLionel Sambuc
30064684ddb6SLionel Sambuctemplate <class _Tp>
30074684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
30084684ddb6SLionel Sambuc__val_expr<__slice_expr<const valarray<_Tp>&> >
30094684ddb6SLionel Sambucvalarray<_Tp>::operator[](slice __s) const
30104684ddb6SLionel Sambuc{
30114684ddb6SLionel Sambuc    return __val_expr<__slice_expr<const valarray&> >(__slice_expr<const valarray&>(__s, *this));
30124684ddb6SLionel Sambuc}
30134684ddb6SLionel Sambuc
30144684ddb6SLionel Sambuctemplate <class _Tp>
30154684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
30164684ddb6SLionel Sambucslice_array<_Tp>
30174684ddb6SLionel Sambucvalarray<_Tp>::operator[](slice __s)
30184684ddb6SLionel Sambuc{
30194684ddb6SLionel Sambuc    return slice_array<value_type>(__s, *this);
30204684ddb6SLionel Sambuc}
30214684ddb6SLionel Sambuc
30224684ddb6SLionel Sambuctemplate <class _Tp>
30234684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
30244684ddb6SLionel Sambuc__val_expr<__indirect_expr<const valarray<_Tp>&> >
30254684ddb6SLionel Sambucvalarray<_Tp>::operator[](const gslice& __gs) const
30264684ddb6SLionel Sambuc{
30274684ddb6SLionel Sambuc    return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__gs.__1d_, *this));
30284684ddb6SLionel Sambuc}
30294684ddb6SLionel Sambuc
30304684ddb6SLionel Sambuctemplate <class _Tp>
30314684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
30324684ddb6SLionel Sambucgslice_array<_Tp>
30334684ddb6SLionel Sambucvalarray<_Tp>::operator[](const gslice& __gs)
30344684ddb6SLionel Sambuc{
30354684ddb6SLionel Sambuc    return gslice_array<value_type>(__gs, *this);
30364684ddb6SLionel Sambuc}
30374684ddb6SLionel Sambuc
30384684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
30394684ddb6SLionel Sambuc
30404684ddb6SLionel Sambuctemplate <class _Tp>
30414684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
30424684ddb6SLionel Sambuc__val_expr<__indirect_expr<const valarray<_Tp>&> >
30434684ddb6SLionel Sambucvalarray<_Tp>::operator[](gslice&& __gs) const
30444684ddb6SLionel Sambuc{
30454684ddb6SLionel Sambuc    return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__gs.__1d_), *this));
30464684ddb6SLionel Sambuc}
30474684ddb6SLionel Sambuc
30484684ddb6SLionel Sambuctemplate <class _Tp>
30494684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
30504684ddb6SLionel Sambucgslice_array<_Tp>
30514684ddb6SLionel Sambucvalarray<_Tp>::operator[](gslice&& __gs)
30524684ddb6SLionel Sambuc{
30534684ddb6SLionel Sambuc    return gslice_array<value_type>(move(__gs), *this);
30544684ddb6SLionel Sambuc}
30554684ddb6SLionel Sambuc
30564684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
30574684ddb6SLionel Sambuc
30584684ddb6SLionel Sambuctemplate <class _Tp>
30594684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
30604684ddb6SLionel Sambuc__val_expr<__mask_expr<const valarray<_Tp>&> >
30614684ddb6SLionel Sambucvalarray<_Tp>::operator[](const valarray<bool>& __vb) const
30624684ddb6SLionel Sambuc{
30634684ddb6SLionel Sambuc    return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(__vb, *this));
30644684ddb6SLionel Sambuc}
30654684ddb6SLionel Sambuc
30664684ddb6SLionel Sambuctemplate <class _Tp>
30674684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
30684684ddb6SLionel Sambucmask_array<_Tp>
30694684ddb6SLionel Sambucvalarray<_Tp>::operator[](const valarray<bool>& __vb)
30704684ddb6SLionel Sambuc{
30714684ddb6SLionel Sambuc    return mask_array<value_type>(__vb, *this);
30724684ddb6SLionel Sambuc}
30734684ddb6SLionel Sambuc
30744684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
30754684ddb6SLionel Sambuc
30764684ddb6SLionel Sambuctemplate <class _Tp>
30774684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
30784684ddb6SLionel Sambuc__val_expr<__mask_expr<const valarray<_Tp>&> >
30794684ddb6SLionel Sambucvalarray<_Tp>::operator[](valarray<bool>&& __vb) const
30804684ddb6SLionel Sambuc{
30814684ddb6SLionel Sambuc    return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(move(__vb), *this));
30824684ddb6SLionel Sambuc}
30834684ddb6SLionel Sambuc
30844684ddb6SLionel Sambuctemplate <class _Tp>
30854684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
30864684ddb6SLionel Sambucmask_array<_Tp>
30874684ddb6SLionel Sambucvalarray<_Tp>::operator[](valarray<bool>&& __vb)
30884684ddb6SLionel Sambuc{
30894684ddb6SLionel Sambuc    return mask_array<value_type>(move(__vb), *this);
30904684ddb6SLionel Sambuc}
30914684ddb6SLionel Sambuc
30924684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
30934684ddb6SLionel Sambuc
30944684ddb6SLionel Sambuctemplate <class _Tp>
30954684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
30964684ddb6SLionel Sambuc__val_expr<__indirect_expr<const valarray<_Tp>&> >
30974684ddb6SLionel Sambucvalarray<_Tp>::operator[](const valarray<size_t>& __vs) const
30984684ddb6SLionel Sambuc{
30994684ddb6SLionel Sambuc    return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__vs, *this));
31004684ddb6SLionel Sambuc}
31014684ddb6SLionel Sambuc
31024684ddb6SLionel Sambuctemplate <class _Tp>
31034684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
31044684ddb6SLionel Sambucindirect_array<_Tp>
31054684ddb6SLionel Sambucvalarray<_Tp>::operator[](const valarray<size_t>& __vs)
31064684ddb6SLionel Sambuc{
31074684ddb6SLionel Sambuc    return indirect_array<value_type>(__vs, *this);
31084684ddb6SLionel Sambuc}
31094684ddb6SLionel Sambuc
31104684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
31114684ddb6SLionel Sambuc
31124684ddb6SLionel Sambuctemplate <class _Tp>
31134684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
31144684ddb6SLionel Sambuc__val_expr<__indirect_expr<const valarray<_Tp>&> >
31154684ddb6SLionel Sambucvalarray<_Tp>::operator[](valarray<size_t>&& __vs) const
31164684ddb6SLionel Sambuc{
31174684ddb6SLionel Sambuc    return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__vs), *this));
31184684ddb6SLionel Sambuc}
31194684ddb6SLionel Sambuc
31204684ddb6SLionel Sambuctemplate <class _Tp>
31214684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
31224684ddb6SLionel Sambucindirect_array<_Tp>
31234684ddb6SLionel Sambucvalarray<_Tp>::operator[](valarray<size_t>&& __vs)
31244684ddb6SLionel Sambuc{
31254684ddb6SLionel Sambuc    return indirect_array<value_type>(move(__vs), *this);
31264684ddb6SLionel Sambuc}
31274684ddb6SLionel Sambuc
31284684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
31294684ddb6SLionel Sambuc
31304684ddb6SLionel Sambuctemplate <class _Tp>
31314684ddb6SLionel Sambucvalarray<_Tp>
31324684ddb6SLionel Sambucvalarray<_Tp>::operator+() const
31334684ddb6SLionel Sambuc{
31344684ddb6SLionel Sambuc    valarray<value_type> __r;
31354684ddb6SLionel Sambuc    size_t __n = size();
31364684ddb6SLionel Sambuc    if (__n)
31374684ddb6SLionel Sambuc    {
31384684ddb6SLionel Sambuc        __r.__begin_ =
31394684ddb6SLionel Sambuc            __r.__end_ =
3140*0a6a1f1dSLionel Sambuc                static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
31414684ddb6SLionel Sambuc        for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
31424684ddb6SLionel Sambuc            ::new (__r.__end_) value_type(+*__p);
31434684ddb6SLionel Sambuc    }
31444684ddb6SLionel Sambuc    return __r;
31454684ddb6SLionel Sambuc}
31464684ddb6SLionel Sambuc
31474684ddb6SLionel Sambuctemplate <class _Tp>
31484684ddb6SLionel Sambucvalarray<_Tp>
31494684ddb6SLionel Sambucvalarray<_Tp>::operator-() const
31504684ddb6SLionel Sambuc{
31514684ddb6SLionel Sambuc    valarray<value_type> __r;
31524684ddb6SLionel Sambuc    size_t __n = size();
31534684ddb6SLionel Sambuc    if (__n)
31544684ddb6SLionel Sambuc    {
31554684ddb6SLionel Sambuc        __r.__begin_ =
31564684ddb6SLionel Sambuc            __r.__end_ =
3157*0a6a1f1dSLionel Sambuc                static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
31584684ddb6SLionel Sambuc        for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
31594684ddb6SLionel Sambuc            ::new (__r.__end_) value_type(-*__p);
31604684ddb6SLionel Sambuc    }
31614684ddb6SLionel Sambuc    return __r;
31624684ddb6SLionel Sambuc}
31634684ddb6SLionel Sambuc
31644684ddb6SLionel Sambuctemplate <class _Tp>
31654684ddb6SLionel Sambucvalarray<_Tp>
31664684ddb6SLionel Sambucvalarray<_Tp>::operator~() const
31674684ddb6SLionel Sambuc{
31684684ddb6SLionel Sambuc    valarray<value_type> __r;
31694684ddb6SLionel Sambuc    size_t __n = size();
31704684ddb6SLionel Sambuc    if (__n)
31714684ddb6SLionel Sambuc    {
31724684ddb6SLionel Sambuc        __r.__begin_ =
31734684ddb6SLionel Sambuc            __r.__end_ =
3174*0a6a1f1dSLionel Sambuc                static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
31754684ddb6SLionel Sambuc        for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
31764684ddb6SLionel Sambuc            ::new (__r.__end_) value_type(~*__p);
31774684ddb6SLionel Sambuc    }
31784684ddb6SLionel Sambuc    return __r;
31794684ddb6SLionel Sambuc}
31804684ddb6SLionel Sambuc
31814684ddb6SLionel Sambuctemplate <class _Tp>
31824684ddb6SLionel Sambucvalarray<bool>
31834684ddb6SLionel Sambucvalarray<_Tp>::operator!() const
31844684ddb6SLionel Sambuc{
31854684ddb6SLionel Sambuc    valarray<bool> __r;
31864684ddb6SLionel Sambuc    size_t __n = size();
31874684ddb6SLionel Sambuc    if (__n)
31884684ddb6SLionel Sambuc    {
31894684ddb6SLionel Sambuc        __r.__begin_ =
31904684ddb6SLionel Sambuc            __r.__end_ =
3191*0a6a1f1dSLionel Sambuc                static_cast<bool*>(_VSTD::__allocate(__n * sizeof(bool)));
31924684ddb6SLionel Sambuc        for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
31934684ddb6SLionel Sambuc            ::new (__r.__end_) bool(!*__p);
31944684ddb6SLionel Sambuc    }
31954684ddb6SLionel Sambuc    return __r;
31964684ddb6SLionel Sambuc}
31974684ddb6SLionel Sambuc
31984684ddb6SLionel Sambuctemplate <class _Tp>
31994684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
32004684ddb6SLionel Sambucvalarray<_Tp>&
32014684ddb6SLionel Sambucvalarray<_Tp>::operator*=(const value_type& __x)
32024684ddb6SLionel Sambuc{
32034684ddb6SLionel Sambuc    for (value_type* __p = __begin_; __p != __end_; ++__p)
32044684ddb6SLionel Sambuc        *__p *= __x;
32054684ddb6SLionel Sambuc    return *this;
32064684ddb6SLionel Sambuc}
32074684ddb6SLionel Sambuc
32084684ddb6SLionel Sambuctemplate <class _Tp>
32094684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
32104684ddb6SLionel Sambucvalarray<_Tp>&
32114684ddb6SLionel Sambucvalarray<_Tp>::operator/=(const value_type& __x)
32124684ddb6SLionel Sambuc{
32134684ddb6SLionel Sambuc    for (value_type* __p = __begin_; __p != __end_; ++__p)
32144684ddb6SLionel Sambuc        *__p /= __x;
32154684ddb6SLionel Sambuc    return *this;
32164684ddb6SLionel Sambuc}
32174684ddb6SLionel Sambuc
32184684ddb6SLionel Sambuctemplate <class _Tp>
32194684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
32204684ddb6SLionel Sambucvalarray<_Tp>&
32214684ddb6SLionel Sambucvalarray<_Tp>::operator%=(const value_type& __x)
32224684ddb6SLionel Sambuc{
32234684ddb6SLionel Sambuc    for (value_type* __p = __begin_; __p != __end_; ++__p)
32244684ddb6SLionel Sambuc        *__p %= __x;
32254684ddb6SLionel Sambuc    return *this;
32264684ddb6SLionel Sambuc}
32274684ddb6SLionel Sambuc
32284684ddb6SLionel Sambuctemplate <class _Tp>
32294684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
32304684ddb6SLionel Sambucvalarray<_Tp>&
32314684ddb6SLionel Sambucvalarray<_Tp>::operator+=(const value_type& __x)
32324684ddb6SLionel Sambuc{
32334684ddb6SLionel Sambuc    for (value_type* __p = __begin_; __p != __end_; ++__p)
32344684ddb6SLionel Sambuc        *__p += __x;
32354684ddb6SLionel Sambuc    return *this;
32364684ddb6SLionel Sambuc}
32374684ddb6SLionel Sambuc
32384684ddb6SLionel Sambuctemplate <class _Tp>
32394684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
32404684ddb6SLionel Sambucvalarray<_Tp>&
32414684ddb6SLionel Sambucvalarray<_Tp>::operator-=(const value_type& __x)
32424684ddb6SLionel Sambuc{
32434684ddb6SLionel Sambuc    for (value_type* __p = __begin_; __p != __end_; ++__p)
32444684ddb6SLionel Sambuc        *__p -= __x;
32454684ddb6SLionel Sambuc    return *this;
32464684ddb6SLionel Sambuc}
32474684ddb6SLionel Sambuc
32484684ddb6SLionel Sambuctemplate <class _Tp>
32494684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
32504684ddb6SLionel Sambucvalarray<_Tp>&
32514684ddb6SLionel Sambucvalarray<_Tp>::operator^=(const value_type& __x)
32524684ddb6SLionel Sambuc{
32534684ddb6SLionel Sambuc    for (value_type* __p = __begin_; __p != __end_; ++__p)
32544684ddb6SLionel Sambuc        *__p ^= __x;
32554684ddb6SLionel Sambuc    return *this;
32564684ddb6SLionel Sambuc}
32574684ddb6SLionel Sambuc
32584684ddb6SLionel Sambuctemplate <class _Tp>
32594684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
32604684ddb6SLionel Sambucvalarray<_Tp>&
32614684ddb6SLionel Sambucvalarray<_Tp>::operator&=(const value_type& __x)
32624684ddb6SLionel Sambuc{
32634684ddb6SLionel Sambuc    for (value_type* __p = __begin_; __p != __end_; ++__p)
32644684ddb6SLionel Sambuc        *__p &= __x;
32654684ddb6SLionel Sambuc    return *this;
32664684ddb6SLionel Sambuc}
32674684ddb6SLionel Sambuc
32684684ddb6SLionel Sambuctemplate <class _Tp>
32694684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
32704684ddb6SLionel Sambucvalarray<_Tp>&
32714684ddb6SLionel Sambucvalarray<_Tp>::operator|=(const value_type& __x)
32724684ddb6SLionel Sambuc{
32734684ddb6SLionel Sambuc    for (value_type* __p = __begin_; __p != __end_; ++__p)
32744684ddb6SLionel Sambuc        *__p |= __x;
32754684ddb6SLionel Sambuc    return *this;
32764684ddb6SLionel Sambuc}
32774684ddb6SLionel Sambuc
32784684ddb6SLionel Sambuctemplate <class _Tp>
32794684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
32804684ddb6SLionel Sambucvalarray<_Tp>&
32814684ddb6SLionel Sambucvalarray<_Tp>::operator<<=(const value_type& __x)
32824684ddb6SLionel Sambuc{
32834684ddb6SLionel Sambuc    for (value_type* __p = __begin_; __p != __end_; ++__p)
32844684ddb6SLionel Sambuc        *__p <<= __x;
32854684ddb6SLionel Sambuc    return *this;
32864684ddb6SLionel Sambuc}
32874684ddb6SLionel Sambuc
32884684ddb6SLionel Sambuctemplate <class _Tp>
32894684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
32904684ddb6SLionel Sambucvalarray<_Tp>&
32914684ddb6SLionel Sambucvalarray<_Tp>::operator>>=(const value_type& __x)
32924684ddb6SLionel Sambuc{
32934684ddb6SLionel Sambuc    for (value_type* __p = __begin_; __p != __end_; ++__p)
32944684ddb6SLionel Sambuc        *__p >>= __x;
32954684ddb6SLionel Sambuc    return *this;
32964684ddb6SLionel Sambuc}
32974684ddb6SLionel Sambuc
32984684ddb6SLionel Sambuctemplate <class _Tp>
32994684ddb6SLionel Sambuctemplate <class _Expr>
33004684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
33014684ddb6SLionel Sambuctypename enable_if
33024684ddb6SLionel Sambuc<
33034684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
33044684ddb6SLionel Sambuc    valarray<_Tp>&
33054684ddb6SLionel Sambuc>::type
33064684ddb6SLionel Sambucvalarray<_Tp>::operator*=(const _Expr& __v)
33074684ddb6SLionel Sambuc{
33084684ddb6SLionel Sambuc    size_t __i = 0;
33094684ddb6SLionel Sambuc    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
33104684ddb6SLionel Sambuc        *__t *= __v[__i];
33114684ddb6SLionel Sambuc    return *this;
33124684ddb6SLionel Sambuc}
33134684ddb6SLionel Sambuc
33144684ddb6SLionel Sambuctemplate <class _Tp>
33154684ddb6SLionel Sambuctemplate <class _Expr>
33164684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
33174684ddb6SLionel Sambuctypename enable_if
33184684ddb6SLionel Sambuc<
33194684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
33204684ddb6SLionel Sambuc    valarray<_Tp>&
33214684ddb6SLionel Sambuc>::type
33224684ddb6SLionel Sambucvalarray<_Tp>::operator/=(const _Expr& __v)
33234684ddb6SLionel Sambuc{
33244684ddb6SLionel Sambuc    size_t __i = 0;
33254684ddb6SLionel Sambuc    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
33264684ddb6SLionel Sambuc        *__t /= __v[__i];
33274684ddb6SLionel Sambuc    return *this;
33284684ddb6SLionel Sambuc}
33294684ddb6SLionel Sambuc
33304684ddb6SLionel Sambuctemplate <class _Tp>
33314684ddb6SLionel Sambuctemplate <class _Expr>
33324684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
33334684ddb6SLionel Sambuctypename enable_if
33344684ddb6SLionel Sambuc<
33354684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
33364684ddb6SLionel Sambuc    valarray<_Tp>&
33374684ddb6SLionel Sambuc>::type
33384684ddb6SLionel Sambucvalarray<_Tp>::operator%=(const _Expr& __v)
33394684ddb6SLionel Sambuc{
33404684ddb6SLionel Sambuc    size_t __i = 0;
33414684ddb6SLionel Sambuc    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
33424684ddb6SLionel Sambuc        *__t %= __v[__i];
33434684ddb6SLionel Sambuc    return *this;
33444684ddb6SLionel Sambuc}
33454684ddb6SLionel Sambuc
33464684ddb6SLionel Sambuctemplate <class _Tp>
33474684ddb6SLionel Sambuctemplate <class _Expr>
33484684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
33494684ddb6SLionel Sambuctypename enable_if
33504684ddb6SLionel Sambuc<
33514684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
33524684ddb6SLionel Sambuc    valarray<_Tp>&
33534684ddb6SLionel Sambuc>::type
33544684ddb6SLionel Sambucvalarray<_Tp>::operator+=(const _Expr& __v)
33554684ddb6SLionel Sambuc{
33564684ddb6SLionel Sambuc    size_t __i = 0;
33574684ddb6SLionel Sambuc    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
33584684ddb6SLionel Sambuc        *__t += __v[__i];
33594684ddb6SLionel Sambuc    return *this;
33604684ddb6SLionel Sambuc}
33614684ddb6SLionel Sambuc
33624684ddb6SLionel Sambuctemplate <class _Tp>
33634684ddb6SLionel Sambuctemplate <class _Expr>
33644684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
33654684ddb6SLionel Sambuctypename enable_if
33664684ddb6SLionel Sambuc<
33674684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
33684684ddb6SLionel Sambuc    valarray<_Tp>&
33694684ddb6SLionel Sambuc>::type
33704684ddb6SLionel Sambucvalarray<_Tp>::operator-=(const _Expr& __v)
33714684ddb6SLionel Sambuc{
33724684ddb6SLionel Sambuc    size_t __i = 0;
33734684ddb6SLionel Sambuc    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
33744684ddb6SLionel Sambuc        *__t -= __v[__i];
33754684ddb6SLionel Sambuc    return *this;
33764684ddb6SLionel Sambuc}
33774684ddb6SLionel Sambuc
33784684ddb6SLionel Sambuctemplate <class _Tp>
33794684ddb6SLionel Sambuctemplate <class _Expr>
33804684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
33814684ddb6SLionel Sambuctypename enable_if
33824684ddb6SLionel Sambuc<
33834684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
33844684ddb6SLionel Sambuc    valarray<_Tp>&
33854684ddb6SLionel Sambuc>::type
33864684ddb6SLionel Sambucvalarray<_Tp>::operator^=(const _Expr& __v)
33874684ddb6SLionel Sambuc{
33884684ddb6SLionel Sambuc    size_t __i = 0;
33894684ddb6SLionel Sambuc    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
33904684ddb6SLionel Sambuc        *__t ^= __v[__i];
33914684ddb6SLionel Sambuc    return *this;
33924684ddb6SLionel Sambuc}
33934684ddb6SLionel Sambuc
33944684ddb6SLionel Sambuctemplate <class _Tp>
33954684ddb6SLionel Sambuctemplate <class _Expr>
33964684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
33974684ddb6SLionel Sambuctypename enable_if
33984684ddb6SLionel Sambuc<
33994684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
34004684ddb6SLionel Sambuc    valarray<_Tp>&
34014684ddb6SLionel Sambuc>::type
34024684ddb6SLionel Sambucvalarray<_Tp>::operator|=(const _Expr& __v)
34034684ddb6SLionel Sambuc{
34044684ddb6SLionel Sambuc    size_t __i = 0;
34054684ddb6SLionel Sambuc    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
34064684ddb6SLionel Sambuc        *__t |= __v[__i];
34074684ddb6SLionel Sambuc    return *this;
34084684ddb6SLionel Sambuc}
34094684ddb6SLionel Sambuc
34104684ddb6SLionel Sambuctemplate <class _Tp>
34114684ddb6SLionel Sambuctemplate <class _Expr>
34124684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
34134684ddb6SLionel Sambuctypename enable_if
34144684ddb6SLionel Sambuc<
34154684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
34164684ddb6SLionel Sambuc    valarray<_Tp>&
34174684ddb6SLionel Sambuc>::type
34184684ddb6SLionel Sambucvalarray<_Tp>::operator&=(const _Expr& __v)
34194684ddb6SLionel Sambuc{
34204684ddb6SLionel Sambuc    size_t __i = 0;
34214684ddb6SLionel Sambuc    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
34224684ddb6SLionel Sambuc        *__t &= __v[__i];
34234684ddb6SLionel Sambuc    return *this;
34244684ddb6SLionel Sambuc}
34254684ddb6SLionel Sambuc
34264684ddb6SLionel Sambuctemplate <class _Tp>
34274684ddb6SLionel Sambuctemplate <class _Expr>
34284684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
34294684ddb6SLionel Sambuctypename enable_if
34304684ddb6SLionel Sambuc<
34314684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
34324684ddb6SLionel Sambuc    valarray<_Tp>&
34334684ddb6SLionel Sambuc>::type
34344684ddb6SLionel Sambucvalarray<_Tp>::operator<<=(const _Expr& __v)
34354684ddb6SLionel Sambuc{
34364684ddb6SLionel Sambuc    size_t __i = 0;
34374684ddb6SLionel Sambuc    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
34384684ddb6SLionel Sambuc        *__t <<= __v[__i];
34394684ddb6SLionel Sambuc    return *this;
34404684ddb6SLionel Sambuc}
34414684ddb6SLionel Sambuc
34424684ddb6SLionel Sambuctemplate <class _Tp>
34434684ddb6SLionel Sambuctemplate <class _Expr>
34444684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
34454684ddb6SLionel Sambuctypename enable_if
34464684ddb6SLionel Sambuc<
34474684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
34484684ddb6SLionel Sambuc    valarray<_Tp>&
34494684ddb6SLionel Sambuc>::type
34504684ddb6SLionel Sambucvalarray<_Tp>::operator>>=(const _Expr& __v)
34514684ddb6SLionel Sambuc{
34524684ddb6SLionel Sambuc    size_t __i = 0;
34534684ddb6SLionel Sambuc    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
34544684ddb6SLionel Sambuc        *__t >>= __v[__i];
34554684ddb6SLionel Sambuc    return *this;
34564684ddb6SLionel Sambuc}
34574684ddb6SLionel Sambuc
34584684ddb6SLionel Sambuctemplate <class _Tp>
34594684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
34604684ddb6SLionel Sambucvoid
34614684ddb6SLionel Sambucvalarray<_Tp>::swap(valarray& __v) _NOEXCEPT
34624684ddb6SLionel Sambuc{
34634684ddb6SLionel Sambuc    _VSTD::swap(__begin_, __v.__begin_);
34644684ddb6SLionel Sambuc    _VSTD::swap(__end_, __v.__end_);
34654684ddb6SLionel Sambuc}
34664684ddb6SLionel Sambuc
34674684ddb6SLionel Sambuctemplate <class _Tp>
34684684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
34694684ddb6SLionel Sambuc_Tp
34704684ddb6SLionel Sambucvalarray<_Tp>::sum() const
34714684ddb6SLionel Sambuc{
34724684ddb6SLionel Sambuc    if (__begin_ == __end_)
34734684ddb6SLionel Sambuc        return value_type();
34744684ddb6SLionel Sambuc    const value_type* __p = __begin_;
34754684ddb6SLionel Sambuc    _Tp __r = *__p;
34764684ddb6SLionel Sambuc    for (++__p; __p != __end_; ++__p)
34774684ddb6SLionel Sambuc        __r += *__p;
34784684ddb6SLionel Sambuc    return __r;
34794684ddb6SLionel Sambuc}
34804684ddb6SLionel Sambuc
34814684ddb6SLionel Sambuctemplate <class _Tp>
34824684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
34834684ddb6SLionel Sambuc_Tp
34844684ddb6SLionel Sambucvalarray<_Tp>::min() const
34854684ddb6SLionel Sambuc{
34864684ddb6SLionel Sambuc    if (__begin_ == __end_)
34874684ddb6SLionel Sambuc        return value_type();
34884684ddb6SLionel Sambuc    return *_VSTD::min_element(__begin_, __end_);
34894684ddb6SLionel Sambuc}
34904684ddb6SLionel Sambuc
34914684ddb6SLionel Sambuctemplate <class _Tp>
34924684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
34934684ddb6SLionel Sambuc_Tp
34944684ddb6SLionel Sambucvalarray<_Tp>::max() const
34954684ddb6SLionel Sambuc{
34964684ddb6SLionel Sambuc    if (__begin_ == __end_)
34974684ddb6SLionel Sambuc        return value_type();
34984684ddb6SLionel Sambuc    return *_VSTD::max_element(__begin_, __end_);
34994684ddb6SLionel Sambuc}
35004684ddb6SLionel Sambuc
35014684ddb6SLionel Sambuctemplate <class _Tp>
35024684ddb6SLionel Sambucvalarray<_Tp>
35034684ddb6SLionel Sambucvalarray<_Tp>::shift(int __i) const
35044684ddb6SLionel Sambuc{
35054684ddb6SLionel Sambuc    valarray<value_type> __r;
35064684ddb6SLionel Sambuc    size_t __n = size();
35074684ddb6SLionel Sambuc    if (__n)
35084684ddb6SLionel Sambuc    {
35094684ddb6SLionel Sambuc        __r.__begin_ =
35104684ddb6SLionel Sambuc            __r.__end_ =
3511*0a6a1f1dSLionel Sambuc                static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
35124684ddb6SLionel Sambuc        const value_type* __sb;
35134684ddb6SLionel Sambuc        value_type* __tb;
35144684ddb6SLionel Sambuc        value_type* __te;
35154684ddb6SLionel Sambuc        if (__i >= 0)
35164684ddb6SLionel Sambuc        {
35174684ddb6SLionel Sambuc            __i = _VSTD::min(__i, static_cast<int>(__n));
35184684ddb6SLionel Sambuc            __sb = __begin_ + __i;
35194684ddb6SLionel Sambuc            __tb = __r.__begin_;
35204684ddb6SLionel Sambuc            __te = __r.__begin_ + (__n - __i);
35214684ddb6SLionel Sambuc        }
35224684ddb6SLionel Sambuc        else
35234684ddb6SLionel Sambuc        {
35244684ddb6SLionel Sambuc            __i = _VSTD::min(-__i, static_cast<int>(__n));
35254684ddb6SLionel Sambuc            __sb = __begin_;
35264684ddb6SLionel Sambuc            __tb = __r.__begin_ + __i;
35274684ddb6SLionel Sambuc            __te = __r.__begin_ + __n;
35284684ddb6SLionel Sambuc        }
35294684ddb6SLionel Sambuc        for (; __r.__end_ != __tb; ++__r.__end_)
35304684ddb6SLionel Sambuc            ::new (__r.__end_) value_type();
35314684ddb6SLionel Sambuc        for (; __r.__end_ != __te; ++__r.__end_, ++__sb)
35324684ddb6SLionel Sambuc            ::new (__r.__end_) value_type(*__sb);
35334684ddb6SLionel Sambuc        for (__te = __r.__begin_ + __n; __r.__end_ != __te; ++__r.__end_)
35344684ddb6SLionel Sambuc            ::new (__r.__end_) value_type();
35354684ddb6SLionel Sambuc    }
35364684ddb6SLionel Sambuc    return __r;
35374684ddb6SLionel Sambuc}
35384684ddb6SLionel Sambuc
35394684ddb6SLionel Sambuctemplate <class _Tp>
35404684ddb6SLionel Sambucvalarray<_Tp>
35414684ddb6SLionel Sambucvalarray<_Tp>::cshift(int __i) const
35424684ddb6SLionel Sambuc{
35434684ddb6SLionel Sambuc    valarray<value_type> __r;
35444684ddb6SLionel Sambuc    size_t __n = size();
35454684ddb6SLionel Sambuc    if (__n)
35464684ddb6SLionel Sambuc    {
35474684ddb6SLionel Sambuc        __r.__begin_ =
35484684ddb6SLionel Sambuc            __r.__end_ =
3549*0a6a1f1dSLionel Sambuc                static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
35504684ddb6SLionel Sambuc        __i %= static_cast<int>(__n);
35514684ddb6SLionel Sambuc        const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i;
35524684ddb6SLionel Sambuc        for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s)
35534684ddb6SLionel Sambuc            ::new (__r.__end_) value_type(*__s);
35544684ddb6SLionel Sambuc        for (const value_type* __s = __begin_; __s != __m; ++__r.__end_, ++__s)
35554684ddb6SLionel Sambuc            ::new (__r.__end_) value_type(*__s);
35564684ddb6SLionel Sambuc    }
35574684ddb6SLionel Sambuc    return __r;
35584684ddb6SLionel Sambuc}
35594684ddb6SLionel Sambuc
35604684ddb6SLionel Sambuctemplate <class _Tp>
35614684ddb6SLionel Sambucvalarray<_Tp>
35624684ddb6SLionel Sambucvalarray<_Tp>::apply(value_type __f(value_type)) const
35634684ddb6SLionel Sambuc{
35644684ddb6SLionel Sambuc    valarray<value_type> __r;
35654684ddb6SLionel Sambuc    size_t __n = size();
35664684ddb6SLionel Sambuc    if (__n)
35674684ddb6SLionel Sambuc    {
35684684ddb6SLionel Sambuc        __r.__begin_ =
35694684ddb6SLionel Sambuc            __r.__end_ =
3570*0a6a1f1dSLionel Sambuc                static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
35714684ddb6SLionel Sambuc        for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
35724684ddb6SLionel Sambuc            ::new (__r.__end_) value_type(__f(*__p));
35734684ddb6SLionel Sambuc    }
35744684ddb6SLionel Sambuc    return __r;
35754684ddb6SLionel Sambuc}
35764684ddb6SLionel Sambuc
35774684ddb6SLionel Sambuctemplate <class _Tp>
35784684ddb6SLionel Sambucvalarray<_Tp>
35794684ddb6SLionel Sambucvalarray<_Tp>::apply(value_type __f(const value_type&)) const
35804684ddb6SLionel Sambuc{
35814684ddb6SLionel Sambuc    valarray<value_type> __r;
35824684ddb6SLionel Sambuc    size_t __n = size();
35834684ddb6SLionel Sambuc    if (__n)
35844684ddb6SLionel Sambuc    {
35854684ddb6SLionel Sambuc        __r.__begin_ =
35864684ddb6SLionel Sambuc            __r.__end_ =
3587*0a6a1f1dSLionel Sambuc                static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
35884684ddb6SLionel Sambuc        for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
35894684ddb6SLionel Sambuc            ::new (__r.__end_) value_type(__f(*__p));
35904684ddb6SLionel Sambuc    }
35914684ddb6SLionel Sambuc    return __r;
35924684ddb6SLionel Sambuc}
35934684ddb6SLionel Sambuc
35944684ddb6SLionel Sambuctemplate <class _Tp>
35954684ddb6SLionel Sambucvoid
35964684ddb6SLionel Sambucvalarray<_Tp>::resize(size_t __n, value_type __x)
35974684ddb6SLionel Sambuc{
35984684ddb6SLionel Sambuc    if (__begin_ != nullptr)
35994684ddb6SLionel Sambuc    {
36004684ddb6SLionel Sambuc        while (__end_ != __begin_)
36014684ddb6SLionel Sambuc            (--__end_)->~value_type();
3602*0a6a1f1dSLionel Sambuc        _VSTD::__deallocate(__begin_);
36034684ddb6SLionel Sambuc        __begin_ = __end_ = nullptr;
36044684ddb6SLionel Sambuc    }
36054684ddb6SLionel Sambuc    if (__n)
36064684ddb6SLionel Sambuc    {
3607*0a6a1f1dSLionel Sambuc        __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
36084684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS
36094684ddb6SLionel Sambuc        try
36104684ddb6SLionel Sambuc        {
36114684ddb6SLionel Sambuc#endif  // _LIBCPP_NO_EXCEPTIONS
36124684ddb6SLionel Sambuc            for (; __n; --__n, ++__end_)
36134684ddb6SLionel Sambuc                ::new (__end_) value_type(__x);
36144684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS
36154684ddb6SLionel Sambuc        }
36164684ddb6SLionel Sambuc        catch (...)
36174684ddb6SLionel Sambuc        {
36184684ddb6SLionel Sambuc            resize(0);
36194684ddb6SLionel Sambuc            throw;
36204684ddb6SLionel Sambuc        }
36214684ddb6SLionel Sambuc#endif  // _LIBCPP_NO_EXCEPTIONS
36224684ddb6SLionel Sambuc    }
36234684ddb6SLionel Sambuc}
36244684ddb6SLionel Sambuc
36254684ddb6SLionel Sambuctemplate<class _Tp>
36264684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
36274684ddb6SLionel Sambucvoid
36284684ddb6SLionel Sambucswap(valarray<_Tp>& __x, valarray<_Tp>& __y) _NOEXCEPT
36294684ddb6SLionel Sambuc{
36304684ddb6SLionel Sambuc    __x.swap(__y);
36314684ddb6SLionel Sambuc}
36324684ddb6SLionel Sambuc
36334684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
36344684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
36354684ddb6SLionel Sambuctypename enable_if
36364684ddb6SLionel Sambuc<
36374684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
36384684ddb6SLionel Sambuc    __val_expr<_BinaryOp<multiplies<typename _Expr1::value_type>, _Expr1, _Expr2> >
36394684ddb6SLionel Sambuc>::type
36404684ddb6SLionel Sambucoperator*(const _Expr1& __x, const _Expr2& __y)
36414684ddb6SLionel Sambuc{
36424684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
36434684ddb6SLionel Sambuc    typedef _BinaryOp<multiplies<value_type>, _Expr1, _Expr2> _Op;
36444684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(multiplies<value_type>(), __x, __y));
36454684ddb6SLionel Sambuc}
36464684ddb6SLionel Sambuc
36474684ddb6SLionel Sambuctemplate<class _Expr>
36484684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
36494684ddb6SLionel Sambuctypename enable_if
36504684ddb6SLionel Sambuc<
36514684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
36524684ddb6SLionel Sambuc    __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
36534684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
36544684ddb6SLionel Sambuc>::type
36554684ddb6SLionel Sambucoperator*(const _Expr& __x, const typename _Expr::value_type& __y)
36564684ddb6SLionel Sambuc{
36574684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
36584684ddb6SLionel Sambuc    typedef _BinaryOp<multiplies<value_type>, _Expr, __scalar_expr<value_type> > _Op;
36594684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(multiplies<value_type>(),
36604684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
36614684ddb6SLionel Sambuc}
36624684ddb6SLionel Sambuc
36634684ddb6SLionel Sambuctemplate<class _Expr>
36644684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
36654684ddb6SLionel Sambuctypename enable_if
36664684ddb6SLionel Sambuc<
36674684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
36684684ddb6SLionel Sambuc    __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
36694684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
36704684ddb6SLionel Sambuc>::type
36714684ddb6SLionel Sambucoperator*(const typename _Expr::value_type& __x, const _Expr& __y)
36724684ddb6SLionel Sambuc{
36734684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
36744684ddb6SLionel Sambuc    typedef _BinaryOp<multiplies<value_type>, __scalar_expr<value_type>, _Expr> _Op;
36754684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(multiplies<value_type>(),
36764684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
36774684ddb6SLionel Sambuc}
36784684ddb6SLionel Sambuc
36794684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
36804684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
36814684ddb6SLionel Sambuctypename enable_if
36824684ddb6SLionel Sambuc<
36834684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
36844684ddb6SLionel Sambuc    __val_expr<_BinaryOp<divides<typename _Expr1::value_type>, _Expr1, _Expr2> >
36854684ddb6SLionel Sambuc>::type
36864684ddb6SLionel Sambucoperator/(const _Expr1& __x, const _Expr2& __y)
36874684ddb6SLionel Sambuc{
36884684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
36894684ddb6SLionel Sambuc    typedef _BinaryOp<divides<value_type>, _Expr1, _Expr2> _Op;
36904684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(divides<value_type>(), __x, __y));
36914684ddb6SLionel Sambuc}
36924684ddb6SLionel Sambuc
36934684ddb6SLionel Sambuctemplate<class _Expr>
36944684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
36954684ddb6SLionel Sambuctypename enable_if
36964684ddb6SLionel Sambuc<
36974684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
36984684ddb6SLionel Sambuc    __val_expr<_BinaryOp<divides<typename _Expr::value_type>,
36994684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
37004684ddb6SLionel Sambuc>::type
37014684ddb6SLionel Sambucoperator/(const _Expr& __x, const typename _Expr::value_type& __y)
37024684ddb6SLionel Sambuc{
37034684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
37044684ddb6SLionel Sambuc    typedef _BinaryOp<divides<value_type>, _Expr, __scalar_expr<value_type> > _Op;
37054684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(divides<value_type>(),
37064684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
37074684ddb6SLionel Sambuc}
37084684ddb6SLionel Sambuc
37094684ddb6SLionel Sambuctemplate<class _Expr>
37104684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
37114684ddb6SLionel Sambuctypename enable_if
37124684ddb6SLionel Sambuc<
37134684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
37144684ddb6SLionel Sambuc    __val_expr<_BinaryOp<divides<typename _Expr::value_type>,
37154684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
37164684ddb6SLionel Sambuc>::type
37174684ddb6SLionel Sambucoperator/(const typename _Expr::value_type& __x, const _Expr& __y)
37184684ddb6SLionel Sambuc{
37194684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
37204684ddb6SLionel Sambuc    typedef _BinaryOp<divides<value_type>, __scalar_expr<value_type>, _Expr> _Op;
37214684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(divides<value_type>(),
37224684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
37234684ddb6SLionel Sambuc}
37244684ddb6SLionel Sambuc
37254684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
37264684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
37274684ddb6SLionel Sambuctypename enable_if
37284684ddb6SLionel Sambuc<
37294684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
37304684ddb6SLionel Sambuc    __val_expr<_BinaryOp<modulus<typename _Expr1::value_type>, _Expr1, _Expr2> >
37314684ddb6SLionel Sambuc>::type
37324684ddb6SLionel Sambucoperator%(const _Expr1& __x, const _Expr2& __y)
37334684ddb6SLionel Sambuc{
37344684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
37354684ddb6SLionel Sambuc    typedef _BinaryOp<modulus<value_type>, _Expr1, _Expr2> _Op;
37364684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(modulus<value_type>(), __x, __y));
37374684ddb6SLionel Sambuc}
37384684ddb6SLionel Sambuc
37394684ddb6SLionel Sambuctemplate<class _Expr>
37404684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
37414684ddb6SLionel Sambuctypename enable_if
37424684ddb6SLionel Sambuc<
37434684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
37444684ddb6SLionel Sambuc    __val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
37454684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
37464684ddb6SLionel Sambuc>::type
37474684ddb6SLionel Sambucoperator%(const _Expr& __x, const typename _Expr::value_type& __y)
37484684ddb6SLionel Sambuc{
37494684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
37504684ddb6SLionel Sambuc    typedef _BinaryOp<modulus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
37514684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(modulus<value_type>(),
37524684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
37534684ddb6SLionel Sambuc}
37544684ddb6SLionel Sambuc
37554684ddb6SLionel Sambuctemplate<class _Expr>
37564684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
37574684ddb6SLionel Sambuctypename enable_if
37584684ddb6SLionel Sambuc<
37594684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
37604684ddb6SLionel Sambuc    __val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
37614684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
37624684ddb6SLionel Sambuc>::type
37634684ddb6SLionel Sambucoperator%(const typename _Expr::value_type& __x, const _Expr& __y)
37644684ddb6SLionel Sambuc{
37654684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
37664684ddb6SLionel Sambuc    typedef _BinaryOp<modulus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
37674684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(modulus<value_type>(),
37684684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
37694684ddb6SLionel Sambuc}
37704684ddb6SLionel Sambuc
37714684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
37724684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
37734684ddb6SLionel Sambuctypename enable_if
37744684ddb6SLionel Sambuc<
37754684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
37764684ddb6SLionel Sambuc    __val_expr<_BinaryOp<plus<typename _Expr1::value_type>, _Expr1, _Expr2> >
37774684ddb6SLionel Sambuc>::type
37784684ddb6SLionel Sambucoperator+(const _Expr1& __x, const _Expr2& __y)
37794684ddb6SLionel Sambuc{
37804684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
37814684ddb6SLionel Sambuc    typedef _BinaryOp<plus<value_type>, _Expr1, _Expr2> _Op;
37824684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(plus<value_type>(), __x, __y));
37834684ddb6SLionel Sambuc}
37844684ddb6SLionel Sambuc
37854684ddb6SLionel Sambuctemplate<class _Expr>
37864684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
37874684ddb6SLionel Sambuctypename enable_if
37884684ddb6SLionel Sambuc<
37894684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
37904684ddb6SLionel Sambuc    __val_expr<_BinaryOp<plus<typename _Expr::value_type>,
37914684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
37924684ddb6SLionel Sambuc>::type
37934684ddb6SLionel Sambucoperator+(const _Expr& __x, const typename _Expr::value_type& __y)
37944684ddb6SLionel Sambuc{
37954684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
37964684ddb6SLionel Sambuc    typedef _BinaryOp<plus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
37974684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(plus<value_type>(),
37984684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
37994684ddb6SLionel Sambuc}
38004684ddb6SLionel Sambuc
38014684ddb6SLionel Sambuctemplate<class _Expr>
38024684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
38034684ddb6SLionel Sambuctypename enable_if
38044684ddb6SLionel Sambuc<
38054684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
38064684ddb6SLionel Sambuc    __val_expr<_BinaryOp<plus<typename _Expr::value_type>,
38074684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
38084684ddb6SLionel Sambuc>::type
38094684ddb6SLionel Sambucoperator+(const typename _Expr::value_type& __x, const _Expr& __y)
38104684ddb6SLionel Sambuc{
38114684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
38124684ddb6SLionel Sambuc    typedef _BinaryOp<plus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
38134684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(plus<value_type>(),
38144684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
38154684ddb6SLionel Sambuc}
38164684ddb6SLionel Sambuc
38174684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
38184684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
38194684ddb6SLionel Sambuctypename enable_if
38204684ddb6SLionel Sambuc<
38214684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
38224684ddb6SLionel Sambuc    __val_expr<_BinaryOp<minus<typename _Expr1::value_type>, _Expr1, _Expr2> >
38234684ddb6SLionel Sambuc>::type
38244684ddb6SLionel Sambucoperator-(const _Expr1& __x, const _Expr2& __y)
38254684ddb6SLionel Sambuc{
38264684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
38274684ddb6SLionel Sambuc    typedef _BinaryOp<minus<value_type>, _Expr1, _Expr2> _Op;
38284684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(minus<value_type>(), __x, __y));
38294684ddb6SLionel Sambuc}
38304684ddb6SLionel Sambuc
38314684ddb6SLionel Sambuctemplate<class _Expr>
38324684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
38334684ddb6SLionel Sambuctypename enable_if
38344684ddb6SLionel Sambuc<
38354684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
38364684ddb6SLionel Sambuc    __val_expr<_BinaryOp<minus<typename _Expr::value_type>,
38374684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
38384684ddb6SLionel Sambuc>::type
38394684ddb6SLionel Sambucoperator-(const _Expr& __x, const typename _Expr::value_type& __y)
38404684ddb6SLionel Sambuc{
38414684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
38424684ddb6SLionel Sambuc    typedef _BinaryOp<minus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
38434684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(minus<value_type>(),
38444684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
38454684ddb6SLionel Sambuc}
38464684ddb6SLionel Sambuc
38474684ddb6SLionel Sambuctemplate<class _Expr>
38484684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
38494684ddb6SLionel Sambuctypename enable_if
38504684ddb6SLionel Sambuc<
38514684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
38524684ddb6SLionel Sambuc    __val_expr<_BinaryOp<minus<typename _Expr::value_type>,
38534684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
38544684ddb6SLionel Sambuc>::type
38554684ddb6SLionel Sambucoperator-(const typename _Expr::value_type& __x, const _Expr& __y)
38564684ddb6SLionel Sambuc{
38574684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
38584684ddb6SLionel Sambuc    typedef _BinaryOp<minus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
38594684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(minus<value_type>(),
38604684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
38614684ddb6SLionel Sambuc}
38624684ddb6SLionel Sambuc
38634684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
38644684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
38654684ddb6SLionel Sambuctypename enable_if
38664684ddb6SLionel Sambuc<
38674684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
38684684ddb6SLionel Sambuc    __val_expr<_BinaryOp<bit_xor<typename _Expr1::value_type>, _Expr1, _Expr2> >
38694684ddb6SLionel Sambuc>::type
38704684ddb6SLionel Sambucoperator^(const _Expr1& __x, const _Expr2& __y)
38714684ddb6SLionel Sambuc{
38724684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
38734684ddb6SLionel Sambuc    typedef _BinaryOp<bit_xor<value_type>, _Expr1, _Expr2> _Op;
38744684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(bit_xor<value_type>(), __x, __y));
38754684ddb6SLionel Sambuc}
38764684ddb6SLionel Sambuc
38774684ddb6SLionel Sambuctemplate<class _Expr>
38784684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
38794684ddb6SLionel Sambuctypename enable_if
38804684ddb6SLionel Sambuc<
38814684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
38824684ddb6SLionel Sambuc    __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
38834684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
38844684ddb6SLionel Sambuc>::type
38854684ddb6SLionel Sambucoperator^(const _Expr& __x, const typename _Expr::value_type& __y)
38864684ddb6SLionel Sambuc{
38874684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
38884684ddb6SLionel Sambuc    typedef _BinaryOp<bit_xor<value_type>, _Expr, __scalar_expr<value_type> > _Op;
38894684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(bit_xor<value_type>(),
38904684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
38914684ddb6SLionel Sambuc}
38924684ddb6SLionel Sambuc
38934684ddb6SLionel Sambuctemplate<class _Expr>
38944684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
38954684ddb6SLionel Sambuctypename enable_if
38964684ddb6SLionel Sambuc<
38974684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
38984684ddb6SLionel Sambuc    __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
38994684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
39004684ddb6SLionel Sambuc>::type
39014684ddb6SLionel Sambucoperator^(const typename _Expr::value_type& __x, const _Expr& __y)
39024684ddb6SLionel Sambuc{
39034684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
39044684ddb6SLionel Sambuc    typedef _BinaryOp<bit_xor<value_type>, __scalar_expr<value_type>, _Expr> _Op;
39054684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(bit_xor<value_type>(),
39064684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
39074684ddb6SLionel Sambuc}
39084684ddb6SLionel Sambuc
39094684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
39104684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
39114684ddb6SLionel Sambuctypename enable_if
39124684ddb6SLionel Sambuc<
39134684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
39144684ddb6SLionel Sambuc    __val_expr<_BinaryOp<bit_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
39154684ddb6SLionel Sambuc>::type
39164684ddb6SLionel Sambucoperator&(const _Expr1& __x, const _Expr2& __y)
39174684ddb6SLionel Sambuc{
39184684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
39194684ddb6SLionel Sambuc    typedef _BinaryOp<bit_and<value_type>, _Expr1, _Expr2> _Op;
39204684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(bit_and<value_type>(), __x, __y));
39214684ddb6SLionel Sambuc}
39224684ddb6SLionel Sambuc
39234684ddb6SLionel Sambuctemplate<class _Expr>
39244684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
39254684ddb6SLionel Sambuctypename enable_if
39264684ddb6SLionel Sambuc<
39274684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
39284684ddb6SLionel Sambuc    __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
39294684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
39304684ddb6SLionel Sambuc>::type
39314684ddb6SLionel Sambucoperator&(const _Expr& __x, const typename _Expr::value_type& __y)
39324684ddb6SLionel Sambuc{
39334684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
39344684ddb6SLionel Sambuc    typedef _BinaryOp<bit_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
39354684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(bit_and<value_type>(),
39364684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
39374684ddb6SLionel Sambuc}
39384684ddb6SLionel Sambuc
39394684ddb6SLionel Sambuctemplate<class _Expr>
39404684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
39414684ddb6SLionel Sambuctypename enable_if
39424684ddb6SLionel Sambuc<
39434684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
39444684ddb6SLionel Sambuc    __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
39454684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
39464684ddb6SLionel Sambuc>::type
39474684ddb6SLionel Sambucoperator&(const typename _Expr::value_type& __x, const _Expr& __y)
39484684ddb6SLionel Sambuc{
39494684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
39504684ddb6SLionel Sambuc    typedef _BinaryOp<bit_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
39514684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(bit_and<value_type>(),
39524684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
39534684ddb6SLionel Sambuc}
39544684ddb6SLionel Sambuc
39554684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
39564684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
39574684ddb6SLionel Sambuctypename enable_if
39584684ddb6SLionel Sambuc<
39594684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
39604684ddb6SLionel Sambuc    __val_expr<_BinaryOp<bit_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
39614684ddb6SLionel Sambuc>::type
39624684ddb6SLionel Sambucoperator|(const _Expr1& __x, const _Expr2& __y)
39634684ddb6SLionel Sambuc{
39644684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
39654684ddb6SLionel Sambuc    typedef _BinaryOp<bit_or<value_type>, _Expr1, _Expr2> _Op;
39664684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(bit_or<value_type>(), __x, __y));
39674684ddb6SLionel Sambuc}
39684684ddb6SLionel Sambuc
39694684ddb6SLionel Sambuctemplate<class _Expr>
39704684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
39714684ddb6SLionel Sambuctypename enable_if
39724684ddb6SLionel Sambuc<
39734684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
39744684ddb6SLionel Sambuc    __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
39754684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
39764684ddb6SLionel Sambuc>::type
39774684ddb6SLionel Sambucoperator|(const _Expr& __x, const typename _Expr::value_type& __y)
39784684ddb6SLionel Sambuc{
39794684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
39804684ddb6SLionel Sambuc    typedef _BinaryOp<bit_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
39814684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(bit_or<value_type>(),
39824684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
39834684ddb6SLionel Sambuc}
39844684ddb6SLionel Sambuc
39854684ddb6SLionel Sambuctemplate<class _Expr>
39864684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
39874684ddb6SLionel Sambuctypename enable_if
39884684ddb6SLionel Sambuc<
39894684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
39904684ddb6SLionel Sambuc    __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
39914684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
39924684ddb6SLionel Sambuc>::type
39934684ddb6SLionel Sambucoperator|(const typename _Expr::value_type& __x, const _Expr& __y)
39944684ddb6SLionel Sambuc{
39954684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
39964684ddb6SLionel Sambuc    typedef _BinaryOp<bit_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
39974684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(bit_or<value_type>(),
39984684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
39994684ddb6SLionel Sambuc}
40004684ddb6SLionel Sambuc
40014684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
40024684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
40034684ddb6SLionel Sambuctypename enable_if
40044684ddb6SLionel Sambuc<
40054684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
40064684ddb6SLionel Sambuc    __val_expr<_BinaryOp<__bit_shift_left<typename _Expr1::value_type>, _Expr1, _Expr2> >
40074684ddb6SLionel Sambuc>::type
40084684ddb6SLionel Sambucoperator<<(const _Expr1& __x, const _Expr2& __y)
40094684ddb6SLionel Sambuc{
40104684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
40114684ddb6SLionel Sambuc    typedef _BinaryOp<__bit_shift_left<value_type>, _Expr1, _Expr2> _Op;
40124684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), __x, __y));
40134684ddb6SLionel Sambuc}
40144684ddb6SLionel Sambuc
40154684ddb6SLionel Sambuctemplate<class _Expr>
40164684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
40174684ddb6SLionel Sambuctypename enable_if
40184684ddb6SLionel Sambuc<
40194684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
40204684ddb6SLionel Sambuc    __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
40214684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
40224684ddb6SLionel Sambuc>::type
40234684ddb6SLionel Sambucoperator<<(const _Expr& __x, const typename _Expr::value_type& __y)
40244684ddb6SLionel Sambuc{
40254684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
40264684ddb6SLionel Sambuc    typedef _BinaryOp<__bit_shift_left<value_type>, _Expr, __scalar_expr<value_type> > _Op;
40274684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
40284684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
40294684ddb6SLionel Sambuc}
40304684ddb6SLionel Sambuc
40314684ddb6SLionel Sambuctemplate<class _Expr>
40324684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
40334684ddb6SLionel Sambuctypename enable_if
40344684ddb6SLionel Sambuc<
40354684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
40364684ddb6SLionel Sambuc    __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
40374684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
40384684ddb6SLionel Sambuc>::type
40394684ddb6SLionel Sambucoperator<<(const typename _Expr::value_type& __x, const _Expr& __y)
40404684ddb6SLionel Sambuc{
40414684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
40424684ddb6SLionel Sambuc    typedef _BinaryOp<__bit_shift_left<value_type>, __scalar_expr<value_type>, _Expr> _Op;
40434684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
40444684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
40454684ddb6SLionel Sambuc}
40464684ddb6SLionel Sambuc
40474684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
40484684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
40494684ddb6SLionel Sambuctypename enable_if
40504684ddb6SLionel Sambuc<
40514684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
40524684ddb6SLionel Sambuc    __val_expr<_BinaryOp<__bit_shift_right<typename _Expr1::value_type>, _Expr1, _Expr2> >
40534684ddb6SLionel Sambuc>::type
40544684ddb6SLionel Sambucoperator>>(const _Expr1& __x, const _Expr2& __y)
40554684ddb6SLionel Sambuc{
40564684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
40574684ddb6SLionel Sambuc    typedef _BinaryOp<__bit_shift_right<value_type>, _Expr1, _Expr2> _Op;
40584684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), __x, __y));
40594684ddb6SLionel Sambuc}
40604684ddb6SLionel Sambuc
40614684ddb6SLionel Sambuctemplate<class _Expr>
40624684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
40634684ddb6SLionel Sambuctypename enable_if
40644684ddb6SLionel Sambuc<
40654684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
40664684ddb6SLionel Sambuc    __val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
40674684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
40684684ddb6SLionel Sambuc>::type
40694684ddb6SLionel Sambucoperator>>(const _Expr& __x, const typename _Expr::value_type& __y)
40704684ddb6SLionel Sambuc{
40714684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
40724684ddb6SLionel Sambuc    typedef _BinaryOp<__bit_shift_right<value_type>, _Expr, __scalar_expr<value_type> > _Op;
40734684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
40744684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
40754684ddb6SLionel Sambuc}
40764684ddb6SLionel Sambuc
40774684ddb6SLionel Sambuctemplate<class _Expr>
40784684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
40794684ddb6SLionel Sambuctypename enable_if
40804684ddb6SLionel Sambuc<
40814684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
40824684ddb6SLionel Sambuc    __val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
40834684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
40844684ddb6SLionel Sambuc>::type
40854684ddb6SLionel Sambucoperator>>(const typename _Expr::value_type& __x, const _Expr& __y)
40864684ddb6SLionel Sambuc{
40874684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
40884684ddb6SLionel Sambuc    typedef _BinaryOp<__bit_shift_right<value_type>, __scalar_expr<value_type>, _Expr> _Op;
40894684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
40904684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
40914684ddb6SLionel Sambuc}
40924684ddb6SLionel Sambuc
40934684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
40944684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
40954684ddb6SLionel Sambuctypename enable_if
40964684ddb6SLionel Sambuc<
40974684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
40984684ddb6SLionel Sambuc    __val_expr<_BinaryOp<logical_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
40994684ddb6SLionel Sambuc>::type
41004684ddb6SLionel Sambucoperator&&(const _Expr1& __x, const _Expr2& __y)
41014684ddb6SLionel Sambuc{
41024684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
41034684ddb6SLionel Sambuc    typedef _BinaryOp<logical_and<value_type>, _Expr1, _Expr2> _Op;
41044684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(logical_and<value_type>(), __x, __y));
41054684ddb6SLionel Sambuc}
41064684ddb6SLionel Sambuc
41074684ddb6SLionel Sambuctemplate<class _Expr>
41084684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
41094684ddb6SLionel Sambuctypename enable_if
41104684ddb6SLionel Sambuc<
41114684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
41124684ddb6SLionel Sambuc    __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
41134684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
41144684ddb6SLionel Sambuc>::type
41154684ddb6SLionel Sambucoperator&&(const _Expr& __x, const typename _Expr::value_type& __y)
41164684ddb6SLionel Sambuc{
41174684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
41184684ddb6SLionel Sambuc    typedef _BinaryOp<logical_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
41194684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(logical_and<value_type>(),
41204684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
41214684ddb6SLionel Sambuc}
41224684ddb6SLionel Sambuc
41234684ddb6SLionel Sambuctemplate<class _Expr>
41244684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
41254684ddb6SLionel Sambuctypename enable_if
41264684ddb6SLionel Sambuc<
41274684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
41284684ddb6SLionel Sambuc    __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
41294684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
41304684ddb6SLionel Sambuc>::type
41314684ddb6SLionel Sambucoperator&&(const typename _Expr::value_type& __x, const _Expr& __y)
41324684ddb6SLionel Sambuc{
41334684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
41344684ddb6SLionel Sambuc    typedef _BinaryOp<logical_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
41354684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(logical_and<value_type>(),
41364684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
41374684ddb6SLionel Sambuc}
41384684ddb6SLionel Sambuc
41394684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
41404684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
41414684ddb6SLionel Sambuctypename enable_if
41424684ddb6SLionel Sambuc<
41434684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
41444684ddb6SLionel Sambuc    __val_expr<_BinaryOp<logical_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
41454684ddb6SLionel Sambuc>::type
41464684ddb6SLionel Sambucoperator||(const _Expr1& __x, const _Expr2& __y)
41474684ddb6SLionel Sambuc{
41484684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
41494684ddb6SLionel Sambuc    typedef _BinaryOp<logical_or<value_type>, _Expr1, _Expr2> _Op;
41504684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(logical_or<value_type>(), __x, __y));
41514684ddb6SLionel Sambuc}
41524684ddb6SLionel Sambuc
41534684ddb6SLionel Sambuctemplate<class _Expr>
41544684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
41554684ddb6SLionel Sambuctypename enable_if
41564684ddb6SLionel Sambuc<
41574684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
41584684ddb6SLionel Sambuc    __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
41594684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
41604684ddb6SLionel Sambuc>::type
41614684ddb6SLionel Sambucoperator||(const _Expr& __x, const typename _Expr::value_type& __y)
41624684ddb6SLionel Sambuc{
41634684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
41644684ddb6SLionel Sambuc    typedef _BinaryOp<logical_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
41654684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(logical_or<value_type>(),
41664684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
41674684ddb6SLionel Sambuc}
41684684ddb6SLionel Sambuc
41694684ddb6SLionel Sambuctemplate<class _Expr>
41704684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
41714684ddb6SLionel Sambuctypename enable_if
41724684ddb6SLionel Sambuc<
41734684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
41744684ddb6SLionel Sambuc    __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
41754684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
41764684ddb6SLionel Sambuc>::type
41774684ddb6SLionel Sambucoperator||(const typename _Expr::value_type& __x, const _Expr& __y)
41784684ddb6SLionel Sambuc{
41794684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
41804684ddb6SLionel Sambuc    typedef _BinaryOp<logical_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
41814684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(logical_or<value_type>(),
41824684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
41834684ddb6SLionel Sambuc}
41844684ddb6SLionel Sambuc
41854684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
41864684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
41874684ddb6SLionel Sambuctypename enable_if
41884684ddb6SLionel Sambuc<
41894684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
41904684ddb6SLionel Sambuc    __val_expr<_BinaryOp<equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
41914684ddb6SLionel Sambuc>::type
41924684ddb6SLionel Sambucoperator==(const _Expr1& __x, const _Expr2& __y)
41934684ddb6SLionel Sambuc{
41944684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
41954684ddb6SLionel Sambuc    typedef _BinaryOp<equal_to<value_type>, _Expr1, _Expr2> _Op;
41964684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(equal_to<value_type>(), __x, __y));
41974684ddb6SLionel Sambuc}
41984684ddb6SLionel Sambuc
41994684ddb6SLionel Sambuctemplate<class _Expr>
42004684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
42014684ddb6SLionel Sambuctypename enable_if
42024684ddb6SLionel Sambuc<
42034684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
42044684ddb6SLionel Sambuc    __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
42054684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
42064684ddb6SLionel Sambuc>::type
42074684ddb6SLionel Sambucoperator==(const _Expr& __x, const typename _Expr::value_type& __y)
42084684ddb6SLionel Sambuc{
42094684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
42104684ddb6SLionel Sambuc    typedef _BinaryOp<equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
42114684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(equal_to<value_type>(),
42124684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
42134684ddb6SLionel Sambuc}
42144684ddb6SLionel Sambuc
42154684ddb6SLionel Sambuctemplate<class _Expr>
42164684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
42174684ddb6SLionel Sambuctypename enable_if
42184684ddb6SLionel Sambuc<
42194684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
42204684ddb6SLionel Sambuc    __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
42214684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
42224684ddb6SLionel Sambuc>::type
42234684ddb6SLionel Sambucoperator==(const typename _Expr::value_type& __x, const _Expr& __y)
42244684ddb6SLionel Sambuc{
42254684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
42264684ddb6SLionel Sambuc    typedef _BinaryOp<equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
42274684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(equal_to<value_type>(),
42284684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
42294684ddb6SLionel Sambuc}
42304684ddb6SLionel Sambuc
42314684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
42324684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
42334684ddb6SLionel Sambuctypename enable_if
42344684ddb6SLionel Sambuc<
42354684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
42364684ddb6SLionel Sambuc    __val_expr<_BinaryOp<not_equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
42374684ddb6SLionel Sambuc>::type
42384684ddb6SLionel Sambucoperator!=(const _Expr1& __x, const _Expr2& __y)
42394684ddb6SLionel Sambuc{
42404684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
42414684ddb6SLionel Sambuc    typedef _BinaryOp<not_equal_to<value_type>, _Expr1, _Expr2> _Op;
42424684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __x, __y));
42434684ddb6SLionel Sambuc}
42444684ddb6SLionel Sambuc
42454684ddb6SLionel Sambuctemplate<class _Expr>
42464684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
42474684ddb6SLionel Sambuctypename enable_if
42484684ddb6SLionel Sambuc<
42494684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
42504684ddb6SLionel Sambuc    __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
42514684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
42524684ddb6SLionel Sambuc>::type
42534684ddb6SLionel Sambucoperator!=(const _Expr& __x, const typename _Expr::value_type& __y)
42544684ddb6SLionel Sambuc{
42554684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
42564684ddb6SLionel Sambuc    typedef _BinaryOp<not_equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
42574684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
42584684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
42594684ddb6SLionel Sambuc}
42604684ddb6SLionel Sambuc
42614684ddb6SLionel Sambuctemplate<class _Expr>
42624684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
42634684ddb6SLionel Sambuctypename enable_if
42644684ddb6SLionel Sambuc<
42654684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
42664684ddb6SLionel Sambuc    __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
42674684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
42684684ddb6SLionel Sambuc>::type
42694684ddb6SLionel Sambucoperator!=(const typename _Expr::value_type& __x, const _Expr& __y)
42704684ddb6SLionel Sambuc{
42714684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
42724684ddb6SLionel Sambuc    typedef _BinaryOp<not_equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
42734684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
42744684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
42754684ddb6SLionel Sambuc}
42764684ddb6SLionel Sambuc
42774684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
42784684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
42794684ddb6SLionel Sambuctypename enable_if
42804684ddb6SLionel Sambuc<
42814684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
42824684ddb6SLionel Sambuc    __val_expr<_BinaryOp<less<typename _Expr1::value_type>, _Expr1, _Expr2> >
42834684ddb6SLionel Sambuc>::type
42844684ddb6SLionel Sambucoperator<(const _Expr1& __x, const _Expr2& __y)
42854684ddb6SLionel Sambuc{
42864684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
42874684ddb6SLionel Sambuc    typedef _BinaryOp<less<value_type>, _Expr1, _Expr2> _Op;
42884684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(less<value_type>(), __x, __y));
42894684ddb6SLionel Sambuc}
42904684ddb6SLionel Sambuc
42914684ddb6SLionel Sambuctemplate<class _Expr>
42924684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
42934684ddb6SLionel Sambuctypename enable_if
42944684ddb6SLionel Sambuc<
42954684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
42964684ddb6SLionel Sambuc    __val_expr<_BinaryOp<less<typename _Expr::value_type>,
42974684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
42984684ddb6SLionel Sambuc>::type
42994684ddb6SLionel Sambucoperator<(const _Expr& __x, const typename _Expr::value_type& __y)
43004684ddb6SLionel Sambuc{
43014684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
43024684ddb6SLionel Sambuc    typedef _BinaryOp<less<value_type>, _Expr, __scalar_expr<value_type> > _Op;
43034684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(less<value_type>(),
43044684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
43054684ddb6SLionel Sambuc}
43064684ddb6SLionel Sambuc
43074684ddb6SLionel Sambuctemplate<class _Expr>
43084684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
43094684ddb6SLionel Sambuctypename enable_if
43104684ddb6SLionel Sambuc<
43114684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
43124684ddb6SLionel Sambuc    __val_expr<_BinaryOp<less<typename _Expr::value_type>,
43134684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
43144684ddb6SLionel Sambuc>::type
43154684ddb6SLionel Sambucoperator<(const typename _Expr::value_type& __x, const _Expr& __y)
43164684ddb6SLionel Sambuc{
43174684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
43184684ddb6SLionel Sambuc    typedef _BinaryOp<less<value_type>, __scalar_expr<value_type>, _Expr> _Op;
43194684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(less<value_type>(),
43204684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
43214684ddb6SLionel Sambuc}
43224684ddb6SLionel Sambuc
43234684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
43244684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
43254684ddb6SLionel Sambuctypename enable_if
43264684ddb6SLionel Sambuc<
43274684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
43284684ddb6SLionel Sambuc    __val_expr<_BinaryOp<greater<typename _Expr1::value_type>, _Expr1, _Expr2> >
43294684ddb6SLionel Sambuc>::type
43304684ddb6SLionel Sambucoperator>(const _Expr1& __x, const _Expr2& __y)
43314684ddb6SLionel Sambuc{
43324684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
43334684ddb6SLionel Sambuc    typedef _BinaryOp<greater<value_type>, _Expr1, _Expr2> _Op;
43344684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(greater<value_type>(), __x, __y));
43354684ddb6SLionel Sambuc}
43364684ddb6SLionel Sambuc
43374684ddb6SLionel Sambuctemplate<class _Expr>
43384684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
43394684ddb6SLionel Sambuctypename enable_if
43404684ddb6SLionel Sambuc<
43414684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
43424684ddb6SLionel Sambuc    __val_expr<_BinaryOp<greater<typename _Expr::value_type>,
43434684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
43444684ddb6SLionel Sambuc>::type
43454684ddb6SLionel Sambucoperator>(const _Expr& __x, const typename _Expr::value_type& __y)
43464684ddb6SLionel Sambuc{
43474684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
43484684ddb6SLionel Sambuc    typedef _BinaryOp<greater<value_type>, _Expr, __scalar_expr<value_type> > _Op;
43494684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(greater<value_type>(),
43504684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
43514684ddb6SLionel Sambuc}
43524684ddb6SLionel Sambuc
43534684ddb6SLionel Sambuctemplate<class _Expr>
43544684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
43554684ddb6SLionel Sambuctypename enable_if
43564684ddb6SLionel Sambuc<
43574684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
43584684ddb6SLionel Sambuc    __val_expr<_BinaryOp<greater<typename _Expr::value_type>,
43594684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
43604684ddb6SLionel Sambuc>::type
43614684ddb6SLionel Sambucoperator>(const typename _Expr::value_type& __x, const _Expr& __y)
43624684ddb6SLionel Sambuc{
43634684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
43644684ddb6SLionel Sambuc    typedef _BinaryOp<greater<value_type>, __scalar_expr<value_type>, _Expr> _Op;
43654684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(greater<value_type>(),
43664684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
43674684ddb6SLionel Sambuc}
43684684ddb6SLionel Sambuc
43694684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
43704684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
43714684ddb6SLionel Sambuctypename enable_if
43724684ddb6SLionel Sambuc<
43734684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
43744684ddb6SLionel Sambuc    __val_expr<_BinaryOp<less_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
43754684ddb6SLionel Sambuc>::type
43764684ddb6SLionel Sambucoperator<=(const _Expr1& __x, const _Expr2& __y)
43774684ddb6SLionel Sambuc{
43784684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
43794684ddb6SLionel Sambuc    typedef _BinaryOp<less_equal<value_type>, _Expr1, _Expr2> _Op;
43804684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(less_equal<value_type>(), __x, __y));
43814684ddb6SLionel Sambuc}
43824684ddb6SLionel Sambuc
43834684ddb6SLionel Sambuctemplate<class _Expr>
43844684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
43854684ddb6SLionel Sambuctypename enable_if
43864684ddb6SLionel Sambuc<
43874684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
43884684ddb6SLionel Sambuc    __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
43894684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
43904684ddb6SLionel Sambuc>::type
43914684ddb6SLionel Sambucoperator<=(const _Expr& __x, const typename _Expr::value_type& __y)
43924684ddb6SLionel Sambuc{
43934684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
43944684ddb6SLionel Sambuc    typedef _BinaryOp<less_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
43954684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(less_equal<value_type>(),
43964684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
43974684ddb6SLionel Sambuc}
43984684ddb6SLionel Sambuc
43994684ddb6SLionel Sambuctemplate<class _Expr>
44004684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
44014684ddb6SLionel Sambuctypename enable_if
44024684ddb6SLionel Sambuc<
44034684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
44044684ddb6SLionel Sambuc    __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
44054684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
44064684ddb6SLionel Sambuc>::type
44074684ddb6SLionel Sambucoperator<=(const typename _Expr::value_type& __x, const _Expr& __y)
44084684ddb6SLionel Sambuc{
44094684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
44104684ddb6SLionel Sambuc    typedef _BinaryOp<less_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
44114684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(less_equal<value_type>(),
44124684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
44134684ddb6SLionel Sambuc}
44144684ddb6SLionel Sambuc
44154684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
44164684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
44174684ddb6SLionel Sambuctypename enable_if
44184684ddb6SLionel Sambuc<
44194684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
44204684ddb6SLionel Sambuc    __val_expr<_BinaryOp<greater_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
44214684ddb6SLionel Sambuc>::type
44224684ddb6SLionel Sambucoperator>=(const _Expr1& __x, const _Expr2& __y)
44234684ddb6SLionel Sambuc{
44244684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
44254684ddb6SLionel Sambuc    typedef _BinaryOp<greater_equal<value_type>, _Expr1, _Expr2> _Op;
44264684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(greater_equal<value_type>(), __x, __y));
44274684ddb6SLionel Sambuc}
44284684ddb6SLionel Sambuc
44294684ddb6SLionel Sambuctemplate<class _Expr>
44304684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
44314684ddb6SLionel Sambuctypename enable_if
44324684ddb6SLionel Sambuc<
44334684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
44344684ddb6SLionel Sambuc    __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
44354684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
44364684ddb6SLionel Sambuc>::type
44374684ddb6SLionel Sambucoperator>=(const _Expr& __x, const typename _Expr::value_type& __y)
44384684ddb6SLionel Sambuc{
44394684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
44404684ddb6SLionel Sambuc    typedef _BinaryOp<greater_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
44414684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(greater_equal<value_type>(),
44424684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
44434684ddb6SLionel Sambuc}
44444684ddb6SLionel Sambuc
44454684ddb6SLionel Sambuctemplate<class _Expr>
44464684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
44474684ddb6SLionel Sambuctypename enable_if
44484684ddb6SLionel Sambuc<
44494684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
44504684ddb6SLionel Sambuc    __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
44514684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
44524684ddb6SLionel Sambuc>::type
44534684ddb6SLionel Sambucoperator>=(const typename _Expr::value_type& __x, const _Expr& __y)
44544684ddb6SLionel Sambuc{
44554684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
44564684ddb6SLionel Sambuc    typedef _BinaryOp<greater_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
44574684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(greater_equal<value_type>(),
44584684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
44594684ddb6SLionel Sambuc}
44604684ddb6SLionel Sambuc
44614684ddb6SLionel Sambuctemplate<class _Expr>
44624684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
44634684ddb6SLionel Sambuctypename enable_if
44644684ddb6SLionel Sambuc<
44654684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
44664684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__abs_expr<typename _Expr::value_type>, _Expr> >
44674684ddb6SLionel Sambuc>::type
44684684ddb6SLionel Sambucabs(const _Expr& __x)
44694684ddb6SLionel Sambuc{
44704684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
44714684ddb6SLionel Sambuc    typedef _UnaryOp<__abs_expr<value_type>, _Expr> _Op;
44724684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__abs_expr<value_type>(), __x));
44734684ddb6SLionel Sambuc}
44744684ddb6SLionel Sambuc
44754684ddb6SLionel Sambuctemplate<class _Expr>
44764684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
44774684ddb6SLionel Sambuctypename enable_if
44784684ddb6SLionel Sambuc<
44794684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
44804684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__acos_expr<typename _Expr::value_type>, _Expr> >
44814684ddb6SLionel Sambuc>::type
44824684ddb6SLionel Sambucacos(const _Expr& __x)
44834684ddb6SLionel Sambuc{
44844684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
44854684ddb6SLionel Sambuc    typedef _UnaryOp<__acos_expr<value_type>, _Expr> _Op;
44864684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__acos_expr<value_type>(), __x));
44874684ddb6SLionel Sambuc}
44884684ddb6SLionel Sambuc
44894684ddb6SLionel Sambuctemplate<class _Expr>
44904684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
44914684ddb6SLionel Sambuctypename enable_if
44924684ddb6SLionel Sambuc<
44934684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
44944684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__asin_expr<typename _Expr::value_type>, _Expr> >
44954684ddb6SLionel Sambuc>::type
44964684ddb6SLionel Sambucasin(const _Expr& __x)
44974684ddb6SLionel Sambuc{
44984684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
44994684ddb6SLionel Sambuc    typedef _UnaryOp<__asin_expr<value_type>, _Expr> _Op;
45004684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__asin_expr<value_type>(), __x));
45014684ddb6SLionel Sambuc}
45024684ddb6SLionel Sambuc
45034684ddb6SLionel Sambuctemplate<class _Expr>
45044684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
45054684ddb6SLionel Sambuctypename enable_if
45064684ddb6SLionel Sambuc<
45074684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
45084684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__atan_expr<typename _Expr::value_type>, _Expr> >
45094684ddb6SLionel Sambuc>::type
45104684ddb6SLionel Sambucatan(const _Expr& __x)
45114684ddb6SLionel Sambuc{
45124684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
45134684ddb6SLionel Sambuc    typedef _UnaryOp<__atan_expr<value_type>, _Expr> _Op;
45144684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__atan_expr<value_type>(), __x));
45154684ddb6SLionel Sambuc}
45164684ddb6SLionel Sambuc
45174684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
45184684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
45194684ddb6SLionel Sambuctypename enable_if
45204684ddb6SLionel Sambuc<
45214684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
45224684ddb6SLionel Sambuc    __val_expr<_BinaryOp<__atan2_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
45234684ddb6SLionel Sambuc>::type
45244684ddb6SLionel Sambucatan2(const _Expr1& __x, const _Expr2& __y)
45254684ddb6SLionel Sambuc{
45264684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
45274684ddb6SLionel Sambuc    typedef _BinaryOp<__atan2_expr<value_type>, _Expr1, _Expr2> _Op;
45284684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __x, __y));
45294684ddb6SLionel Sambuc}
45304684ddb6SLionel Sambuc
45314684ddb6SLionel Sambuctemplate<class _Expr>
45324684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
45334684ddb6SLionel Sambuctypename enable_if
45344684ddb6SLionel Sambuc<
45354684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
45364684ddb6SLionel Sambuc    __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
45374684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
45384684ddb6SLionel Sambuc>::type
45394684ddb6SLionel Sambucatan2(const _Expr& __x, const typename _Expr::value_type& __y)
45404684ddb6SLionel Sambuc{
45414684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
45424684ddb6SLionel Sambuc    typedef _BinaryOp<__atan2_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
45434684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
45444684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
45454684ddb6SLionel Sambuc}
45464684ddb6SLionel Sambuc
45474684ddb6SLionel Sambuctemplate<class _Expr>
45484684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
45494684ddb6SLionel Sambuctypename enable_if
45504684ddb6SLionel Sambuc<
45514684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
45524684ddb6SLionel Sambuc    __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
45534684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
45544684ddb6SLionel Sambuc>::type
45554684ddb6SLionel Sambucatan2(const typename _Expr::value_type& __x, const _Expr& __y)
45564684ddb6SLionel Sambuc{
45574684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
45584684ddb6SLionel Sambuc    typedef _BinaryOp<__atan2_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
45594684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
45604684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
45614684ddb6SLionel Sambuc}
45624684ddb6SLionel Sambuc
45634684ddb6SLionel Sambuctemplate<class _Expr>
45644684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
45654684ddb6SLionel Sambuctypename enable_if
45664684ddb6SLionel Sambuc<
45674684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
45684684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__cos_expr<typename _Expr::value_type>, _Expr> >
45694684ddb6SLionel Sambuc>::type
45704684ddb6SLionel Sambuccos(const _Expr& __x)
45714684ddb6SLionel Sambuc{
45724684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
45734684ddb6SLionel Sambuc    typedef _UnaryOp<__cos_expr<value_type>, _Expr> _Op;
45744684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__cos_expr<value_type>(), __x));
45754684ddb6SLionel Sambuc}
45764684ddb6SLionel Sambuc
45774684ddb6SLionel Sambuctemplate<class _Expr>
45784684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
45794684ddb6SLionel Sambuctypename enable_if
45804684ddb6SLionel Sambuc<
45814684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
45824684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__cosh_expr<typename _Expr::value_type>, _Expr> >
45834684ddb6SLionel Sambuc>::type
45844684ddb6SLionel Sambuccosh(const _Expr& __x)
45854684ddb6SLionel Sambuc{
45864684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
45874684ddb6SLionel Sambuc    typedef _UnaryOp<__cosh_expr<value_type>, _Expr> _Op;
45884684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__cosh_expr<value_type>(), __x));
45894684ddb6SLionel Sambuc}
45904684ddb6SLionel Sambuc
45914684ddb6SLionel Sambuctemplate<class _Expr>
45924684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
45934684ddb6SLionel Sambuctypename enable_if
45944684ddb6SLionel Sambuc<
45954684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
45964684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__exp_expr<typename _Expr::value_type>, _Expr> >
45974684ddb6SLionel Sambuc>::type
45984684ddb6SLionel Sambucexp(const _Expr& __x)
45994684ddb6SLionel Sambuc{
46004684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
46014684ddb6SLionel Sambuc    typedef _UnaryOp<__exp_expr<value_type>, _Expr> _Op;
46024684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__exp_expr<value_type>(), __x));
46034684ddb6SLionel Sambuc}
46044684ddb6SLionel Sambuc
46054684ddb6SLionel Sambuctemplate<class _Expr>
46064684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
46074684ddb6SLionel Sambuctypename enable_if
46084684ddb6SLionel Sambuc<
46094684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
46104684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__log_expr<typename _Expr::value_type>, _Expr> >
46114684ddb6SLionel Sambuc>::type
46124684ddb6SLionel Sambuclog(const _Expr& __x)
46134684ddb6SLionel Sambuc{
46144684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
46154684ddb6SLionel Sambuc    typedef _UnaryOp<__log_expr<value_type>, _Expr> _Op;
46164684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__log_expr<value_type>(), __x));
46174684ddb6SLionel Sambuc}
46184684ddb6SLionel Sambuc
46194684ddb6SLionel Sambuctemplate<class _Expr>
46204684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
46214684ddb6SLionel Sambuctypename enable_if
46224684ddb6SLionel Sambuc<
46234684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
46244684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__log10_expr<typename _Expr::value_type>, _Expr> >
46254684ddb6SLionel Sambuc>::type
46264684ddb6SLionel Sambuclog10(const _Expr& __x)
46274684ddb6SLionel Sambuc{
46284684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
46294684ddb6SLionel Sambuc    typedef _UnaryOp<__log10_expr<value_type>, _Expr> _Op;
46304684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__log10_expr<value_type>(), __x));
46314684ddb6SLionel Sambuc}
46324684ddb6SLionel Sambuc
46334684ddb6SLionel Sambuctemplate<class _Expr1, class _Expr2>
46344684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
46354684ddb6SLionel Sambuctypename enable_if
46364684ddb6SLionel Sambuc<
46374684ddb6SLionel Sambuc    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
46384684ddb6SLionel Sambuc    __val_expr<_BinaryOp<__pow_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
46394684ddb6SLionel Sambuc>::type
46404684ddb6SLionel Sambucpow(const _Expr1& __x, const _Expr2& __y)
46414684ddb6SLionel Sambuc{
46424684ddb6SLionel Sambuc    typedef typename _Expr1::value_type value_type;
46434684ddb6SLionel Sambuc    typedef _BinaryOp<__pow_expr<value_type>, _Expr1, _Expr2> _Op;
46444684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __x, __y));
46454684ddb6SLionel Sambuc}
46464684ddb6SLionel Sambuc
46474684ddb6SLionel Sambuctemplate<class _Expr>
46484684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
46494684ddb6SLionel Sambuctypename enable_if
46504684ddb6SLionel Sambuc<
46514684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
46524684ddb6SLionel Sambuc    __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
46534684ddb6SLionel Sambuc               _Expr, __scalar_expr<typename _Expr::value_type> > >
46544684ddb6SLionel Sambuc>::type
46554684ddb6SLionel Sambucpow(const _Expr& __x, const typename _Expr::value_type& __y)
46564684ddb6SLionel Sambuc{
46574684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
46584684ddb6SLionel Sambuc    typedef _BinaryOp<__pow_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
46594684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
46604684ddb6SLionel Sambuc                           __x, __scalar_expr<value_type>(__y, __x.size())));
46614684ddb6SLionel Sambuc}
46624684ddb6SLionel Sambuc
46634684ddb6SLionel Sambuctemplate<class _Expr>
46644684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
46654684ddb6SLionel Sambuctypename enable_if
46664684ddb6SLionel Sambuc<
46674684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
46684684ddb6SLionel Sambuc    __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
46694684ddb6SLionel Sambuc               __scalar_expr<typename _Expr::value_type>, _Expr> >
46704684ddb6SLionel Sambuc>::type
46714684ddb6SLionel Sambucpow(const typename _Expr::value_type& __x, const _Expr& __y)
46724684ddb6SLionel Sambuc{
46734684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
46744684ddb6SLionel Sambuc    typedef _BinaryOp<__pow_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
46754684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
46764684ddb6SLionel Sambuc                           __scalar_expr<value_type>(__x, __y.size()), __y));
46774684ddb6SLionel Sambuc}
46784684ddb6SLionel Sambuc
46794684ddb6SLionel Sambuctemplate<class _Expr>
46804684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
46814684ddb6SLionel Sambuctypename enable_if
46824684ddb6SLionel Sambuc<
46834684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
46844684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__sin_expr<typename _Expr::value_type>, _Expr> >
46854684ddb6SLionel Sambuc>::type
46864684ddb6SLionel Sambucsin(const _Expr& __x)
46874684ddb6SLionel Sambuc{
46884684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
46894684ddb6SLionel Sambuc    typedef _UnaryOp<__sin_expr<value_type>, _Expr> _Op;
46904684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__sin_expr<value_type>(), __x));
46914684ddb6SLionel Sambuc}
46924684ddb6SLionel Sambuc
46934684ddb6SLionel Sambuctemplate<class _Expr>
46944684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
46954684ddb6SLionel Sambuctypename enable_if
46964684ddb6SLionel Sambuc<
46974684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
46984684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__sinh_expr<typename _Expr::value_type>, _Expr> >
46994684ddb6SLionel Sambuc>::type
47004684ddb6SLionel Sambucsinh(const _Expr& __x)
47014684ddb6SLionel Sambuc{
47024684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
47034684ddb6SLionel Sambuc    typedef _UnaryOp<__sinh_expr<value_type>, _Expr> _Op;
47044684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__sinh_expr<value_type>(), __x));
47054684ddb6SLionel Sambuc}
47064684ddb6SLionel Sambuc
47074684ddb6SLionel Sambuctemplate<class _Expr>
47084684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
47094684ddb6SLionel Sambuctypename enable_if
47104684ddb6SLionel Sambuc<
47114684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
47124684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__sqrt_expr<typename _Expr::value_type>, _Expr> >
47134684ddb6SLionel Sambuc>::type
47144684ddb6SLionel Sambucsqrt(const _Expr& __x)
47154684ddb6SLionel Sambuc{
47164684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
47174684ddb6SLionel Sambuc    typedef _UnaryOp<__sqrt_expr<value_type>, _Expr> _Op;
47184684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__sqrt_expr<value_type>(), __x));
47194684ddb6SLionel Sambuc}
47204684ddb6SLionel Sambuc
47214684ddb6SLionel Sambuctemplate<class _Expr>
47224684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
47234684ddb6SLionel Sambuctypename enable_if
47244684ddb6SLionel Sambuc<
47254684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
47264684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__tan_expr<typename _Expr::value_type>, _Expr> >
47274684ddb6SLionel Sambuc>::type
47284684ddb6SLionel Sambuctan(const _Expr& __x)
47294684ddb6SLionel Sambuc{
47304684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
47314684ddb6SLionel Sambuc    typedef _UnaryOp<__tan_expr<value_type>, _Expr> _Op;
47324684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__tan_expr<value_type>(), __x));
47334684ddb6SLionel Sambuc}
47344684ddb6SLionel Sambuc
47354684ddb6SLionel Sambuctemplate<class _Expr>
47364684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
47374684ddb6SLionel Sambuctypename enable_if
47384684ddb6SLionel Sambuc<
47394684ddb6SLionel Sambuc    __is_val_expr<_Expr>::value,
47404684ddb6SLionel Sambuc    __val_expr<_UnaryOp<__tanh_expr<typename _Expr::value_type>, _Expr> >
47414684ddb6SLionel Sambuc>::type
47424684ddb6SLionel Sambuctanh(const _Expr& __x)
47434684ddb6SLionel Sambuc{
47444684ddb6SLionel Sambuc    typedef typename _Expr::value_type value_type;
47454684ddb6SLionel Sambuc    typedef _UnaryOp<__tanh_expr<value_type>, _Expr> _Op;
47464684ddb6SLionel Sambuc    return __val_expr<_Op>(_Op(__tanh_expr<value_type>(), __x));
47474684ddb6SLionel Sambuc}
47484684ddb6SLionel Sambuc
47494684ddb6SLionel Sambuctemplate <class _Tp>
47504684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
47514684ddb6SLionel Sambuc_Tp*
47524684ddb6SLionel Sambucbegin(valarray<_Tp>& __v)
47534684ddb6SLionel Sambuc{
47544684ddb6SLionel Sambuc    return __v.__begin_;
47554684ddb6SLionel Sambuc}
47564684ddb6SLionel Sambuc
47574684ddb6SLionel Sambuctemplate <class _Tp>
47584684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
47594684ddb6SLionel Sambucconst _Tp*
47604684ddb6SLionel Sambucbegin(const valarray<_Tp>& __v)
47614684ddb6SLionel Sambuc{
47624684ddb6SLionel Sambuc    return __v.__begin_;
47634684ddb6SLionel Sambuc}
47644684ddb6SLionel Sambuc
47654684ddb6SLionel Sambuctemplate <class _Tp>
47664684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
47674684ddb6SLionel Sambuc_Tp*
47684684ddb6SLionel Sambucend(valarray<_Tp>& __v)
47694684ddb6SLionel Sambuc{
47704684ddb6SLionel Sambuc    return __v.__end_;
47714684ddb6SLionel Sambuc}
47724684ddb6SLionel Sambuc
47734684ddb6SLionel Sambuctemplate <class _Tp>
47744684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
47754684ddb6SLionel Sambucconst _Tp*
47764684ddb6SLionel Sambucend(const valarray<_Tp>& __v)
47774684ddb6SLionel Sambuc{
47784684ddb6SLionel Sambuc    return __v.__end_;
47794684ddb6SLionel Sambuc}
47804684ddb6SLionel Sambuc
47814684ddb6SLionel Sambuc_LIBCPP_END_NAMESPACE_STD
47824684ddb6SLionel Sambuc
47834684ddb6SLionel Sambuc#endif  // _LIBCPP_VALARRAY
4784