[libcxx-commits] [libcxx] d39f5c3 - [libc++] Avoid `result_type` and `unary/binary_function` in <valarray>.

Arthur O'Dwyer via libcxx-commits libcxx-commits at lists.llvm.org
Mon May 31 08:29:28 PDT 2021


Author: Arthur O'Dwyer
Date: 2021-05-31T11:29:16-04:00
New Revision: d39f5c3cb97e769f960681b3132724e16b756e80

URL: https://github.com/llvm/llvm-project/commit/d39f5c3cb97e769f960681b3132724e16b756e80
DIFF: https://github.com/llvm/llvm-project/commit/d39f5c3cb97e769f960681b3132724e16b756e80.diff

LOG: [libc++] Avoid `result_type` and `unary/binary_function` in <valarray>.

Give each of the relevant functional operators a `__result_type`
instead, so that we can keep using those typedefs in <valarray>
even when the public binder typedefs are removed in C++20.

Differential Revision: https://reviews.llvm.org/D103371

Added: 
    

Modified: 
    libcxx/include/__functional_base
    libcxx/include/functional
    libcxx/include/valarray

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__functional_base b/libcxx/include/__functional_base
index 0c438275da60..cdef0f88fcb5 100644
--- a/libcxx/include/__functional_base
+++ b/libcxx/include/__functional_base
@@ -49,6 +49,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS less : binary_function<_Tp, _Tp, bool>
 {
+    typedef bool __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x < __y;}

diff  --git a/libcxx/include/functional b/libcxx/include/functional
index a08154869ced..62e9b899e0af 100644
--- a/libcxx/include/functional
+++ b/libcxx/include/functional
@@ -531,6 +531,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS plus : binary_function<_Tp, _Tp, _Tp>
 {
+    typedef _Tp __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x + __y;}
@@ -558,6 +559,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS minus : binary_function<_Tp, _Tp, _Tp>
 {
+    typedef _Tp __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x - __y;}
@@ -585,6 +587,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS multiplies : binary_function<_Tp, _Tp, _Tp>
 {
+    typedef _Tp __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x * __y;}
@@ -612,6 +615,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS divides : binary_function<_Tp, _Tp, _Tp>
 {
+    typedef _Tp __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x / __y;}
@@ -639,6 +643,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS modulus : binary_function<_Tp, _Tp, _Tp>
 {
+    typedef _Tp __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x % __y;}
@@ -666,6 +671,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS negate : unary_function<_Tp, _Tp>
 {
+    typedef _Tp __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return -__x;}
@@ -693,6 +699,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS equal_to : binary_function<_Tp, _Tp, bool>
 {
+    typedef bool __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x == __y;}
@@ -720,6 +727,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS not_equal_to : binary_function<_Tp, _Tp, bool>
 {
+    typedef bool __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x != __y;}
@@ -747,6 +755,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS greater : binary_function<_Tp, _Tp, bool>
 {
+    typedef bool __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x > __y;}
@@ -776,6 +785,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS greater_equal : binary_function<_Tp, _Tp, bool>
 {
+    typedef bool __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x >= __y;}
@@ -803,6 +813,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS less_equal : binary_function<_Tp, _Tp, bool>
 {
+    typedef bool __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x <= __y;}
@@ -830,6 +841,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS logical_and : binary_function<_Tp, _Tp, bool>
 {
+    typedef bool __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x && __y;}
@@ -857,6 +869,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS logical_or : binary_function<_Tp, _Tp, bool>
 {
+    typedef bool __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x || __y;}
@@ -884,6 +897,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS logical_not : unary_function<_Tp, bool>
 {
+    typedef bool __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x) const
         {return !__x;}
@@ -911,6 +925,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS bit_and : binary_function<_Tp, _Tp, _Tp>
 {
+    typedef _Tp __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x & __y;}
@@ -938,6 +953,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS bit_or : binary_function<_Tp, _Tp, _Tp>
 {
+    typedef _Tp __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x | __y;}
@@ -965,6 +981,7 @@ template <class _Tp>
 #endif
 struct _LIBCPP_TEMPLATE_VIS bit_xor : binary_function<_Tp, _Tp, _Tp>
 {
+    typedef _Tp __result_type;  // used by valarray
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x ^ __y;}

diff  --git a/libcxx/include/valarray b/libcxx/include/valarray
index beb0e1d7031a..1eb25fd76329 100644
--- a/libcxx/include/valarray
+++ b/libcxx/include/valarray
@@ -412,7 +412,7 @@ end(const valarray<_Tp>& __v);
 template <class _Op, class _A0>
 struct _UnaryOp
 {
-    typedef typename _Op::result_type result_type;
+    typedef typename _Op::__result_type __result_type;
     typedef typename _A0::value_type value_type;
 
     _Op __op_;
@@ -422,7 +422,7 @@ struct _UnaryOp
     _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]);}
