aboutsummaryrefslogtreecommitdiff
path: root/tests/libcxx/include/valarray
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libcxx/include/valarray')
-rw-r--r--tests/libcxx/include/valarray4742
1 files changed, 0 insertions, 4742 deletions
diff --git a/tests/libcxx/include/valarray b/tests/libcxx/include/valarray
deleted file mode 100644
index 32e34a3e..00000000
--- a/tests/libcxx/include/valarray
+++ /dev/null
@@ -1,4742 +0,0 @@
-// -*- C++ -*-
-//===-------------------------- valarray ----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_VALARRAY
-#define _LIBCPP_VALARRAY
-
-/*
- valarray synopsis
-
-namespace std
-{
-
-template<class T>
-class valarray
-{
-public:
- typedef T value_type;
-
- // construct/destroy:
- valarray();
- explicit valarray(size_t n);
- valarray(const value_type& x, size_t n);
- valarray(const value_type* px, size_t n);
- valarray(const valarray& v);
- valarray(valarray&& v);
- valarray(const slice_array<value_type>& sa);
- valarray(const gslice_array<value_type>& ga);
- valarray(const mask_array<value_type>& ma);
- valarray(const indirect_array<value_type>& ia);
- valarray(initializer_list<value_type> il);
- ~valarray();
-
- // assignment:
- valarray& operator=(const valarray& v);
- valarray& operator=(valarray&& v);
- valarray& operator=(initializer_list<value_type> il);
- valarray& operator=(const value_type& x);
- valarray& operator=(const slice_array<value_type>& sa);
- valarray& operator=(const gslice_array<value_type>& ga);
- valarray& operator=(const mask_array<value_type>& ma);
- valarray& operator=(const indirect_array<value_type>& ia);
-
- // element access:
- const value_type& operator[](size_t i) const;
- value_type& operator[](size_t i);
-
- // subset operations:
- valarray operator[](slice s) const;
- slice_array<value_type> operator[](slice s);
- valarray operator[](const gslice& gs) const;
- gslice_array<value_type> operator[](const gslice& gs);
- valarray operator[](const valarray<bool>& vb) const;
- mask_array<value_type> operator[](const valarray<bool>& vb);
- valarray operator[](const valarray<size_t>& vs) const;
- indirect_array<value_type> operator[](const valarray<size_t>& vs);
-
- // unary operators:
- valarray operator+() const;
- valarray operator-() const;
- valarray operator~() const;
- valarray<bool> operator!() const;
-
- // computed assignment:
- valarray& operator*= (const value_type& x);
- valarray& operator/= (const value_type& x);
- valarray& operator%= (const value_type& x);
- valarray& operator+= (const value_type& x);
- valarray& operator-= (const value_type& x);
- valarray& operator^= (const value_type& x);
- valarray& operator&= (const value_type& x);
- valarray& operator|= (const value_type& x);
- valarray& operator<<=(const value_type& x);
- valarray& operator>>=(const value_type& x);
-
- valarray& operator*= (const valarray& v);
- valarray& operator/= (const valarray& v);
- valarray& operator%= (const valarray& v);
- valarray& operator+= (const valarray& v);
- valarray& operator-= (const valarray& v);
- valarray& operator^= (const valarray& v);
- valarray& operator|= (const valarray& v);
- valarray& operator&= (const valarray& v);
- valarray& operator<<=(const valarray& v);
- valarray& operator>>=(const valarray& v);
-
- // member functions:
- void swap(valarray& v);
-
- size_t size() const;
-
- value_type sum() const;
- value_type min() const;
- value_type max() const;
-
- valarray shift (int i) const;
- valarray cshift(int i) const;
- valarray apply(value_type f(value_type)) const;
- valarray apply(value_type f(const value_type&)) const;
- void resize(size_t n, value_type x = value_type());
-};
-
-class slice
-{
-public:
- slice();
- slice(size_t start, size_t size, size_t stride);
-
- size_t start() const;
- size_t size() const;
- size_t stride() const;
-};
-
-template <class T>
-class slice_array
-{
-public:
- typedef T value_type;
-
- const slice_array& operator=(const slice_array& sa) const;
- void operator= (const valarray<value_type>& v) const;
- void operator*= (const valarray<value_type>& v) const;
- void operator/= (const valarray<value_type>& v) const;
- void operator%= (const valarray<value_type>& v) const;
- void operator+= (const valarray<value_type>& v) const;
- void operator-= (const valarray<value_type>& v) const;
- void operator^= (const valarray<value_type>& v) const;
- void operator&= (const valarray<value_type>& v) const;
- void operator|= (const valarray<value_type>& v) const;
- void operator<<=(const valarray<value_type>& v) const;
- void operator>>=(const valarray<value_type>& v) const;
-
- void operator=(const value_type& x) const;
-
- slice_array() = delete;
-};
-
-class gslice
-{
-public:
- gslice();
- gslice(size_t start, const valarray<size_t>& size,
- const valarray<size_t>& stride);
-
- size_t start() const;
- valarray<size_t> size() const;
- valarray<size_t> stride() const;
-};
-
-template <class T>
-class gslice_array
-{
-public:
- typedef T value_type;
-
- void operator= (const valarray<value_type>& v) const;
- void operator*= (const valarray<value_type>& v) const;
- void operator/= (const valarray<value_type>& v) const;
- void operator%= (const valarray<value_type>& v) const;
- void operator+= (const valarray<value_type>& v) const;
- void operator-= (const valarray<value_type>& v) const;
- void operator^= (const valarray<value_type>& v) const;
- void operator&= (const valarray<value_type>& v) const;
- void operator|= (const valarray<value_type>& v) const;
- void operator<<=(const valarray<value_type>& v) const;
- void operator>>=(const valarray<value_type>& v) const;
-
- gslice_array(const gslice_array& ga);
- ~gslice_array();
- const gslice_array& operator=(const gslice_array& ga) const;
- void operator=(const value_type& x) const;
-
- gslice_array() = delete;
-};
-
-template <class T>
-class mask_array
-{
-public:
- typedef T value_type;
-
- void operator= (const valarray<value_type>& v) const;
- void operator*= (const valarray<value_type>& v) const;
- void operator/= (const valarray<value_type>& v) const;
- void operator%= (const valarray<value_type>& v) const;
- void operator+= (const valarray<value_type>& v) const;
- void operator-= (const valarray<value_type>& v) const;
- void operator^= (const valarray<value_type>& v) const;
- void operator&= (const valarray<value_type>& v) const;
- void operator|= (const valarray<value_type>& v) const;
- void operator<<=(const valarray<value_type>& v) const;
- void operator>>=(const valarray<value_type>& v) const;
-
- mask_array(const mask_array& ma);
- ~mask_array();
- const mask_array& operator=(const mask_array& ma) const;
- void operator=(const value_type& x) const;
-
- mask_array() = delete;
-};
-
-template <class T>
-class indirect_array
-{
-public:
- typedef T value_type;
-
- void operator= (const valarray<value_type>& v) const;
- void operator*= (const valarray<value_type>& v) const;
- void operator/= (const valarray<value_type>& v) const;
- void operator%= (const valarray<value_type>& v) const;
- void operator+= (const valarray<value_type>& v) const;
- void operator-= (const valarray<value_type>& v) const;
- void operator^= (const valarray<value_type>& v) const;
- void operator&= (const valarray<value_type>& v) const;
- void operator|= (const valarray<value_type>& v) const;
- void operator<<=(const valarray<value_type>& v) const;
- void operator>>=(const valarray<value_type>& v) const;
-
- indirect_array(const indirect_array& ia);
- ~indirect_array();
- const indirect_array& operator=(const indirect_array& ia) const;
- void operator=(const value_type& x) const;
-
- indirect_array() = delete;
-};
-
-template<class T> void swap(valarray<T>& x, valarray<T>& y);
-
-template<class T> valarray<T> operator* (const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<T> operator* (const valarray<T>& x, const T& y);
-template<class T> valarray<T> operator* (const T& x, const valarray<T>& y);
-
-template<class T> valarray<T> operator/ (const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<T> operator/ (const valarray<T>& x, const T& y);
-template<class T> valarray<T> operator/ (const T& x, const valarray<T>& y);
-
-template<class T> valarray<T> operator% (const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<T> operator% (const valarray<T>& x, const T& y);
-template<class T> valarray<T> operator% (const T& x, const valarray<T>& y);
-
-template<class T> valarray<T> operator+ (const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<T> operator+ (const valarray<T>& x, const T& y);
-template<class T> valarray<T> operator+ (const T& x, const valarray<T>& y);
-
-template<class T> valarray<T> operator- (const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<T> operator- (const valarray<T>& x, const T& y);
-template<class T> valarray<T> operator- (const T& x, const valarray<T>& y);
-
-template<class T> valarray<T> operator^ (const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<T> operator^ (const valarray<T>& x, const T& y);
-template<class T> valarray<T> operator^ (const T& x, const valarray<T>& y);
-
-template<class T> valarray<T> operator& (const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<T> operator& (const valarray<T>& x, const T& y);
-template<class T> valarray<T> operator& (const T& x, const valarray<T>& y);
-
-template<class T> valarray<T> operator| (const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<T> operator| (const valarray<T>& x, const T& y);
-template<class T> valarray<T> operator| (const T& x, const valarray<T>& y);
-
-template<class T> valarray<T> operator<<(const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<T> operator<<(const valarray<T>& x, const T& y);
-template<class T> valarray<T> operator<<(const T& x, const valarray<T>& y);
-
-template<class T> valarray<T> operator>>(const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<T> operator>>(const valarray<T>& x, const T& y);
-template<class T> valarray<T> operator>>(const T& x, const valarray<T>& y);
-
-template<class T> valarray<bool> operator&&(const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<bool> operator&&(const valarray<T>& x, const T& y);
-template<class T> valarray<bool> operator&&(const T& x, const valarray<T>& y);
-
-template<class T> valarray<bool> operator||(const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<bool> operator||(const valarray<T>& x, const T& y);
-template<class T> valarray<bool> operator||(const T& x, const valarray<T>& y);
-
-template<class T> valarray<bool> operator==(const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<bool> operator==(const valarray<T>& x, const T& y);
-template<class T> valarray<bool> operator==(const T& x, const valarray<T>& y);
-
-template<class T> valarray<bool> operator!=(const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<bool> operator!=(const valarray<T>& x, const T& y);
-template<class T> valarray<bool> operator!=(const T& x, const valarray<T>& y);
-
-template<class T> valarray<bool> operator< (const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<bool> operator< (const valarray<T>& x, const T& y);
-template<class T> valarray<bool> operator< (const T& x, const valarray<T>& y);
-
-template<class T> valarray<bool> operator> (const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<bool> operator> (const valarray<T>& x, const T& y);
-template<class T> valarray<bool> operator> (const T& x, const valarray<T>& y);
-
-template<class T> valarray<bool> operator<=(const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<bool> operator<=(const valarray<T>& x, const T& y);
-template<class T> valarray<bool> operator<=(const T& x, const valarray<T>& y);
-
-template<class T> valarray<bool> operator>=(const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<bool> operator>=(const valarray<T>& x, const T& y);
-template<class T> valarray<bool> operator>=(const T& x, const valarray<T>& y);
-
-template<class T> valarray<T> abs (const valarray<T>& x);
-template<class T> valarray<T> acos (const valarray<T>& x);
-template<class T> valarray<T> asin (const valarray<T>& x);
-template<class T> valarray<T> atan (const valarray<T>& x);
-
-template<class T> valarray<T> atan2(const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<T> atan2(const valarray<T>& x, const T& y);
-template<class T> valarray<T> atan2(const T& x, const valarray<T>& y);
-
-template<class T> valarray<T> cos (const valarray<T>& x);
-template<class T> valarray<T> cosh (const valarray<T>& x);
-template<class T> valarray<T> exp (const valarray<T>& x);
-template<class T> valarray<T> log (const valarray<T>& x);
-template<class T> valarray<T> log10(const valarray<T>& x);
-
-template<class T> valarray<T> pow(const valarray<T>& x, const valarray<T>& y);
-template<class T> valarray<T> pow(const valarray<T>& x, const T& y);
-template<class T> valarray<T> pow(const T& x, const valarray<T>& y);
-
-template<class T> valarray<T> sin (const valarray<T>& x);
-template<class T> valarray<T> sinh (const valarray<T>& x);
-template<class T> valarray<T> sqrt (const valarray<T>& x);
-template<class T> valarray<T> tan (const valarray<T>& x);
-template<class T> valarray<T> tanh (const valarray<T>& x);
-
-template <class T> unspecified1 begin(valarray<T>& v);
-template <class T> unspecified2 begin(const valarray<T>& v);
-template <class T> unspecified1 end(valarray<T>& v);
-template <class T> unspecified2 end(const valarray<T>& v);
-
-} // std
-
-*/
-
-#include <__config>
-#include <cstddef>
-#include <cmath>
-#include <initializer_list>
-#include <algorithm>
-#include <functional>
-
-#pragma GCC system_header
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template<class _Tp> class valarray;
-
-class _LIBCPP_VISIBLE slice
-{
- size_t __start_;
- size_t __size_;
- size_t __stride_;
-public:
- _LIBCPP_INLINE_VISIBILITY
- slice()
- : __start_(0),
- __size_(0),
- __stride_(0)
- {}
-
- _LIBCPP_INLINE_VISIBILITY
- slice(size_t __start, size_t __size, size_t __stride)
- : __start_(__start),
- __size_(__size),
- __stride_(__stride)
- {}
-
- _LIBCPP_INLINE_VISIBILITY size_t start() const {return __start_;}
- _LIBCPP_INLINE_VISIBILITY size_t size() const {return __size_;}
- _LIBCPP_INLINE_VISIBILITY size_t stride() const {return __stride_;}
-};
-
-template <class _Tp> class slice_array;
-class gslice;
-template <class _Tp> class gslice_array;
-template <class _Tp> class mask_array;
-template <class _Tp> class indirect_array;
-
-template <class _Tp>
-_Tp*
-begin(valarray<_Tp>& __v);
-
-template <class _Tp>
-const _Tp*
-begin(const valarray<_Tp>& __v);
-
-template <class _Tp>
-_Tp*
-end(valarray<_Tp>& __v);
-
-template <class _Tp>
-const _Tp*
-end(const valarray<_Tp>& __v);
-
-template <class _Op, class _A0>
-struct _UnaryOp
-{
- typedef typename _Op::result_type result_type;
- typedef typename _A0::value_type value_type;
-
- _Op __op_;
- _A0 __a0_;
-
- _LIBCPP_INLINE_VISIBILITY
- _UnaryOp(const _Op& __op, const _A0& __a0) : __op_(__op), __a0_(__a0) {}
-
- _LIBCPP_INLINE_VISIBILITY
- result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
-
- _LIBCPP_INLINE_VISIBILITY
- size_t size() const {return __a0_.size();}
-};
-
-template <class _Op, class _A0, class _A1>
-struct _BinaryOp
-{
- typedef typename _Op::result_type result_type;
- typedef typename _A0::value_type value_type;
-
- _Op __op_;
- _A0 __a0_;
- _A1 __a1_;
-
- _LIBCPP_INLINE_VISIBILITY
- _BinaryOp(const _Op& __op, const _A0& __a0, const _A1& __a1)
- : __op_(__op), __a0_(__a0), __a1_(__a1) {}
-
- _LIBCPP_INLINE_VISIBILITY
- value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
-
- _LIBCPP_INLINE_VISIBILITY
- size_t size() const {return __a0_.size();}
-};
-
-template <class _Tp>
-class __scalar_expr
-{
-public:
- typedef _Tp value_type;
- typedef const _Tp& result_type;
-private:
- const value_type& __t_;
- size_t __s_;
-public:
- _LIBCPP_INLINE_VISIBILITY
- explicit __scalar_expr(const value_type& __t, size_t __s) : __t_(__t), __s_(__s) {}
-
- _LIBCPP_INLINE_VISIBILITY
- result_type operator[](size_t) const {return __t_;}
-
- _LIBCPP_INLINE_VISIBILITY
- size_t size() const {return __s_;}
-};
-
-template <class _Tp>
-struct __unary_plus : unary_function<_Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return +__x;}
-};
-
-template <class _Tp>
-struct __bit_not : unary_function<_Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return ~__x;}
-};
-
-template <class _Tp>
-struct __bit_shift_left : binary_function<_Tp, _Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x << __y;}
-};
-
-template <class _Tp>
-struct __bit_shift_right : binary_function<_Tp, _Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x >> __y;}
-};
-
-template <class _Tp, class _F>
-struct __apply_expr : unary_function<_Tp, _Tp>
-{
-private:
- _F __f_;
-public:
- _LIBCPP_INLINE_VISIBILITY
- explicit __apply_expr(_F __f) : __f_(__f) {}
-
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return __f_(__x);}
-};
-
-template <class _Tp>
-struct __abs_expr : unary_function<_Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return abs(__x);}
-};
-
-template <class _Tp>
-struct __acos_expr : unary_function<_Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return acos(__x);}
-};
-
-template <class _Tp>
-struct __asin_expr : unary_function<_Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return asin(__x);}
-};
-
-template <class _Tp>
-struct __atan_expr : unary_function<_Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return atan(__x);}
-};
-
-template <class _Tp>
-struct __atan2_expr : binary_function<_Tp, _Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return atan2(__x, __y);}
-};
-
-template <class _Tp>
-struct __cos_expr : unary_function<_Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return cos(__x);}
-};
-
-template <class _Tp>
-struct __cosh_expr : unary_function<_Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return cosh(__x);}
-};
-
-template <class _Tp>
-struct __exp_expr : unary_function<_Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return exp(__x);}
-};
-
-template <class _Tp>
-struct __log_expr : unary_function<_Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return log(__x);}
-};
-
-template <class _Tp>
-struct __log10_expr : unary_function<_Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return log10(__x);}
-};
-
-template <class _Tp>
-struct __pow_expr : binary_function<_Tp, _Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return pow(__x, __y);}
-};
-
-template <class _Tp>
-struct __sin_expr : unary_function<_Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return sin(__x);}
-};
-
-template <class _Tp>
-struct __sinh_expr : unary_function<_Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return sinh(__x);}
-};
-
-template <class _Tp>
-struct __sqrt_expr : unary_function<_Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return sqrt(__x);}
-};
-
-template <class _Tp>
-struct __tan_expr : unary_function<_Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return tan(__x);}
-};
-
-template <class _Tp>
-struct __tanh_expr : unary_function<_Tp, _Tp>
-{
- _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(const _Tp& __x) const
- {return tanh(__x);}
-};
-
-template <class _ValExpr>
-class __slice_expr
-{
- typedef typename remove_reference<_ValExpr>::type _RmExpr;
-public:
- typedef typename _RmExpr::value_type value_type;
- typedef value_type result_type;
-
-private:
- _ValExpr __expr_;
- size_t __start_;
- size_t __size_;
- size_t __stride_;
-
- _LIBCPP_INLINE_VISIBILITY
- __slice_expr(const slice& __sl, const _RmExpr& __e)
- : __expr_(__e),
- __start_(__sl.start()),
- __size_(__sl.size()),
- __stride_(__sl.stride())
- {}
-public:
-
- _LIBCPP_INLINE_VISIBILITY
- result_type operator[](size_t __i) const
- {return __expr_[__start_ + __i * __stride_];}
-
- _LIBCPP_INLINE_VISIBILITY
- size_t size() const {return __size_;}
-
- template <class> friend class _LIBCPP_VISIBLE valarray;
-};
-
-template <class _ValExpr>
-class __mask_expr;
-
-template <class _ValExpr>
-class __indirect_expr;
-
-template <class _ValExpr>
-class __shift_expr
-{
- typedef typename remove_reference<_ValExpr>::type _RmExpr;
-public:
- typedef typename _RmExpr::value_type value_type;
- typedef value_type result_type;
-
-private:
- _ValExpr __expr_;
- size_t __size_;
- ptrdiff_t __ul_;
- ptrdiff_t __sn_;
- ptrdiff_t __n_;
- static const ptrdiff_t _N = static_cast<ptrdiff_t>(
- sizeof(ptrdiff_t) * __CHAR_BIT__ - 1);
-
- _LIBCPP_INLINE_VISIBILITY
- __shift_expr(int __n, const _RmExpr& __e)
- : __expr_(__e),
- __size_(__e.size()),
- __n_(__n)
- {
- ptrdiff_t __neg_n = static_cast<ptrdiff_t>(__n_ >> _N);
- __sn_ = __neg_n | static_cast<ptrdiff_t>(static_cast<size_t>(-__n_) >> _N);
- __ul_ = ((__size_ - __n_) & ~__neg_n) | ((__n_ + 1) & __neg_n);
- }
-public:
-
- _LIBCPP_INLINE_VISIBILITY
- result_type operator[](size_t __j) const
- {
- ptrdiff_t __i = static_cast<size_t>(__j);
- ptrdiff_t __m = (__sn_ * __i - __ul_) >> _N;
- return (__expr_[(__i + __n_) & __m] & __m) | (value_type() & ~__m);
- }
-
- _LIBCPP_INLINE_VISIBILITY
- size_t size() const {return __size_;}
-
- template <class> friend class __val_expr;
-};
-
-template <class _ValExpr>
-class __cshift_expr
-{
- typedef typename remove_reference<_ValExpr>::type _RmExpr;
-public:
- typedef typename _RmExpr::value_type value_type;
- typedef value_type result_type;
-
-private:
- _ValExpr __expr_;
- size_t __size_;
- size_t __m_;
- size_t __o1_;
- size_t __o2_;
-
- _LIBCPP_INLINE_VISIBILITY
- __cshift_expr(int __n, const _RmExpr& __e)
- : __expr_(__e),
- __size_(__e.size())
- {
- __n %= static_cast<int>(__size_);
- if (__n >= 0)
- {
- __m_ = __size_ - __n;
- __o1_ = __n;
- __o2_ = __n - __size_;
- }
- else
- {
- __m_ = -__n;
- __o1_ = __n + __size_;
- __o2_ = __n;
- }
- }
-public:
-
- _LIBCPP_INLINE_VISIBILITY
- result_type operator[](size_t __i) const
- {
- if (__i < __m_)
- return __expr_[__i + __o1_];
- return __expr_[__i + __o2_];
- }
-
- _LIBCPP_INLINE_VISIBILITY
- size_t size() const {return __size_;}
-
- template <class> friend class __val_expr;
-};
-
-template<class _ValExpr>
-class __val_expr;
-
-template<class _ValExpr>
-struct __is_val_expr : false_type {};
-
-template<class _ValExpr>
-struct __is_val_expr<__val_expr<_ValExpr> > : true_type {};
-
-template<class _Tp>
-struct __is_val_expr<valarray<_Tp> > : true_type {};
-
-template<class _Tp>
-class _LIBCPP_VISIBLE valarray
-{
-public:
- typedef _Tp value_type;
- typedef _Tp result_type;
-
-private:
- value_type* __begin_;
- value_type* __end_;
-
-public:
- // construct/destroy:
- _LIBCPP_INLINE_VISIBILITY
- valarray() : __begin_(0), __end_(0) {}
- explicit valarray(size_t __n);
- valarray(const value_type& __x, size_t __n);
- valarray(const value_type* __p, size_t __n);
- valarray(const valarray& __v);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- valarray(valarray&& __v);
- valarray(initializer_list<value_type> __il);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- valarray(const slice_array<value_type>& __sa);
- valarray(const gslice_array<value_type>& __ga);
- valarray(const mask_array<value_type>& __ma);
- valarray(const indirect_array<value_type>& __ia);
- ~valarray();
-
- // assignment:
- valarray& operator=(const valarray& __v);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- valarray& operator=(valarray&& __v);
- valarray& operator=(initializer_list<value_type>);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- valarray& operator=(const value_type& __x);
- valarray& operator=(const slice_array<value_type>& __sa);
- valarray& operator=(const gslice_array<value_type>& __ga);
- valarray& operator=(const mask_array<value_type>& __ma);
- valarray& operator=(const indirect_array<value_type>& __ia);
-
- // element access:
- _LIBCPP_INLINE_VISIBILITY
- const value_type& operator[](size_t __i) const {return __begin_[__i];}
-
- _LIBCPP_INLINE_VISIBILITY
- value_type& operator[](size_t __i) {return __begin_[__i];}
-
- // subset operations:
- __val_expr<__slice_expr<const valarray&> > operator[](slice __s) const;
- slice_array<value_type> operator[](slice __s);
- __val_expr<__indirect_expr<const valarray&> > operator[](const gslice& __gs) const;
- gslice_array<value_type> operator[](const gslice& __gs);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- __val_expr<__indirect_expr<const valarray&> > operator[](gslice&& __gs) const;
- gslice_array<value_type> operator[](gslice&& __gs);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- __val_expr<__mask_expr<const valarray&> > operator[](const valarray<bool>& __vb) const;
- mask_array<value_type> operator[](const valarray<bool>& __vb);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- __val_expr<__mask_expr<const valarray&> > operator[](valarray<bool>&& __vb) const;
- mask_array<value_type> operator[](valarray<bool>&& __vb);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- __val_expr<__indirect_expr<const valarray&> > operator[](const valarray<size_t>& __vs) const;
- indirect_array<value_type> operator[](const valarray<size_t>& __vs);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- __val_expr<__indirect_expr<const valarray&> > operator[](valarray<size_t>&& __vs) const;
- indirect_array<value_type> operator[](valarray<size_t>&& __vs);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
- // unary operators:
- valarray operator+() const;
- valarray operator-() const;
- valarray operator~() const;
- valarray<bool> operator!() const;
-
- // computed assignment:
- valarray& operator*= (const value_type& __x);
- valarray& operator/= (const value_type& __x);
- valarray& operator%= (const value_type& __x);
- valarray& operator+= (const value_type& __x);
- valarray& operator-= (const value_type& __x);
- valarray& operator^= (const value_type& __x);
- valarray& operator&= (const value_type& __x);
- valarray& operator|= (const value_type& __x);
- valarray& operator<<=(const value_type& __x);
- valarray& operator>>=(const value_type& __x);
-
- template <class _Expr>
- typename enable_if
- <
- __is_val_expr<_Expr>::value,
- valarray&
- >::type
- operator*= (const _Expr& __v);
-
- template <class _Expr>
- typename enable_if
- <
- __is_val_expr<_Expr>::value,
- valarray&
- >::type
- operator/= (const _Expr& __v);
-
- template <class _Expr>
- typename enable_if
- <
- __is_val_expr<_Expr>::value,
- valarray&
- >::type
- operator%= (const _Expr& __v);
-
- template <class _Expr>
- typename enable_if
- <
- __is_val_expr<_Expr>::value,
- valarray&
- >::type
- operator+= (const _Expr& __v);
-
- template <class _Expr>
- typename enable_if
- <
- __is_val_expr<_Expr>::value,
- valarray&
- >::type
- operator-= (const _Expr& __v);
-
- template <class _Expr>
- typename enable_if
- <
- __is_val_expr<_Expr>::value,
- valarray&
- >::type
- operator^= (const _Expr& __v);
-
- template <class _Expr>
- typename enable_if
- <
- __is_val_expr<_Expr>::value,
- valarray&
- >::type
- operator|= (const _Expr& __v);
-
- template <class _Expr>
- typename enable_if
- <
- __is_val_expr<_Expr>::value,
- valarray&
- >::type
- operator&= (const _Expr& __v);
-
- template <class _Expr>
- typename enable_if
- <
- __is_val_expr<_Expr>::value,
- valarray&
- >::type
- operator<<= (const _Expr& __v);
-
- template <class _Expr>
- typename enable_if
- <
- __is_val_expr<_Expr>::value,
- valarray&
- >::type
- operator>>= (const _Expr& __v);
-
- // member functions:
- void swap(valarray& __v);
-
- _LIBCPP_INLINE_VISIBILITY
- size_t size() const {return __end_ - __begin_;}
-
- value_type sum() const;
- value_type min() const;
- value_type max() const;
-
- valarray shift (int __i) const;
- valarray cshift(int __i) const;
- valarray apply(value_type __f(value_type)) const;
- valarray apply(value_type __f(const value_type&)) const;
- void resize(size_t __n, value_type __x = value_type());
-
-private:
- template <class> friend class _LIBCPP_VISIBLE valarray;
- template <class> friend class _LIBCPP_VISIBLE slice_array;
- template <class> friend class _LIBCPP_VISIBLE gslice_array;
- template <class> friend class _LIBCPP_VISIBLE mask_array;
- template <class> friend class __mask_expr;
- template <class> friend class _LIBCPP_VISIBLE indirect_array;
- template <class> friend class __indirect_expr;
- template <class> friend class __val_expr;
-
- template <class _Up>
- friend
- _Up*
- begin(valarray<_Up>& __v);
-
- template <class _Up>
- friend
- const _Up*
- begin(const valarray<_Up>& __v);
-
- template <class _Up>
- friend
- _Up*
- end(valarray<_Up>& __v);
-
- template <class _Up>
- friend
- const _Up*
- end(const valarray<_Up>& __v);
-};
-
-template <class _Op, class _Tp>
-struct _UnaryOp<_Op, valarray<_Tp> >
-{
- typedef typename _Op::result_type result_type;
- typedef _Tp value_type;
-
- _Op __op_;
- const valarray<_Tp>& __a0_;
-
- _LIBCPP_INLINE_VISIBILITY
- _UnaryOp(const _Op& __op, const valarray<_Tp>& __a0) : __op_(__op), __a0_(__a0) {}
-
- _LIBCPP_INLINE_VISIBILITY
- result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
-
- _LIBCPP_INLINE_VISIBILITY
- size_t size() const {return __a0_.size();}
-};
-
-template <class _Op, class _Tp, class _A1>
-struct _BinaryOp<_Op, valarray<_Tp>, _A1>
-{
- typedef typename _Op::result_type result_type;
- typedef _Tp value_type;
-
- _Op __op_;
- const valarray<_Tp>& __a0_;
- _A1 __a1_;
-
- _LIBCPP_INLINE_VISIBILITY
- _BinaryOp(const _Op& __op, const valarray<_Tp>