+    __result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
 
     _LIBCPP_INLINE_VISIBILITY
     size_t size() const {return __a0_.size();}
@@ -431,7 +431,7 @@ struct _UnaryOp
 template <class _Op, class _A0, class _A1>
 struct _BinaryOp
 {
-    typedef typename _Op::result_type result_type;
+    typedef typename _Op::__result_type __result_type;
     typedef typename _A0::value_type value_type;
 
     _Op __op_;
@@ -454,7 +454,7 @@ class __scalar_expr
 {
 public:
     typedef _Tp        value_type;
-    typedef const _Tp& result_type;
+    typedef const _Tp& __result_type;
 private:
     const value_type& __t_;
     size_t __s_;
@@ -463,50 +463,56 @@ public:
     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_;}
+    __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>
+struct __unary_plus
 {
+    typedef _Tp __result_type;
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return +__x;}
 };
 
 template <class _Tp>
-struct __bit_not  : unary_function<_Tp, _Tp>
+struct __bit_not
 {
+    typedef _Tp __result_type;
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return ~__x;}
 };
 
 template <class _Tp>
-struct __bit_shift_left : binary_function<_Tp, _Tp, _Tp>
+struct __bit_shift_left
 {
+    typedef _Tp __result_type;
     _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>
+struct __bit_shift_right
 {
+    typedef _Tp __result_type;
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x, const _Tp& __y) const
         {return __x >> __y;}
 };
 
 template <class _Tp, class _Fp>
-struct __apply_expr   : unary_function<_Tp, _Tp>
+struct __apply_expr
 {
 private:
     _Fp __f_;
 public:
+    typedef _Tp __result_type;
+
     _LIBCPP_INLINE_VISIBILITY
     explicit __apply_expr(_Fp __f) : __f_(__f) {}
 
@@ -516,128 +522,144 @@ public:
 };
 
 template <class _Tp>
-struct __abs_expr : unary_function<_Tp, _Tp>
+struct __abs_expr
 {
+    typedef _Tp __result_type;
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return abs(__x);}
 };
 
 template <class _Tp>
-struct __acos_expr : unary_function<_Tp, _Tp>
+struct __acos_expr
 {
+    typedef _Tp __result_type;
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return acos(__x);}
 };
 
 template <class _Tp>
-struct __asin_expr : unary_function<_Tp, _Tp>
+struct __asin_expr
 {
+    typedef _Tp __result_type;
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return asin(__x);}
 };
 
 template <class _Tp>
-struct __atan_expr : unary_function<_Tp, _Tp>
+struct __atan_expr
 {
+    typedef _Tp __result_type;
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return atan(__x);}
 };
 
 template <class _Tp>
-struct __atan2_expr : binary_function<_Tp, _Tp, _Tp>
+struct __atan2_expr
 {
+    typedef _Tp __result_type;
     _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>
+struct __cos_expr
 {
+    typedef _Tp __result_type;
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return cos(__x);}
 };
 
 template <class _Tp>
-struct __cosh_expr : unary_function<_Tp, _Tp>
+struct __cosh_expr
 {
+    typedef _Tp __result_type;
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return cosh(__x);}
 };
 
 template <class _Tp>
-struct __exp_expr : unary_function<_Tp, _Tp>
+struct __exp_expr
 {
+    typedef _Tp __result_type;
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return exp(__x);}
 };
 
 template <class _Tp>
-struct __log_expr : unary_function<_Tp, _Tp>
+struct __log_expr
 {
+    typedef _Tp __result_type;
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return log(__x);}
 };
 
 template <class _Tp>
-struct __log10_expr : unary_function<_Tp, _Tp>
+struct __log10_expr
 {
+    typedef _Tp __result_type;
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return log10(__x);}
 };
 
 template <class _Tp>
-struct __pow_expr : binary_function<_Tp, _Tp, _Tp>
+struct __pow_expr
 {
+    typedef _Tp __result_type;
     _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>
+struct __sin_expr
 {
+    typedef _Tp __result_type;
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return sin(__x);}
 };
 
 template <class _Tp>
-struct __sinh_expr : unary_function<_Tp, _Tp>
+struct __sinh_expr
 {
+    typedef _Tp __result_type;
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return sinh(__x);}
 };
 
 template <class _Tp>
-struct __sqrt_expr : unary_function<_Tp, _Tp>
+struct __sqrt_expr
 {
+    typedef _Tp __result_type;
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return sqrt(__x);}
 };
 
 template <class _Tp>
-struct __tan_expr : unary_function<_Tp, _Tp>
+struct __tan_expr
 {
+    typedef _Tp __result_type;
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return tan(__x);}
 };
 
 template <class _Tp>
-struct __tanh_expr : unary_function<_Tp, _Tp>
+struct __tanh_expr
 {
+    typedef _Tp __result_type;
     _LIBCPP_INLINE_VISIBILITY
     _Tp operator()(const _Tp& __x) const
         {return tanh(__x);}
@@ -649,7 +671,7 @@ class __slice_expr
     typedef typename remove_reference<_ValExpr>::type  _RmExpr;
 public:
     typedef typename _RmExpr::value_type value_type;
-    typedef value_type result_type;
+    typedef value_type __result_type;
 
 private:
     _ValExpr __expr_;
@@ -667,7 +689,7 @@ private:
 public:
 
     _LIBCPP_INLINE_VISIBILITY
-    result_type operator[](size_t __i) const
+    __result_type operator[](size_t __i) const
         {return __expr_[__start_ + __i * __stride_];}
 
     _LIBCPP_INLINE_VISIBILITY
@@ -689,7 +711,7 @@ class __shift_expr
     typedef typename remove_reference<_ValExpr>::type  _RmExpr;
 public:
     typedef typename _RmExpr::value_type value_type;
-    typedef value_type result_type;
+    typedef value_type __result_type;
 
 private:
     _ValExpr __expr_;
@@ -713,7 +735,7 @@ private:
 public:
 
     _LIBCPP_INLINE_VISIBILITY
-    result_type operator[](size_t __j) const
+    __result_type operator[](size_t __j) const
         {
             ptr
diff _t __i = static_cast<ptr
diff _t>(__j);
             ptr
diff _t __m = (__sn_ * __i - __ul_) >> _Np;
@@ -732,7 +754,7 @@ class __cshift_expr
     typedef typename remove_reference<_ValExpr>::type  _RmExpr;
 public:
     typedef typename _RmExpr::value_type value_type;
-    typedef value_type result_type;
+    typedef value_type __result_type;
 
 private:
     _ValExpr __expr_;
@@ -763,7 +785,7 @@ private:
 public:
 
     _LIBCPP_INLINE_VISIBILITY
-    result_type operator[](size_t __i) const
+    __result_type operator[](size_t __i) const
         {
             if (__i < __m_)
                 return __expr_[__i + __o1_];
@@ -793,7 +815,7 @@ class _LIBCPP_TEMPLATE_VIS valarray
 {
 public:
     typedef _Tp value_type;
-    typedef _Tp result_type;
+    typedef _Tp __result_type;
 
 private:
     value_type* __begin_;
@@ -1064,7 +1086,7 @@ _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void valarray<size_t>::resize(size_t, s
 template <class _Op, class _Tp>
 struct _UnaryOp<_Op, valarray<_Tp> >
 {
-    typedef typename _Op::result_type result_type;
+    typedef typename _Op::__result_type __result_type;
     typedef _Tp value_type;
 
     _Op __op_;
@@ -1074,7 +1096,7 @@ struct _UnaryOp<_Op, valarray<_Tp> >
     _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]);}
+    __result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
 
     _LIBCPP_INLINE_VISIBILITY
     size_t size() const {return __a0_.size();}
@@ -1083,7 +1105,7 @@ struct _UnaryOp<_Op, valarray<_Tp> >
 template <class _Op, class _Tp, class _A1>
 struct _BinaryOp<_Op, valarray<_Tp>, _A1>
 {
-    typedef typename _Op::result_type result_type;
+    typedef typename _Op::__result_type __result_type;
     typedef _Tp value_type;
 
     _Op __op_;
@@ -1104,7 +1126,7 @@ struct _BinaryOp<_Op, valarray<_Tp>, _A1>
 template <class _Op, class _A0, class _Tp>
 struct _BinaryOp<_Op, _A0, valarray<_Tp> >
 {
-    typedef typename _Op::result_type result_type;
+    typedef typename _Op::__result_type __result_type;
     typedef _Tp value_type;
 
     _Op __op_;
@@ -1125,7 +1147,7 @@ struct _BinaryOp<_Op, _A0, valarray<_Tp> >
 template <class _Op, class _Tp>
 struct _BinaryOp<_Op, valarray<_Tp>, valarray<_Tp> >
 {
-    typedef typename _Op::result_type result_type;
+    typedef typename _Op::__result_type __result_type;
     typedef _Tp value_type;
 
     _Op __op_;
@@ -2198,7 +2220,7 @@ class __mask_expr
     typedef typename remove_reference<_ValExpr>::type  _RmExpr;
 public:
     typedef typename _RmExpr::value_type value_type;
-    typedef value_type result_type;
+    typedef value_type __result_type;
 
 private:
     _ValExpr __expr_;
@@ -2217,7 +2239,7 @@ private:
 
 public:
     _LIBCPP_INLINE_VISIBILITY
-    result_type operator[](size_t __i) const
+    __result_type operator[](size_t __i) const
         {return __expr_[__1d_[__i]];}
 
     _LIBCPP_INLINE_VISIBILITY
@@ -2561,7 +2583,7 @@ class __indirect_expr
     typedef typename remove_reference<_ValExpr>::type  _RmExpr;
 public:
     typedef typename _RmExpr::value_type value_type;
-    typedef value_type result_type;
+    typedef value_type __result_type;
 
 private:
     _ValExpr __expr_;
@@ -2585,7 +2607,7 @@ private:
 
 public:
     _LIBCPP_INLINE_VISIBILITY
-    result_type operator[](size_t __i) const
+    __result_type operator[](size_t __i) const
         {return __expr_[__1d_[__i]];}
 
     _LIBCPP_INLINE_VISIBILITY
@@ -2603,13 +2625,13 @@ class __val_expr
     _ValExpr __expr_;
 public:
     typedef typename _RmExpr::value_type value_type;
-    typedef typename _RmExpr::result_type result_type;
+    typedef typename _RmExpr::__result_type __result_type;
 
     _LIBCPP_INLINE_VISIBILITY
     explicit __val_expr(const _RmExpr& __e) : __expr_(__e) {}
 
     _LIBCPP_INLINE_VISIBILITY
-    result_type operator[](size_t __i) const
+    __result_type operator[](size_t __i) const
         {return __expr_[__i];}
 
     _LIBCPP_INLINE_VISIBILITY
@@ -2672,29 +2694,29 @@ public:
         return __val_expr<_NewExpr>(_NewExpr(logical_not<value_type>(), __expr_));
     }
 
-    operator valarray<result_type>() const;
+    operator valarray<__result_type>() const;
 
     _LIBCPP_INLINE_VISIBILITY
     size_t size() const {return __expr_.size();}
 
     _LIBCPP_INLINE_VISIBILITY
-    result_type sum() const
+    __result_type sum() const
     {
         size_t __n = __expr_.size();
-        result_type __r = __n ? __expr_[0] : result_type();
+        __result_type __r = __n ? __expr_[0] : __result_type();
         for (size_t __i = 1; __i < __n; ++__i)
             __r += __expr_[__i];
         return __r;
     }
 
     _LIBCPP_INLINE_VISIBILITY
-    result_type min() const
+    __result_type min() const
     {
         size_t __n = size();
-        result_type __r = __n ? (*this)[0] : result_type();
+        __result_type __r = __n ? (*this)[0] : __result_type();
         for (size_t __i = 1; __i < __n; ++__i)
         {
-            result_type __x = __expr_[__i];
+            __result_type __x = __expr_[__i];
             if (__x < __r)
                 __r = __x;
         }
@@ -2702,13 +2724,13 @@ public:
     }
 
     _LIBCPP_INLINE_VISIBILITY
-    result_type max() const
+    __result_type max() const
     {
         size_t __n = size();
-        result_type __r = __n ? (*this)[0] : result_type();
+        __result_type __r = __n ? (*this)[0] : __result_type();
         for (size_t __i = 1; __i < __n; ++__i)
         {
-            result_type __x = __expr_[__i];
+            __result_type __x = __expr_[__i];
             if (__r < __x)
                 __r = __x;
         }
@@ -2743,16 +2765,16 @@ public:
 };
 
 template<class _ValExpr>
-__val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const
+__val_expr<_ValExpr>::operator valarray<__val_expr::__result_type>() const
 {
-    valarray<result_type> __r;
+    valarray<__result_type> __r;
     size_t __n = __expr_.size();
     if (__n)
     {
         __r.__begin_ =
-            __r.__end_ = allocator<result_type>().allocate(__n);
+            __r.__end_ = allocator<__result_type>().allocate(__n);
         for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i)
-            ::new ((void*)__r.__end_) result_type(__expr_[__i]);
+            ::new ((void*)__r.__end_) __result_type(__expr_[__i]);
     }
     return __r;
 }
@@ -3130,7 +3152,7 @@ valarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v)
         resize(__n);
     value_type* __t = __begin_;
     for (size_t __i = 0; __i != __n; ++__t, ++__i)
-        *__t = result_type(__v[__i]);
+        *__t = __result_type(__v[__i]);
     return *this;
 }
 


        


More information about the libcxx-commits mailing list