This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

V3 PATCH: valarray fixes (3)


This adds more conformance and better performance.

Bootstrapped and tested on an i686-pc-linux.

Mainline.

-- Gaby
2002-08-03  Gabriel Dos Reis  <gdr@nerim.net>

	* include/bits/valarray_array.h (_DEFINE_ARRAY_FUNCTION): Use our
	object function surrogates.
	* include/bits/valarray_meta.h (__shift_left): Fix typo.
	(_BinFunClos<>): Remove.
	(_BinFunBase<>): Likewise.
	(_BinFunBase1<>):Likewise.
	(_BinFunBase2<>): Likewise.
	(_DEFINE_EXPR_RELATIONAL_OPERATOR): Likewise.
	(_DEFINE_EXPR_UNARY_OPERATOR): Adjust definition.
	(_DEFINE_EXPR_BINARY_OPERATOR): Likewise.
	(_DEFINE_EXPR_BINARY_FUNCTION): Likewise.
	* include/std/std_valarray.h: Dont #include <functional> anymore.
	(_Bitwise_or<>, _Bitwise_and<>, _Bitwise_xor<>, _Shift_left<>,
	_Shift_right<>): Remove.
	(_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT): Adjust instantiation.
	(_DEFINE_BINARY_OPERATOR): Tweak definition.
	(_DEFINE_LOGICAL_OPERATOR): Remove.
	* testsuite/26_numerics/valarray_name_lookup.C (main): Add more tests.

Index: include/bits/valarray_array.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/valarray_array.h,v
retrieving revision 1.8
diff -p -r1.8 valarray_array.h
*** include/bits/valarray_array.h	16 Jan 2002 19:57:31 -0000	1.8
--- include/bits/valarray_array.h	2 Aug 2002 22:47:46 -0000
*************** _Array_augmented_##_Name (_Array<_Tp> __
*** 603,618 ****
      }									\
  }
  
!    _DEFINE_ARRAY_FUNCTION(+, plus)
!    _DEFINE_ARRAY_FUNCTION(-, minus)
!    _DEFINE_ARRAY_FUNCTION(*, multiplies)
!    _DEFINE_ARRAY_FUNCTION(/, divides)
!    _DEFINE_ARRAY_FUNCTION(%, modulus)
!    _DEFINE_ARRAY_FUNCTION(^, xor)
!    _DEFINE_ARRAY_FUNCTION(|, or)
!    _DEFINE_ARRAY_FUNCTION(&, and)    
!    _DEFINE_ARRAY_FUNCTION(<<, shift_left)
!    _DEFINE_ARRAY_FUNCTION(>>, shift_right)
  
  #undef _DEFINE_VALARRAY_FUNCTION    
  
--- 603,618 ----
      }									\
  }
  
!    _DEFINE_ARRAY_FUNCTION(+, __plus)
!    _DEFINE_ARRAY_FUNCTION(-, __minus)
!    _DEFINE_ARRAY_FUNCTION(*, __multiplies)
!    _DEFINE_ARRAY_FUNCTION(/, __divides)
!    _DEFINE_ARRAY_FUNCTION(%, __modulus)
!    _DEFINE_ARRAY_FUNCTION(^, __bitwise_xor)
!    _DEFINE_ARRAY_FUNCTION(|, __bitwise_or)
!    _DEFINE_ARRAY_FUNCTION(&, __bitwise_and)    
!    _DEFINE_ARRAY_FUNCTION(<<, __shift_left)
!    _DEFINE_ARRAY_FUNCTION(>>, __shift_right)
  
  #undef _DEFINE_VALARRAY_FUNCTION    
  
Index: include/bits/valarray_meta.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/valarray_meta.h,v
retrieving revision 1.10
diff -p -r1.10 valarray_meta.h
*** include/bits/valarray_meta.h	2 Aug 2002 18:10:38 -0000	1.10
--- include/bits/valarray_meta.h	2 Aug 2002 22:47:46 -0000
*************** namespace std
*** 50,56 ****
    // template nesting due to _Expr<>
    //
    
-   
    // This class is NOT defined. It doesn't need to.
    template<typename _Tp1, typename _Tp2> class _Constant;
  
--- 50,55 ----
*************** namespace std
*** 224,230 ****
        { return __x | __y; }
    };
  
!   struct __shift__left
    {
      template<typename _Tp>
        _Tp operator()(const _Tp& __x, const _Tp& __y) const
--- 223,229 ----
        { return __x | __y; }
    };
  
!   struct __shift_left
    {
      template<typename _Tp>
        _Tp operator()(const _Tp& __x, const _Tp& __y) const
*************** namespace std
*** 381,601 ****
      };
  
      //
-     // Binary function application closure.
-     //
-     template<template<class, class> class _Meta1,
-         template<class, class> class Meta2,
-         class _Dom1, class _Dom2> class _BinFunClos;
-     
-     template<class _Dom1, class _Dom2> class _BinFunBase {
-     public:
-         typedef typename _Dom1::value_type value_type;
-         typedef value_type _Vt;
- 
-         _BinFunBase (const _Dom1& __e1, const _Dom2& __e2,
-                       _Vt __f (_Vt, _Vt))
-                 : _M_expr1 (__e1), _M_expr2 (__e2), _M_func (__f) {}
- 
-         value_type operator[] (size_t __i) const
-         { return _M_func (_M_expr1[__i], _M_expr2[__i]); }
-         size_t size () const { return _M_expr1.size (); }
- 
-     private:
-         const _Dom1& _M_expr1;
-         const _Dom2& _M_expr2;
-         _Vt (*_M_func)(_Vt, _Vt);
-     };
- 
-     template<class _Dom> class _BinFunBase1 {
-     public:
-         typedef typename _Dom::value_type value_type ;
-         typedef value_type _Vt;
- 
-         _BinFunBase1 (const _Vt& __c, const _Dom& __e, _Vt __f(_Vt, _Vt))
-                 : _M_expr1 (__c), _M_expr2 (__e), _M_func (__f) {}
- 
-         value_type operator[] (size_t __i) const
-         { return _M_func (_M_expr1, _M_expr2[__i]); }
-         size_t size () const { return _M_expr2.size (); }
- 
-     private:
-         const _Vt& _M_expr1;
-         const _Dom& _M_expr2;
-         _Vt (*_M_func)(_Vt, _Vt);
-     };
- 
-     template<class _Dom> class _BinFunBase2 {
-     public:
-         typedef typename _Dom::value_type value_type;
-         typedef value_type _Vt;
- 
-         _BinFunBase2 (const _Dom& __e, const _Vt& __c, _Vt __f(_Vt, _Vt))
-                 : _M_expr1 (__e), _M_expr2 (__c), _M_func (__f) {}
- 
-         value_type operator[] (size_t __i) const
-         { return _M_func (_M_expr1[__i], _M_expr2); }
-         size_t size () const { return _M_expr1.size (); }
- 
-     private:
-         const _Dom& _M_expr1;
-         const _Vt& _M_expr2;
-         _Vt (*_M_func)(_Vt, _Vt);
-     };
- 
-     template<class _Dom1, class _Dom2>
-     struct _BinFunClos<_Expr,_Expr,_Dom1,_Dom2> : _BinFunBase<_Dom1,_Dom2> {
-         typedef _BinFunBase<_Dom1,_Dom2> _Base;
-         typedef typename _Base::value_type value_type;
-         typedef value_type _Tp;
- 
-         _BinFunClos (const _Dom1& __e1, const _Dom2& __e2,
-                      _Tp __f(_Tp, _Tp))
-                 : _Base (__e1, __e2, __f) {}
-     };
- 
-     template<typename _Tp>
-     struct _BinFunClos<_ValArray,_ValArray,_Tp,_Tp>
-         : _BinFunBase<valarray<_Tp>, valarray<_Tp> > {
-         typedef _BinFunBase<valarray<_Tp>, valarray<_Tp> > _Base;
-         typedef _Tp value_type;
- 
-         _BinFunClos (const valarray<_Tp>& __v, const valarray<_Tp>& __w,
-                      _Tp __f(_Tp, _Tp))
-                 : _Base (__v, __w, __f) {}
-     };
-     
-     template<class _Dom>
-     struct _BinFunClos<_Expr,_ValArray,_Dom,typename _Dom::value_type>
-         : _BinFunBase<_Dom,valarray<typename _Dom::value_type> > {
-         typedef typename _Dom::value_type _Tp;
-         typedef _BinFunBase<_Dom,valarray<_Tp> > _Base;
-         typedef _Tp value_type;
- 
-         _BinFunClos (const _Dom& __e, const valarray<_Tp>& __v,
-                      _Tp __f(_Tp, _Tp))
-                 : _Base (__e, __v, __f) {}
-     };
- 
-     template<class _Dom>
-     struct _BinFunClos<_ValArray,_Expr,typename _Dom::value_type,_Dom>
-         : _BinFunBase<valarray<typename _Dom::value_type>,_Dom> {
-         typedef typename _Dom::value_type _Tp;
-         typedef _BinFunBase<_Dom,valarray<_Tp> > _Base;
-         typedef _Tp value_type;
- 
-         _BinFunClos (const valarray<_Tp>& __v, const _Dom& __e,
-                      _Tp __f(_Tp, _Tp))
-                 : _Base (__v, __e, __f) {}
-     };
- 
-     template<class _Dom>
-     struct _BinFunClos<_Expr,_Constant,_Dom,typename _Dom::value_type>
-         : _BinFunBase2<_Dom> {
-         typedef typename _Dom::value_type _Tp;
-         typedef _Tp value_type;
-         typedef _BinFunBase2<_Dom> _Base;
- 
-         _BinFunClos (const _Dom& __e, const _Tp& __t, _Tp __f (_Tp, _Tp))
-                 : _Base (__e, __t, __f) {}
-     };
- 
-     template<class _Dom>
-     struct _BinFunClos<_Constant,_Expr,_Dom,typename _Dom::value_type>
-         : _BinFunBase1<_Dom> {
-         typedef typename _Dom::value_type _Tp;
-         typedef _Tp value_type;
-         typedef _BinFunBase1<_Dom> _Base;
- 
-         _BinFunClos (const _Tp& __t, const _Dom& __e, _Tp __f (_Tp, _Tp))
-                 : _Base (__t, __e, __f) {}
-     };
- 
-     template<typename _Tp>
-     struct _BinFunClos<_ValArray,_Constant,_Tp,_Tp>
-         : _BinFunBase2<valarray<_Tp> > {
-         typedef _BinFunBase2<valarray<_Tp> > _Base;
-         typedef _Tp value_type;
- 
-         _BinFunClos (const valarray<_Tp>& __v, const _Tp& __t,
-                      _Tp __f(_Tp, _Tp))
-                 : _Base (__v, __t, __f) {}
-     };
- 
-     template<typename _Tp>
-     struct _BinFunClos<_Constant,_ValArray,_Tp,_Tp>
-         : _BinFunBase1<valarray<_Tp> > {
-         typedef _BinFunBase1<valarray<_Tp> > _Base;
-         typedef _Tp value_type;
- 
-         _BinFunClos (const _Tp& __t, const valarray<_Tp>& __v,
-                      _Tp __f (_Tp, _Tp))
-                 : _Base (__t, __v, __f) {}
-     };
- 
-     //
      // Apply function taking a value/const reference closure
      //
  
!     template<typename _Dom, typename _Arg> class _FunBase {
      public:
!         typedef typename _Dom::value_type value_type;
  
!         _FunBase (const _Dom& __e, value_type __f(_Arg))
!                 : _M_expr (__e), _M_func (__f) {}
  
!         value_type operator[] (size_t __i) const
!         { return _M_func (_M_expr[__i]); }
!         size_t size() const { return _M_expr.size ();}
  
      private:
          const _Dom& _M_expr;
          value_type (*_M_func)(_Arg);
      };
  
!     template<class _Dom>
!     struct _ValFunClos<_Expr,_Dom>
!         : _FunBase<_Dom, typename _Dom::value_type> {
!         typedef _FunBase<_Dom, typename _Dom::value_type> _Base;
!         typedef typename _Base::value_type value_type;
!         typedef value_type _Tp;
      
!         _ValFunClos (const _Dom& __e, _Tp __f (_Tp)) : _Base (__e, __f) {}
      };
  
!     template<typename _Tp>
!     struct _ValFunClos<_ValArray,_Tp>
!         : _FunBase<valarray<_Tp>, _Tp> {
!         typedef _FunBase<valarray<_Tp>, _Tp> _Base;
!         typedef _Tp value_type;
! 
!         _ValFunClos (const valarray<_Tp>& __v, _Tp __f(_Tp))
!                 : _Base (__v, __f) {}
      };
  
!     template<class _Dom>
      struct _RefFunClos<_Expr,_Dom> :
!         _FunBase<_Dom, const typename _Dom::value_type&> {
!         typedef _FunBase<_Dom, const typename _Dom::value_type&> _Base;
!         typedef typename _Base::value_type value_type;
!         typedef value_type _Tp;
! 
!         _RefFunClos (const _Dom& __e, _Tp __f (const _Tp&))
!                 : _Base (__e, __f) {}
      };
  
!     template<typename _Tp>
!     struct _RefFunClos<_ValArray,_Tp>
!         : _FunBase<valarray<_Tp>, const _Tp&> {
!         typedef _FunBase<valarray<_Tp>, const _Tp&> _Base;
!         typedef _Tp value_type;
!         
!         _RefFunClos (const valarray<_Tp>& __v, _Tp __f(const _Tp&))
!                 : _Base (__v, __f) {}
      };
      
!     //
!     // Unary expression closure.
!     //
  
    template<class _Oper, class _Arg>
      class _UnBase
--- 380,451 ----
      };
  
      //
      // Apply function taking a value/const reference closure
      //
  
!   template<typename _Dom, typename _Arg>
!     class _FunBase 
!     {
      public:
!       typedef typename _Dom::value_type value_type;
!       
!       _FunBase(const _Dom& __e, value_type __f(_Arg))
! 	: _M_expr(__e), _M_func(__f) {}
  
!       value_type operator[](size_t __i) const
!       { return _M_func (_M_expr[__i]); }
  
!       size_t size() const { return _M_expr.size ();}
  
      private:
          const _Dom& _M_expr;
          value_type (*_M_func)(_Arg);
      };
  
!   template<class _Dom>
!     struct _ValFunClos<_Expr,_Dom> : _FunBase<_Dom, typename _Dom::value_type> 
!     {
!       typedef _FunBase<_Dom, typename _Dom::value_type> _Base;
!       typedef typename _Base::value_type value_type;
!       typedef value_type _Tp;
      
!       _ValFunClos(const _Dom& __e, _Tp __f(_Tp)) : _Base(__e, __f) {}
      };
  
!   template<typename _Tp>
!     struct _ValFunClos<_ValArray,_Tp> : _FunBase<valarray<_Tp>, _Tp>
!     {
!       typedef _FunBase<valarray<_Tp>, _Tp> _Base;
!       typedef _Tp value_type;
!       
!       _ValFunClos(const valarray<_Tp>& __v, _Tp __f(_Tp)) : _Base(__v, __f) {}
      };
  
!   template<class _Dom>
      struct _RefFunClos<_Expr,_Dom> :
!         _FunBase<_Dom, const typename _Dom::value_type&> 
!     {
!       typedef _FunBase<_Dom, const typename _Dom::value_type&> _Base;
!       typedef typename _Base::value_type value_type;
!       typedef value_type _Tp;
!       
!       _RefFunClos(const _Dom& __e, _Tp __f(const _Tp&))
! 	: _Base(__e, __f) {}
      };
  
!   template<typename _Tp>
!     struct _RefFunClos<_ValArray,_Tp> : _FunBase<valarray<_Tp>, const _Tp&> 
!     {
!       typedef _FunBase<valarray<_Tp>, const _Tp&> _Base;
!       typedef _Tp value_type;
!       
!       _RefFunClos(const valarray<_Tp>& __v, _Tp __f(const _Tp&))
! 	: _Base(__v, __f) {}
      };
      
!   //
!   // Unary expression closure.
!   //
  
    template<class _Oper, class _Arg>
      class _UnBase
*************** namespace std
*** 636,795 ****
      };
  
  
!     //
!     // Binary expression closure.
!     //
  
!     template<template<class> class _Oper,
!         typename _FirstArg, typename _SecondArg>
!     class _BinBase {
      public:
!         typedef _Oper<typename _FirstArg::value_type> _Op;
!         typedef typename _Op::result_type value_type;
  
!         _BinBase (const _FirstArg& __e1, const _SecondArg& __e2)
!                 : _M_expr1 (__e1), _M_expr2 (__e2) {}
!         value_type operator[] (size_t) const;
!         size_t size () const { return _M_expr1.size (); }
          
      private:
!         const _FirstArg& _M_expr1;
!         const _SecondArg& _M_expr2;
      };
  
-     template<template<class> class _Oper,
-         typename _FirstArg, typename _SecondArg>
-     inline typename _BinBase<_Oper,_FirstArg,_SecondArg>::value_type
-     _BinBase<_Oper,_FirstArg,_SecondArg>::operator[] (size_t __i) const
-     { return _Op() (_M_expr1[__i], _M_expr2[__i]); }
  
! 
!     template<template<class> class _Oper, class _Clos>
!     class _BinBase2 {
      public:
!         typedef typename _Clos::value_type _Vt;
!         typedef _Oper<_Vt> _Op;
!         typedef typename _Op::result_type value_type;
! 
!         _BinBase2 (const _Clos& __e, const _Vt& __t)
!                 : _M_expr1 (__e), _M_expr2 (__t) {}
!         value_type operator[] (size_t) const;
!         size_t size () const { return _M_expr1.size (); }
  
      private:
!         const _Clos& _M_expr1;
!         const _Vt& _M_expr2;
      };
  
!     template<template<class> class _Oper, class _Clos>
!     inline typename _BinBase2<_Oper,_Clos>::value_type
!     _BinBase2<_Oper,_Clos>::operator[] (size_t __i) const
!     { return _Op() (_M_expr1[__i], _M_expr2); }
  
  
!     template<template<class> class _Oper, class _Clos>
!     class _BinBase1 {
!     public:
!         typedef typename _Clos::value_type _Vt;
!         typedef _Oper<_Vt> _Op;
!         typedef typename _Op::result_type value_type;
! 
!         _BinBase1 (const _Vt& __t, const _Clos& __e)
!                 : _M_expr1 (__t), _M_expr2 (__e) {}
!         value_type operator[] (size_t) const;
!         size_t size () const { return _M_expr2.size (); }
  
      private:
!         const _Vt& _M_expr1;
!         const _Clos& _M_expr2;
      };
- 
-     template<template<class> class _Oper, class _Clos>
-     inline typename
-     _BinBase1<_Oper,_Clos>::value_type
-     _BinBase1<_Oper,_Clos>:: operator[] (size_t __i) const
-     { return _Op() (_M_expr1, _M_expr2[__i]); }
- 
      
!     template<template<class> class _Oper, class _Dom1, class _Dom2>
!     struct  _BinClos<_Oper, _Expr, _Expr, _Dom1, _Dom2>
!         : _BinBase<_Oper,_Dom1,_Dom2> {
!         typedef _BinBase<_Oper,_Dom1,_Dom2> _Base;
!         typedef typename _Base::value_type value_type;
          
!         _BinClos(const _Dom1& __e1, const _Dom2& __e2) : _Base(__e1, __e2) {}
      };
  
!     template<template<class> class _Oper, typename _Tp>
      struct _BinClos<_Oper,_ValArray,_ValArray,_Tp,_Tp>
!         : _BinBase<_Oper,valarray<_Tp>,valarray<_Tp> > {
!         typedef _BinBase<_Oper,valarray<_Tp>,valarray<_Tp> > _Base;
!         typedef _Tp value_type;
  
!         _BinClos (const valarray<_Tp>& __v, const valarray<_Tp>& __w)
!                 : _Base (__v, __w) {}
      };
  
!     template<template<class> class _Oper, class _Dom>
!     struct  _BinClos<_Oper,_Expr,_ValArray,_Dom,typename _Dom::value_type>
!         : _BinBase<_Oper,_Dom,valarray<typename _Dom::value_type> > {
!         typedef typename _Dom::value_type _Tp;
!         typedef _BinBase<_Oper,_Dom,valarray<_Tp> > _Base;
!         typedef typename _Base::value_type value_type;
! 
!         _BinClos(const _Dom& __e1, const valarray<_Tp>& __e2)
!                 : _Base (__e1, __e2) {}
      };
  
!     template<template<class> class _Oper, class _Dom>
      struct  _BinClos<_Oper,_ValArray,_Expr,typename _Dom::value_type,_Dom>
!         : _BinBase<_Oper,valarray<typename _Dom::value_type>,_Dom> {
!         typedef typename _Dom::value_type _Tp;
!         typedef _BinBase<_Oper,valarray<_Tp>,_Dom> _Base;
!         typedef typename _Base::value_type value_type;
! 
!         _BinClos (const valarray<_Tp>& __e1, const _Dom& __e2)
!                 : _Base (__e1, __e2) {}
      };
  
!     template<template<class> class _Oper, class _Dom>
      struct _BinClos<_Oper,_Expr,_Constant,_Dom,typename _Dom::value_type>
!         : _BinBase2<_Oper,_Dom> {
!         typedef typename _Dom::value_type _Tp;
!         typedef _BinBase2<_Oper,_Dom> _Base;
!         typedef typename _Base::value_type value_type;
! 
!         _BinClos (const _Dom& __e1, const _Tp& __e2) : _Base (__e1, __e2) {}
      };
  
!     template<template<class> class _Oper, class _Dom>
      struct _BinClos<_Oper,_Constant,_Expr,typename _Dom::value_type,_Dom>
!         : _BinBase1<_Oper,_Dom> {
!         typedef typename _Dom::value_type _Tp;
!         typedef _BinBase1<_Oper,_Dom> _Base;
!         typedef typename _Base::value_type value_type;
! 
!         _BinClos (const _Tp& __e1, const _Dom& __e2) : _Base (__e1, __e2) {}
      };
      
!     template<template<class> class _Oper, typename _Tp>
      struct _BinClos<_Oper,_ValArray,_Constant,_Tp,_Tp>
!         : _BinBase2<_Oper,valarray<_Tp> > {
!         typedef _BinBase2<_Oper,valarray<_Tp> > _Base;
!         typedef typename _Base::value_type value_type;
! 
!         _BinClos (const valarray<_Tp>& __v, const _Tp& __t)
!                 : _Base (__v, __t) {}
      };
  
!     template<template<class> class _Oper, typename _Tp>
      struct _BinClos<_Oper,_Constant,_ValArray,_Tp,_Tp>
!         : _BinBase1<_Oper,valarray<_Tp> > {
!         typedef _BinBase1<_Oper,valarray<_Tp> > _Base;
!         typedef typename _Base::value_type value_type;
! 
!         _BinClos (const _Tp& __t, const valarray<_Tp>& __v)
!                 : _Base (__t, __v) {}
      };
          
  
--- 486,641 ----
      };
  
  
!   //
!   // Binary expression closure.
!   //
  
!   template<class _Oper, class _FirstArg, class _SecondArg>
!     class _BinBase 
!     {
      public:
!         typedef typename _FirstArg::value_type _Vt;
!         typedef typename __fun<_Oper, _Vt>::result_type value_type;
! 
!       _BinBase(const _FirstArg& __e1, const _SecondArg& __e2)
! 	: _M_expr1(__e1), _M_expr2(__e2) {}
!       
!       value_type operator[](size_t __i) const
!       { return _Oper()(_M_expr1[__i], _M_expr2[__i]); }
  
!       size_t size() const { return _M_expr1.size(); }
          
      private:
!       const _FirstArg& _M_expr1;
!       const _SecondArg& _M_expr2;
      };
  
  
!   template<class _Oper, class _Clos>
!     class _BinBase2
!     {
      public:
!       typedef typename _Clos::value_type _Vt;
!       typedef typename __fun<_Oper, _Vt>::result_type value_type;
! 
!       _BinBase2(const _Clos& __e, const _Vt& __t)
! 	: _M_expr1(__e), _M_expr2(__t) {}
! 
!       value_type operator[](size_t __i) const
!       { return _Oper()(_M_expr1[__i], _M_expr2); }
! 
!       size_t size() const { return _M_expr1.size(); }
  
      private:
!       const _Clos& _M_expr1;
!       const _Vt& _M_expr2;
      };
  
!   template<class _Oper, class _Clos>
!     class _BinBase1
!     {
!     public:
!       typedef typename _Clos::value_type _Vt;
!       typedef typename __fun<_Oper, _Vt>::result_type value_type;
  
+       _BinBase1(const _Vt& __t, const _Clos& __e)
+ 	: _M_expr1(__t), _M_expr2(__e) {}
  
!       value_type operator[](size_t __i) const
!       { return _Oper()(_M_expr1, _M_expr2[__i]); }
!       
!       size_t size() const { return _M_expr2.size(); }
  
      private:
!       const _Vt& _M_expr1;
!       const _Clos& _M_expr2;
      };
      
!   template<class _Oper, class _Dom1, class _Dom2>
!     struct _BinClos<_Oper, _Expr, _Expr, _Dom1, _Dom2>
!         : _BinBase<_Oper,_Dom1,_Dom2> 
!     {
!       typedef _BinBase<_Oper,_Dom1,_Dom2> _Base;
!       typedef typename _Base::value_type value_type;
          
!       _BinClos(const _Dom1& __e1, const _Dom2& __e2) : _Base(__e1, __e2) {}
      };
  
!   template<class _Oper, typename _Tp>
      struct _BinClos<_Oper,_ValArray,_ValArray,_Tp,_Tp>
!       : _BinBase<_Oper,valarray<_Tp>,valarray<_Tp> > 
!     {
!       typedef _BinBase<_Oper,valarray<_Tp>,valarray<_Tp> > _Base;
!       typedef _Tp value_type;
  
!       _BinClos(const valarray<_Tp>& __v, const valarray<_Tp>& __w)
! 	: _Base(__v, __w) {}
      };
  
!   template<class _Oper, class _Dom>
!     struct _BinClos<_Oper,_Expr,_ValArray,_Dom,typename _Dom::value_type>
!       : _BinBase<_Oper,_Dom,valarray<typename _Dom::value_type> > 
!     {
!       typedef typename _Dom::value_type _Tp;
!       typedef _BinBase<_Oper,_Dom,valarray<_Tp> > _Base;
!       typedef typename _Base::value_type value_type;
!       
!       _BinClos(const _Dom& __e1, const valarray<_Tp>& __e2)
! 	: _Base(__e1, __e2) {}
      };
  
!   template<class _Oper, class _Dom>
      struct  _BinClos<_Oper,_ValArray,_Expr,typename _Dom::value_type,_Dom>
!       : _BinBase<_Oper,valarray<typename _Dom::value_type>,_Dom> 
!     {
!       typedef typename _Dom::value_type _Tp;
!       typedef _BinBase<_Oper,valarray<_Tp>,_Dom> _Base;
!       typedef typename _Base::value_type value_type;
!       
!       _BinClos(const valarray<_Tp>& __e1, const _Dom& __e2)
! 	: _Base(__e1, __e2) {}
      };
  
!   template<class _Oper, class _Dom>
      struct _BinClos<_Oper,_Expr,_Constant,_Dom,typename _Dom::value_type>
!       : _BinBase2<_Oper,_Dom> 
!     {
!       typedef typename _Dom::value_type _Tp;
!       typedef _BinBase2<_Oper,_Dom> _Base;
!       typedef typename _Base::value_type value_type;
!       
!       _BinClos(const _Dom& __e1, const _Tp& __e2) : _Base(__e1, __e2) {}
      };
  
!   template<class _Oper, class _Dom>
      struct _BinClos<_Oper,_Constant,_Expr,typename _Dom::value_type,_Dom>
!       : _BinBase1<_Oper,_Dom> 
!     {
!       typedef typename _Dom::value_type _Tp;
!       typedef _BinBase1<_Oper,_Dom> _Base;
!       typedef typename _Base::value_type value_type;
!       
!       _BinClos(const _Tp& __e1, const _Dom& __e2) : _Base(__e1, __e2) {}
      };
      
!   template<class _Oper, typename _Tp>
      struct _BinClos<_Oper,_ValArray,_Constant,_Tp,_Tp>
!       : _BinBase2<_Oper,valarray<_Tp> > 
!     {
!       typedef _BinBase2<_Oper,valarray<_Tp> > _Base;
!       typedef typename _Base::value_type value_type;
!       
!       _BinClos(const valarray<_Tp>& __v, const _Tp& __t) : _Base(__v, __t) {}
      };
  
!   template<class _Oper, typename _Tp>
      struct _BinClos<_Oper,_Constant,_ValArray,_Tp,_Tp>
!       : _BinBase1<_Oper,valarray<_Tp> > 
!     {
!       typedef _BinBase1<_Oper,valarray<_Tp> > _Base;
!       typedef typename _Base::value_type value_type;
!       
!       _BinClos(const _Tp& __t, const valarray<_Tp>& __v) : _Base(__t, __v) {}
      };
          
  
*************** namespace std
*** 1065,1082 ****
      inline _Expr<_UnClos<__logical_not,_Expr,_Dom>, bool>
      _Expr<_Dom,_Tp>::operator!() const
      {
!         typedef _UnClos<__logical_not,std::_Expr,_Dom> _Closure;
!         return _Expr<_Closure,_Tp>(_Closure(this->_M_closure));
      }
  
! #define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name)                         \
! template<class _Dom, typename _Tp>                                      \
! inline _Expr<_UnClos<_Name,std::_Expr,_Dom>,_Tp>                        \
! _Expr<_Dom,_Tp>::operator _Op() const                                   \
! {                                                                       \
!     typedef _UnClos<_Name,std::_Expr,_Dom> _Closure;                    \
!     return _Expr<_Closure,_Tp>(_Closure(this->_M_closure));             \
! }
  
      _DEFINE_EXPR_UNARY_OPERATOR(+, __unary_plus)
      _DEFINE_EXPR_UNARY_OPERATOR(-, __negate)
--- 911,928 ----
      inline _Expr<_UnClos<__logical_not,_Expr,_Dom>, bool>
      _Expr<_Dom,_Tp>::operator!() const
      {
!       typedef _UnClos<__logical_not,std::_Expr,_Dom> _Closure;
!       return _Expr<_Closure,_Tp>(_Closure(this->_M_closure));
      }
  
! #define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name)                           \
!   template<class _Dom, typename _Tp>                                      \
!     inline _Expr<_UnClos<_Name,std::_Expr,_Dom>,_Tp>                      \
!     _Expr<_Dom,_Tp>::operator _Op() const                                 \
!     {                                                                     \
!       typedef _UnClos<_Name,std::_Expr,_Dom> _Closure;                    \
!       return _Expr<_Closure,_Tp>(_Closure(this->_M_closure));             \
!     }
  
      _DEFINE_EXPR_UNARY_OPERATOR(+, __unary_plus)
      _DEFINE_EXPR_UNARY_OPERATOR(-, __negate)
*************** _Expr<_Dom,_Tp>::operator _Op() const   
*** 1086,1250 ****
  
  
  #define _DEFINE_EXPR_BINARY_OPERATOR(_Op, _Name)                        \
! template<class _Dom1, class _Dom2>					\
! inline _Expr<_BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2>,                   \
!              typename _Name<typename _Dom1::value_type>::result_type>   \
! operator _Op (const _Expr<_Dom1,typename _Dom1::value_type>& __v,      \
!               const _Expr<_Dom2,typename _Dom2::value_type>& __w)       \
! {                                                                       \
      typedef typename _Dom1::value_type _Arg;                            \
!     typedef typename _Name<_Arg>::result_type _Value;                   \
      typedef _BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2> _Closure;           \
!     return _Expr<_Closure,_Value> (_Closure (__v (), __w ()));          \
! }                                                                       \
                                                                          \
  template<class _Dom>                                                    \
! inline _Expr<_BinClos<_Name,_Expr,_Constant,_Dom,typename _Dom::value_type>, \
!              typename _Name<typename _Dom::value_type>::result_type>    \
! operator _Op (const _Expr<_Dom,typename _Dom::value_type>& __v,        \
!               const typename _Dom::value_type& __t)                     \
! {                                                                       \
!     typedef typename _Dom::value_type _Arg;                             \
!     typedef typename _Name<_Arg>::result_type _Value;                   \
!     typedef _BinClos<_Name,_Expr,_Constant,_Dom,_Arg> _Closure;         \
!     return _Expr<_Closure,_Value> (_Closure (__v (), __t));             \
  }                                                                       \
                                                                          \
  template<class _Dom>                                                    \
! inline _Expr<_BinClos<_Name,_Constant,_Expr,typename _Dom::value_type,_Dom>, \
!              typename _Name<typename _Dom::value_type>::result_type>    \
! operator _Op (const typename _Dom::value_type& __t,                    \
!                const _Expr<_Dom,typename _Dom::value_type>& __v)        \
! {                                                                       \
!     typedef typename _Dom::value_type _Arg;                             \
!     typedef typename _Name<_Arg>::result_type _Value;                   \
!     typedef _BinClos<_Name,_Constant,_Expr,_Arg,_Dom> _Closure;         \
!     return _Expr<_Closure,_Value> (_Closure (__t, __v ()));             \
  }                                                                       \
                                                                          \
  template<class _Dom>                                                    \
! inline _Expr<_BinClos<_Name,_Expr,_ValArray,_Dom,typename _Dom::value_type>, \
!              typename _Name<typename _Dom::value_type>::result_type>    \
! operator _Op (const _Expr<_Dom,typename _Dom::value_type>& __e,        \
!                const valarray<typename _Dom::value_type>& __v)          \
! {                                                                       \
!     typedef typename _Dom::value_type _Arg;                             \
!     typedef typename _Name<_Arg>::result_type _Value;                   \
!     typedef _BinClos<_Name,_Expr,_ValArray,_Dom,_Arg> _Closure;         \
!     return  _Expr<_Closure,_Value> (_Closure (__e (), __v));            \
  }                                                                       \
                                                                          \
  template<class _Dom>                                                    \
! inline _Expr<_BinClos<_Name,_ValArray,_Expr,typename _Dom::value_type,_Dom>, \
!              typename _Name<typename _Dom::value_type>::result_type>    \
! operator _Op (const valarray<typename _Dom::value_type>& __v,          \
!                const _Expr<_Dom,typename _Dom::value_type>& __e)        \
! {                                                                       \
!     typedef typename _Dom::value_type _Tp;                              \
!     typedef typename _Name<_Tp>::result_type _Value;                    \
!     typedef _BinClos<_Name,_ValArray,_Expr,_Tp,_Dom> _Closure;          \
!     return _Expr<_Closure,_Value> (_Closure (__v, __e ()));             \
  }
  
!     _DEFINE_EXPR_BINARY_OPERATOR(+, plus)
!     _DEFINE_EXPR_BINARY_OPERATOR(-, minus)
!     _DEFINE_EXPR_BINARY_OPERATOR(*, multiplies)
!     _DEFINE_EXPR_BINARY_OPERATOR(/, divides)
!     _DEFINE_EXPR_BINARY_OPERATOR(%, modulus)
!     _DEFINE_EXPR_BINARY_OPERATOR(^, _Bitwise_xor)
!     _DEFINE_EXPR_BINARY_OPERATOR(&, _Bitwise_and)
!     _DEFINE_EXPR_BINARY_OPERATOR(|, _Bitwise_or)
!     _DEFINE_EXPR_BINARY_OPERATOR(<<, _Shift_left)
!     _DEFINE_EXPR_BINARY_OPERATOR(>>, _Shift_right)
  
  #undef _DEFINE_EXPR_BINARY_OPERATOR
-     
- #define _DEFINE_EXPR_RELATIONAL_OPERATOR(_Op, _Name)                    \
- template<class _Dom1, class _Dom2>					\
- inline _Expr<_BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2>, bool>             \
- operator _Op (const _Expr<_Dom1,typename _Dom1::value_type>& __v,      \
-               const _Expr<_Dom2,typename _Dom2::value_type>& __w)       \
- {                                                                       \
-     typedef typename _Dom1::value_type _Arg;                            \
-     typedef _BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2> _Closure;           \
-     return _Expr<_Closure,bool> (_Closure (__v (), __w ()));            \
- }                                                                       \
-                                                                         \
- template<class _Dom>                                                    \
- inline _Expr<_BinClos<_Name,_Expr,_Constant,_Dom,typename _Dom::value_type>, \
-              bool>                                                      \
- operator _Op (const _Expr<_Dom,typename _Dom::value_type>& __v,        \
-               const typename _Dom::value_type& __t)                     \
- {                                                                       \
-     typedef typename _Dom::value_type _Arg;                             \
-     typedef _BinClos<_Name,_Expr,_Constant,_Dom,_Arg> _Closure;         \
-     return _Expr<_Closure,bool> (_Closure (__v (), __t));               \
- }                                                                       \
-                                                                         \
- template<class _Dom>                                                    \
- inline _Expr<_BinClos<_Name,_Constant,_Expr,typename _Dom::value_type,_Dom>, \
-              bool>                                                      \
- operator _Op (const typename _Dom::value_type& __t,                    \
-                const _Expr<_Dom,typename _Dom::value_type>& __v)        \
- {                                                                       \
-     typedef typename _Dom::value_type _Arg;                             \
-     typedef _BinClos<_Name,_Constant,_Expr,_Arg,_Dom> _Closure;         \
-     return _Expr<_Closure,bool> (_Closure (__t, __v ()));               \
- }                                                                       \
-                                                                         \
- template<class _Dom>                                                    \
- inline _Expr<_BinClos<_Name,_Expr,_ValArray,_Dom,typename _Dom::value_type>, \
-              bool>                                                      \
- operator _Op (const _Expr<_Dom,typename _Dom::value_type>& __e,        \
-                const valarray<typename _Dom::value_type>& __v)          \
- {                                                                       \
-     typedef typename _Dom::value_type _Tp;                              \
-     typedef _BinClos<_Name,_Expr,_ValArray,_Dom,_Tp> _Closure;          \
-     return  _Expr<_Closure,bool> (_Closure (__e (), __v));              \
- }                                                                       \
-                                                                         \
- template<class _Dom>                                                    \
- inline _Expr<_BinClos<_Name,_ValArray,_Expr,typename _Dom::value_type,_Dom>, \
-              bool>                                                      \
- operator _Op (const valarray<typename _Dom::value_type>& __v,          \
-                const _Expr<_Dom,typename _Dom::value_type>& __e)        \
- {                                                                       \
-     typedef typename _Dom::value_type _Tp;                              \
-     typedef _BinClos<_Name,_ValArray,_Expr,_Tp,_Dom> _Closure;          \
-     return _Expr<_Closure,bool> (_Closure (__v, __e ()));               \
- }
- 
-     _DEFINE_EXPR_RELATIONAL_OPERATOR(&&, logical_and)
-     _DEFINE_EXPR_RELATIONAL_OPERATOR(||, logical_or)
-     _DEFINE_EXPR_RELATIONAL_OPERATOR(==, equal_to)
-     _DEFINE_EXPR_RELATIONAL_OPERATOR(!=, not_equal_to)
-     _DEFINE_EXPR_RELATIONAL_OPERATOR(<, less)
-     _DEFINE_EXPR_RELATIONAL_OPERATOR(>, greater)
-     _DEFINE_EXPR_RELATIONAL_OPERATOR(<=, less_equal)
-     _DEFINE_EXPR_RELATIONAL_OPERATOR(>=, greater_equal)
- 
- #undef _DEFINE_EXPR_RELATIONAL_OPERATOR
- 
- 
- 
- #define _DEFINE_EXPR_UNARY_FUNCTION(_Name)                              \
- template<class _Dom>                                                    \
- inline _Expr<_UnClos<__##_Name,_Expr,_Dom>,typename _Dom::value_type>   \
- _Name(const _Expr<_Dom,typename _Dom::value_type>& __e)                 \
- {                                                                       \
-     typedef typename _Dom::value_type _Tp;                              \
-     typedef _UnClos<__##_Name,_Expr,_Dom> _Closure;                     \
-     return _Expr<_Closure,_Tp>(_Closure(__e()));                        \
- }                                                                       \
-                                                                         \
- template<typename _Tp>                                                  \
- inline _Expr<_UnClos<__##_Name,_ValArray,_Tp>,_Tp>                      \
- _Name(const valarray<_Tp>& __v)                                         \
- {                                                                       \
-     typedef _UnClos<__##_Name,_ValArray,_Tp> _Closure;                  \
-     return _Expr<_Closure,_Tp>(_Closure (__v));                         \
- }
  
  
      _DEFINE_EXPR_UNARY_FUNCTION(abs)
      _DEFINE_EXPR_UNARY_FUNCTION(cos)
--- 932,1035 ----
  
  
  #define _DEFINE_EXPR_BINARY_OPERATOR(_Op, _Name)                        \
!   template<class _Dom1, class _Dom2>					\
!   inline _Expr<_BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2>,                 \
!          typename __fun<_Name, typename _Dom1::value_type>::result_type>\
!   operator _Op(const _Expr<_Dom1,typename _Dom1::value_type>& __v,      \
! 	       const _Expr<_Dom2,typename _Dom2::value_type>& __w)      \
!   {                                                                     \
      typedef typename _Dom1::value_type _Arg;                            \
!     typedef typename __fun<_Name, _Arg>::result_type _Value;            \
      typedef _BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2> _Closure;           \
!     return _Expr<_Closure,_Value>(_Closure(__v(), __w()));              \
!   }                                                                     \
                                                                          \
  template<class _Dom>                                                    \
! inline _Expr<_BinClos<_Name,_Expr,_Constant,_Dom,typename _Dom::value_type>,\
!              typename __fun<_Name, typename _Dom::value_type>::result_type>\
! operator _Op(const _Expr<_Dom,typename _Dom::value_type>& __v,          \
!              const typename _Dom::value_type& __t)                      \
! {                                                                       \
!   typedef typename _Dom::value_type _Arg;                               \
!   typedef typename __fun<_Name, _Arg>::result_type _Value;              \
!   typedef _BinClos<_Name,_Expr,_Constant,_Dom,_Arg> _Closure;           \
!   return _Expr<_Closure,_Value>(_Closure(__v(), __t));                  \
  }                                                                       \
                                                                          \
  template<class _Dom>                                                    \
! inline _Expr<_BinClos<_Name,_Constant,_Expr,typename _Dom::value_type,_Dom>,\
!              typename __fun<_Name, typename _Dom::value_type>::result_type>\
! operator _Op(const typename _Dom::value_type& __t,                      \
!              const _Expr<_Dom,typename _Dom::value_type>& __v)          \
! {                                                                       \
!   typedef typename _Dom::value_type _Arg;                               \
!   typedef typename __fun<_Name, _Arg>::result_type _Value;              \
!   typedef _BinClos<_Name,_Constant,_Expr,_Arg,_Dom> _Closure;           \
!   return _Expr<_Closure,_Value>(_Closure(__t, __v()));                  \
  }                                                                       \
                                                                          \
  template<class _Dom>                                                    \
! inline _Expr<_BinClos<_Name,_Expr,_ValArray,_Dom,typename _Dom::value_type>,\
!              typename __fun<_Name, typename _Dom::value_type>::result_type>\
! operator _Op(const _Expr<_Dom,typename _Dom::value_type>& __e,          \
!              const valarray<typename _Dom::value_type>& __v)            \
! {                                                                       \
!   typedef typename _Dom::value_type _Arg;                               \
!   typedef typename __fun<_Name, _Arg>::result_type _Value;              \
!   typedef _BinClos<_Name,_Expr,_ValArray,_Dom,_Arg> _Closure;           \
!   return  _Expr<_Closure,_Value>(_Closure(__e(), __v));                 \
  }                                                                       \
                                                                          \
  template<class _Dom>                                                    \
! inline _Expr<_BinClos<_Name,_ValArray,_Expr,typename _Dom::value_type,_Dom>,\
!              typename __fun<_Name, typename _Dom::value_type>::result_type>\
! operator _Op(const valarray<typename _Dom::value_type>& __v,            \
!              const _Expr<_Dom,typename _Dom::value_type>& __e)          \
! {                                                                       \
!   typedef typename _Dom::value_type _Tp;                                \
!   typedef typename __fun<_Name, _Tp>::result_type _Value;               \
!   typedef _BinClos<_Name,_ValArray,_Expr,_Tp,_Dom> _Closure;            \
!   return _Expr<_Closure,_Value> (_Closure (__v, __e ()));               \
  }
  
!     _DEFINE_EXPR_BINARY_OPERATOR(+, __plus)
!     _DEFINE_EXPR_BINARY_OPERATOR(-, __minus)
!     _DEFINE_EXPR_BINARY_OPERATOR(*, __multiplies)
!     _DEFINE_EXPR_BINARY_OPERATOR(/, __divides)
!     _DEFINE_EXPR_BINARY_OPERATOR(%, __modulus)
!     _DEFINE_EXPR_BINARY_OPERATOR(^, __bitwise_xor)
!     _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and)
!     _DEFINE_EXPR_BINARY_OPERATOR(|, __bitwise_or)
!     _DEFINE_EXPR_BINARY_OPERATOR(<<, __shift_left)
!     _DEFINE_EXPR_BINARY_OPERATOR(>>, __shift_right)
!     _DEFINE_EXPR_BINARY_OPERATOR(&&, __logical_and)
!     _DEFINE_EXPR_BINARY_OPERATOR(||, __logical_or)
!     _DEFINE_EXPR_BINARY_OPERATOR(==, __equal_to)
!     _DEFINE_EXPR_BINARY_OPERATOR(!=, __not_equal_to)
!     _DEFINE_EXPR_BINARY_OPERATOR(<, __less)
!     _DEFINE_EXPR_BINARY_OPERATOR(>, __greater)
!     _DEFINE_EXPR_BINARY_OPERATOR(<=, __less_equal)
!     _DEFINE_EXPR_BINARY_OPERATOR(>=, __greater_equal)
  
  #undef _DEFINE_EXPR_BINARY_OPERATOR
  
+ #define _DEFINE_EXPR_UNARY_FUNCTION(_Name)                               \
+   template<class _Dom>                                                   \
+     inline _Expr<_UnClos<__##_Name,_Expr,_Dom>,typename _Dom::value_type>\
+     _Name(const _Expr<_Dom,typename _Dom::value_type>& __e)              \
+     {                                                                    \
+       typedef typename _Dom::value_type _Tp;                             \
+       typedef _UnClos<__##_Name,_Expr,_Dom> _Closure;                    \
+       return _Expr<_Closure,_Tp>(_Closure(__e()));                       \
+     }                                                                    \
+                                                                          \
+   template<typename _Tp>                                                 \
+     inline _Expr<_UnClos<__##_Name,_ValArray,_Tp>,_Tp>                   \
+     _Name(const valarray<_Tp>& __v)                                      \
+     {                                                                    \
+       typedef _UnClos<__##_Name,_ValArray,_Tp> _Closure;                 \
+       return _Expr<_Closure,_Tp>(_Closure(__v));                         \
+     }
  
      _DEFINE_EXPR_UNARY_FUNCTION(abs)
      _DEFINE_EXPR_UNARY_FUNCTION(cos)
*************** _Name(const valarray<_Tp>& __v)         
*** 1263,1355 ****
  
  #undef _DEFINE_EXPR_UNARY_FUNCTION
  
! 
! #define _DEFINE_EXPR_BINARY_FUNCTION(_Name)                             \
! template<class _Dom1, class _Dom2>                                      \
! inline _Expr<_BinFunClos<_Expr,_Expr,_Dom1,_Dom2>,typename _Dom1::value_type>\
! _Name (const _Expr<_Dom1,typename _Dom1::value_type>& __e1,             \
!        const _Expr<_Dom2,typename _Dom2::value_type>& __e2)             \
! {                                                                       \
!     typedef typename _Dom1::value_type _Tp;                             \
!     typedef _BinFunClos<_Expr,_Expr,_Dom1,_Dom2> _Closure;              \
!     return _Expr<_Closure,_Tp>                                          \
!         (_Closure (__e1 (), __e2 (), (_Tp(*)(_Tp, _Tp))(&_Name)));      \
! }                                                                       \
!                                                                         \
! template<class _Dom>                                                    \
! inline _Expr<_BinFunClos<_Expr,_ValArray,_Dom,typename _Dom::value_type>, \
!              typename _Dom::value_type>                                 \
! _Name (const _Expr<_Dom,typename _Dom::value_type>& __e,                \
!        const valarray<typename _Dom::value_type>& __v)                  \
! {                                                                       \
!     typedef typename _Dom::value_type _Tp;                              \
!     typedef _BinFunClos<_Expr,_ValArray,_Dom,_Tp> _Closure;             \
!     return _Expr<_Closure,_Tp>                                          \
!         (_Closure (__e (), __v, (_Tp(*)(_Tp, _Tp))(&_Name)));           \
! }                                                                       \
!                                                                         \
! template<class _Dom>                                                    \
! inline _Expr<_BinFunClos<_ValArray,_Expr,typename _Dom::value_type,_Dom>, \
!              typename _Dom::value_type>                                 \
! _Name (const valarray<typename _Dom::valarray>& __v,                    \
!        const _Expr<_Dom,typename _Dom::value_type>& __e)                \
! {                                                                       \
!     typedef typename _Dom::value_type _Tp;                              \
!     typedef _BinFunClos<_ValArray,_Expr,_Tp,_Dom> _Closure;             \
!     return _Expr<_Closure,_Tp>                                          \
!         (_Closure (__v, __e (), (_Tp(*)(_Tp, _Tp))(&_Name)));           \
! }                                                                       \
!                                                                         \
! template<class _Dom>                                                    \
! inline _Expr<_BinFunClos<_Expr,_Constant,_Dom,typename _Dom::value_type>, \
!              typename _Dom::value_type>                                 \
! _Name (const _Expr<_Dom, typename _Dom::value_type>& __e,               \
!        const typename _Dom::value_type& __t)                            \
! {                                                                       \
!     typedef typename _Dom::value_type _Tp;                              \
!     typedef _BinFunClos<_Expr,_Constant,_Dom,_Tp> _Closure;             \
!     return _Expr<_Closure,_Tp>                                          \
!         (_Closure (__e (), __t, (_Tp(*)(_Tp, _Tp))(&_Name)));           \
! }                                                                       \
!                                                                         \
! template<class _Dom>                                                    \
! inline _Expr<_BinFunClos<_Constant,_Expr,typename _Dom::value_type,_Dom>, \
!              typename _Dom::value_type>                                 \
! _Name (const typename _Dom::value_type& __t,                            \
!        const _Expr<_Dom,typename _Dom::value_type>& __e)                \
! {                                                                       \
!     typedef typename _Dom::value_type _Tp;                              \
!     typedef _BinFunClos<_Constant,_Expr,_Tp,_Dom> _Closure;             \
!     return _Expr<_Closure,_Tp>                                          \
!         (_Closure (__t, __e (), (_Tp(*)(_Tp, _Tp))(&_Name)));           \
! }                                                                       \
!                                                                         \
! template<typename _Tp>                                                  \
! inline _Expr<_BinFunClos<_ValArray,_ValArray,_Tp,_Tp>, _Tp>             \
! _Name (const valarray<_Tp>& __v, const valarray<_Tp>& __w)              \
! {                                                                       \
!     typedef _BinFunClos<_ValArray,_ValArray,_Tp,_Tp> _Closure;          \
!     return _Expr<_Closure,_Tp>                                          \
!         (_Closure (__v, __w, (_Tp(*)(_Tp,_Tp))(&_Name)));               \
! }                                                                       \
!                                                                         \
! template<typename _Tp>                                                  \
! inline _Expr<_BinFunClos<_ValArray,_Constant,_Tp,_Tp>,_Tp>              \
! _Name (const valarray<_Tp>& __v, const _Tp& __t)                        \
! {                                                                       \
!     typedef _BinFunClos<_ValArray,_Constant,_Tp,_Tp> _Closure;          \
!     return _Expr<_Closure,_Tp>                                          \
!         (_Closure (__v, __t, (_Tp(*)(_Tp,_Tp))(&_Name)));               \
! }                                                                       \
!                                                                         \
! template<typename _Tp>                                                  \
! inline _Expr<_BinFunClos<_Constant,_ValArray,_Tp,_Tp>,_Tp>              \
! _Name (const _Tp& __t, const valarray<_Tp>& __v)                        \
! {                                                                       \
!     typedef _BinFunClos<_Constant,_ValArray,_Tp,_Tp> _Closure;          \
!     return _Expr<_Closure,_Tp>                                          \
!         (_Closure (__t, __v, (_Tp(*)(_Tp,_Tp))(&_Name)));               \
! }
  
  _DEFINE_EXPR_BINARY_FUNCTION(atan2)
  _DEFINE_EXPR_BINARY_FUNCTION(pow)
--- 1048,1136 ----
  
  #undef _DEFINE_EXPR_UNARY_FUNCTION
  
! #define _DEFINE_EXPR_BINARY_FUNCTION(_Fun)                             \
!   template<class _Dom1, class _Dom2>                                   \
!     inline _Expr<_BinClos<__##_Fun,_Expr,_Expr,_Dom1,_Dom2>,           \
! 		 typename _Dom1::value_type>                           \
!     _Fun(const _Expr<_Dom1,typename _Dom1::value_type>& __e1,          \
! 	  const _Expr<_Dom2,typename _Dom2::value_type>& __e2)         \
!     {                                                                  \
!       typedef typename _Dom1::value_type _Tp;                          \
!       typedef _BinClos<__##_Fun,_Expr,_Expr,_Dom1,_Dom2> _Closure;     \
!       return _Expr<_Closure,_Tp>(_Closure(__e1(), __e2()));            \
!     }                                                                  \
!                                                                        \
!   template<class _Dom>                                                 \
!     inline _Expr<_BinClos<__##_Fun, _Expr, _ValArray, _Dom,            \
! 			  typename _Dom::value_type>,                  \
! 		 typename _Dom::value_type>                            \
!     _Fun(const _Expr<_Dom,typename _Dom::value_type>& __e,             \
! 	 const valarray<typename _Dom::value_type>& __v)               \
!     {                                                                  \
!       typedef typename _Dom::value_type _Tp;                           \
!       typedef _BinClos<__##_Fun, _Expr, _ValArray, _Dom, _Tp> _Closure;\
!       return _Expr<_Closure,_Tp>(_Closure(__e(), __v));                \
!     }                                                                  \
!                                                                        \
!   template<class _Dom>                                                 \
!     inline _Expr<_BinClos<__##_Fun, _ValArray, _Expr,                  \
! 			  typename _Dom::value_type,_Dom>,             \
! 		 typename _Dom::value_type>                            \
!     _Fun(const valarray<typename _Dom::valarray>& __v,                 \
! 	 const _Expr<_Dom,typename _Dom::value_type>& __e)             \
!     {                                                                  \
!       typedef typename _Dom::value_type _Tp;                           \
!       typedef _BinClos<__##_Fun,_ValArray,_Expr,_Tp,_Dom> _Closure;    \
!       return _Expr<_Closure,_Tp>(_Closure(__v, __e()));                \
!     }                                                                  \
!                                                                        \
!   template<class _Dom>                                                 \
!     inline _Expr<_BinClos<__##_Fun,_Expr,_Constant,_Dom,               \
! 			  typename _Dom::value_type>,                  \
! 		 typename _Dom::value_type>                            \
!     _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e,            \
! 	 const typename _Dom::value_type& __t)                         \
!     {                                                                  \
!       typedef typename _Dom::value_type _Tp;                           \
!       typedef _BinClos<__##_Fun,_Expr,_Constant,_Dom,_Tp> _Closure;    \
!       return _Expr<_Closure,_Tp>(_Closure(__e(), __t));                \
!     }                                                                  \
!                                                                        \
!   template<class _Dom>                                                 \
!     inline _Expr<_BinClos<__##_Fun,_Constant,_Expr,                    \
! 			  typename _Dom::value_type,_Dom>,             \
! 		 typename _Dom::value_type>                            \
!     _Fun(const typename _Dom::value_type& __t,                         \
! 	 const _Expr<_Dom,typename _Dom::value_type>& __e)             \
!     {                                                                  \
!       typedef typename _Dom::value_type _Tp;                           \
!       typedef _BinClos<__##_Fun, _Constant,_Expr,_Tp,_Dom> _Closure;   \
!       return _Expr<_Closure,_Tp>(_Closure(__t, __e()));                \
!     }                                                                  \
!                                                                        \
!   template<typename _Tp>                                               \
!     inline _Expr<_BinClos<__##_Fun,_ValArray,_ValArray,_Tp,_Tp>, _Tp>  \
!     _Fun(const valarray<_Tp>& __v, const valarray<_Tp>& __w)           \
!     {                                                                  \
!       typedef _BinClos<__##_Fun,_ValArray,_ValArray,_Tp,_Tp> _Closure; \
!       return _Expr<_Closure,_Tp>(_Closure(__v, __w));                  \
!     }                                                                  \
!                                                                        \
!   template<typename _Tp>                                               \
!     inline _Expr<_BinClos<__##_Fun,_ValArray,_Constant,_Tp,_Tp>,_Tp>   \
!     _Fun(const valarray<_Tp>& __v, const _Tp& __t)                     \
!     {                                                                  \
!       typedef _BinClos<__##_Fun,_ValArray,_Constant,_Tp,_Tp> _Closure; \
!       return _Expr<_Closure,_Tp>(_Closure(__v, __t));                  \
!     }                                                                  \
! 								       \
!   template<typename _Tp>                                               \
!     inline _Expr<_BinClos<__##_Fun,_Constant,_ValArray,_Tp,_Tp>,_Tp>   \
!     _Fun(const _Tp& __t, const valarray<_Tp>& __v)                     \
!     {                                                                  \
!       typedef _BinClos<__##_Fun,_Constant,_ValArray,_Tp,_Tp> _Closure; \
!       return _Expr<_Closure,_Tp>(_Closure(__t, __v));                  \
!     }
  
  _DEFINE_EXPR_BINARY_FUNCTION(atan2)
  _DEFINE_EXPR_BINARY_FUNCTION(pow)
Index: include/std/std_valarray.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/std/std_valarray.h,v
retrieving revision 1.4
diff -p -r1.4 std_valarray.h
*** include/std/std_valarray.h	2 Aug 2002 18:10:38 -0000	1.4
--- include/std/std_valarray.h	2 Aug 2002 22:47:47 -0000
***************
*** 45,51 ****
  #include <cmath>
  #include <cstdlib>
  #include <numeric>
- #include <functional>
  #include <algorithm>
  
  namespace std
--- 45,50 ----
*************** namespace std
*** 59,65 ****
    template<class _Oper, template<class, class> class _Meta, class _Dom>
      struct _UnClos;
  
!   template<template<class> class _Oper,
          template<class, class> class _Meta1,
          template<class, class> class _Meta2,
          class _Dom1, class _Dom2> 
--- 58,64 ----
    template<class _Oper, template<class, class> class _Meta, class _Dom>
      struct _UnClos;
  
!   template<class _Oper,
          template<class, class> class _Meta1,
          template<class, class> class _Meta2,
          class _Dom1, class _Dom2> 
*************** namespace std
*** 80,91 ****
    template<template<class, class> class _Meta, class _Dom> 
      class _RefFunClos;
  
-   template<class _Tp> struct _Bitwise_and;
-   template<class _Tp> struct _Bitwise_or;
-   template<class _Tp> struct _Bitwise_xor;  
-   template<class _Tp> struct _Shift_left;
-   template<class _Tp> struct _Shift_right;
-   
    template<class _Tp> class valarray;   // An array of type _Tp
    class slice;                          // BLAS-like slice out of an array
    template<class _Tp> class slice_array;
--- 79,84 ----
*************** namespace std
*** 224,250 ****
        
        friend class _Array<_Tp>;
      };
- 
-   template<typename _Tp> struct _Bitwise_and : binary_function<_Tp,_Tp,_Tp> {
-       _Tp operator() (_Tp __x, _Tp __y) const { return __x & __y; }
-   };
- 
-   template<typename _Tp> struct _Bitwise_or : binary_function<_Tp,_Tp,_Tp> {
-       _Tp operator() (_Tp __x, _Tp __y) const { return __x | __y; }
-   };
- 
-   template<typename _Tp> struct _Bitwise_xor : binary_function<_Tp,_Tp,_Tp> {
-       _Tp operator() (_Tp __x, _Tp __y) const { return __x ^ __y; }
-   };
-   
-   template<typename _Tp> struct _Shift_left : unary_function<_Tp,_Tp> {
-       _Tp operator() (_Tp __x, _Tp __y) const { return __x << __y; }
-   };
- 
-   template<typename _Tp> struct _Shift_right : unary_function<_Tp,_Tp> {
-       _Tp operator() (_Tp __x, _Tp __y) const { return __x >> __y; }
-   };
- 
    
    template<typename _Tp>
      inline const _Tp&
--- 217,222 ----
*************** namespace std
*** 486,492 ****
      inline _Tp
      valarray<_Tp>::sum() const
      {
! 	return __valarray_sum(_M_data, _M_data + _M_size);
      }
  
  //   template<typename _Tp>
--- 458,464 ----
      inline _Tp
      valarray<_Tp>::sum() const
      {
!       return __valarray_sum(_M_data, _M_data + _M_size);
      }
  
  //   template<typename _Tp>
*************** namespace std
*** 611,748 ****
  
  #define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name)               \
    template<class _Tp>							\
!   inline valarray<_Tp> &						\
!   valarray<_Tp>::operator _Op##= (const _Tp &__t)			\
!   {									\
!       _Array_augmented_##_Name (_Array<_Tp>(_M_data), _M_size, __t);	\
        return *this;							\
!   }									\
  									\
    template<class _Tp>							\
!   inline valarray<_Tp> &						\
!   valarray<_Tp>::operator _Op##= (const valarray<_Tp> &__v)		\
!   {									\
!       _Array_augmented_##_Name (_Array<_Tp>(_M_data), _M_size, 		\
!                                _Array<_Tp>(__v._M_data));		\
        return *this;							\
!   }
  
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(+, plus)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(-, minus)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(*, multiplies)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(/, divides)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(%, modulus)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(^, xor)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(&, and)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(|, or)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(<<, shift_left)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(>>, shift_right)
  
  #undef _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT
  
- 
- } // std::
-   
- 
- namespace std
- {
- 
  #define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name)          \
    template<class _Tp> template<class _Dom>				\
!   inline valarray<_Tp> &						\
!   valarray<_Tp>::operator _Op##= (const _Expr<_Dom,_Tp> &__e)		\
!   {									\
!       _Array_augmented_##_Name (_Array<_Tp>(_M_data), __e, _M_size);	\
        return *this;							\
!   }
  
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(+, plus)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(-, minus)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(*, multiplies)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(/, divides)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(%, modulus)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(^, xor)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(&, and)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(|, or)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(<<, shift_left)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(>>, shift_right)
  
  #undef _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT
      
  
  #define _DEFINE_BINARY_OPERATOR(_Op, _Name)				\
    template<typename _Tp>						\
!   inline _Expr<_BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp>, _Tp>        \
!   operator _Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w)	\
!   {									\
        typedef _BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp> _Closure;     \
!       return _Expr<_Closure, _Tp> (_Closure (__v, __w));		\
!   }									\
  									\
    template<typename _Tp>						\
!   inline _Expr<_BinClos<_Name,_ValArray,_Constant,_Tp,_Tp>,_Tp>         \
!   operator _Op (const valarray<_Tp> &__v, const _Tp &__t)		\
    {									\
!       typedef _BinClos<_Name,_ValArray,_Constant,_Tp,_Tp> _Closure;	\
!       return _Expr<_Closure, _Tp> (_Closure (__v, __t));	        \
    }									\
  									\
    template<typename _Tp>						\
!   inline _Expr<_BinClos<_Name,_Constant,_ValArray,_Tp,_Tp>,_Tp>         \
!   operator _Op (const _Tp &__t, const valarray<_Tp> &__v)		\
!   {									\
!       typedef _BinClos<_Name,_Constant,_ValArray,_Tp,_Tp> _Closure;     \
!       return _Expr<_Closure, _Tp> (_Closure (__t, __v));        	\
!   }
! 
! _DEFINE_BINARY_OPERATOR(+, plus)
! _DEFINE_BINARY_OPERATOR(-, minus)
! _DEFINE_BINARY_OPERATOR(*, multiplies)
! _DEFINE_BINARY_OPERATOR(/, divides)
! _DEFINE_BINARY_OPERATOR(%, modulus)
! _DEFINE_BINARY_OPERATOR(^, _Bitwise_xor)
! _DEFINE_BINARY_OPERATOR(&, _Bitwise_and)
! _DEFINE_BINARY_OPERATOR(|, _Bitwise_or)
! _DEFINE_BINARY_OPERATOR(<<, _Shift_left)
! _DEFINE_BINARY_OPERATOR(>>, _Shift_right)
! 
! #undef _DEFINE_BINARY_OPERATOR
! 
! #define _DEFINE_LOGICAL_OPERATOR(_Op, _Name)				\
!   template<typename _Tp>						\
!   inline _Expr<_BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp>,bool>        \
!   operator _Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w)	\
    {									\
!       typedef _BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp> _Closure;     \
!       return _Expr<_Closure, bool> (_Closure (__v, __w));               \
!   }									\
! 									\
!   template<class _Tp>							\
!   inline _Expr<_BinClos<_Name,_ValArray,_Constant,_Tp,_Tp>,bool>        \
!   operator _Op (const valarray<_Tp> &__v, const _Tp &__t)		\
!   {									\
!       typedef _BinClos<_Name,_ValArray,_Constant,_Tp,_Tp> _Closure;     \
!       return _Expr<_Closure, bool> (_Closure (__v, __t));       	\
!   }									\
! 									\
!   template<class _Tp>							\
!   inline _Expr<_BinClos<_Name,_Constant,_ValArray,_Tp,_Tp>,bool>        \
!   operator _Op (const _Tp &__t, const valarray<_Tp> &__v)		\
!   {									\
!       typedef _BinClos<_Name,_Constant,_ValArray,_Tp,_Tp> _Closure;     \
!       return _Expr<_Closure, bool> (_Closure (__t, __v));	        \
    }
  
! _DEFINE_LOGICAL_OPERATOR(&&, logical_and)
! _DEFINE_LOGICAL_OPERATOR(||, logical_or)
! _DEFINE_LOGICAL_OPERATOR(==, equal_to)
! _DEFINE_LOGICAL_OPERATOR(!=, not_equal_to)
! _DEFINE_LOGICAL_OPERATOR(<, less)
! _DEFINE_LOGICAL_OPERATOR(>, greater)
! _DEFINE_LOGICAL_OPERATOR(<=, less_equal)
! _DEFINE_LOGICAL_OPERATOR(>=, greater_equal)
! 
! #undef _DEFINE_LOGICAL_OPERATOR
  
  } // namespace std
  
--- 583,689 ----
  
  #define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name)               \
    template<class _Tp>							\
!     inline valarray<_Tp>&						\
!     valarray<_Tp>::operator _Op##=(const _Tp &__t)			\
!     {									\
!       _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, __t);	\
        return *this;							\
!     }									\
  									\
    template<class _Tp>							\
!     inline valarray<_Tp>&						\
!     valarray<_Tp>::operator _Op##=(const valarray<_Tp> &__v)		\
!     {									\
!       _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, 		\
! 			       _Array<_Tp>(__v._M_data));		\
        return *this;							\
!     }
  
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(+, __plus)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(-, __minus)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(*, __multiplies)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(/, __divides)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(%, __modulus)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(^, __bitwise_xor)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(&, __bitwise_and)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(|, __bitwise_or)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(<<, __shift_left)
! _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(>>, __shift_right)
  
  #undef _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT
  
  #define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name)          \
    template<class _Tp> template<class _Dom>				\
!     inline valarray<_Tp>&						\
!     valarray<_Tp>::operator _Op##=(const _Expr<_Dom,_Tp>& __e)		\
!     {									\
!       _Array_augmented_##_Name(_Array<_Tp>(_M_data), __e, _M_size);	\
        return *this;							\
!     }
  
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(+, __plus)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(-, __minus)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(*, __multiplies)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(/, __divides)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(%, __modulus)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(^, __bitwise_xor)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(&, __bitwise_and)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(|, __bitwise_or)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(<<, __shift_left)
! _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(>>, __shift_right)
  
  #undef _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT
      
  
  #define _DEFINE_BINARY_OPERATOR(_Op, _Name)				\
    template<typename _Tp>						\
!     inline _Expr<_BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp>,           \
!                  typename __fun<_Name, _Tp>::result_type>               \
!     operator _Op(const valarray<_Tp>& __v, const valarray<_Tp>& __w)	\
!     {									\
        typedef _BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp> _Closure;     \
!       typedef typename __fun<_Name, _Tp>::result_type _Rt;              \
!       return _Expr<_Closure, _Rt>(_Closure(__v, __w));                  \
!     }									\
  									\
    template<typename _Tp>						\
!   inline _Expr<_BinClos<_Name,_ValArray,_Constant,_Tp,_Tp>,             \
!                typename __fun<_Name, _Tp>::result_type>                 \
!   operator _Op(const valarray<_Tp>& __v, const _Tp& __t)		\
    {									\
!     typedef _BinClos<_Name,_ValArray,_Constant,_Tp,_Tp> _Closure;	\
!     typedef typename __fun<_Name, _Tp>::result_type _Rt;                \
!     return _Expr<_Closure, _Rt>(_Closure(__v, __t));	                \
    }									\
  									\
    template<typename _Tp>						\
!   inline _Expr<_BinClos<_Name,_Constant,_ValArray,_Tp,_Tp>,             \
!                typename __fun<_Name, _Tp>::result_type>                 \
!   operator _Op(const _Tp& __t, const valarray<_Tp>& __v)		\
    {									\
!     typedef _BinClos<_Name,_Constant,_ValArray,_Tp,_Tp> _Closure;       \
!     typedef typename __fun<_Name, _Tp>::result_type _Rt;                \
!     return _Expr<_Closure, _Tp>(_Closure(__t, __v));        	        \
    }
  
! _DEFINE_BINARY_OPERATOR(+, __plus)
! _DEFINE_BINARY_OPERATOR(-, __minus)
! _DEFINE_BINARY_OPERATOR(*, __multiplies)
! _DEFINE_BINARY_OPERATOR(/, __divides)
! _DEFINE_BINARY_OPERATOR(%, __modulus)
! _DEFINE_BINARY_OPERATOR(^, __bitwise_xor)
! _DEFINE_BINARY_OPERATOR(&, __bitwise_and)
! _DEFINE_BINARY_OPERATOR(|, __bitwise_or)
! _DEFINE_BINARY_OPERATOR(<<, __shift_left)
! _DEFINE_BINARY_OPERATOR(>>, __shift_right)
! _DEFINE_BINARY_OPERATOR(&&, __logical_and)
! _DEFINE_BINARY_OPERATOR(||, __logical_or)
! _DEFINE_BINARY_OPERATOR(==, __equal_to)
! _DEFINE_BINARY_OPERATOR(!=, __not_equal_to)
! _DEFINE_BINARY_OPERATOR(<, __less)
! _DEFINE_BINARY_OPERATOR(>, __greater)
! _DEFINE_BINARY_OPERATOR(<=, __less_equal)
! _DEFINE_BINARY_OPERATOR(>=, __greater_equal)
  
  } // namespace std
  
Index: testsuite/26_numerics/valarray_name_lookup.C
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/testsuite/26_numerics/valarray_name_lookup.C,v
retrieving revision 1.1
diff -p -r1.1 valarray_name_lookup.C
*** testsuite/26_numerics/valarray_name_lookup.C	2 Aug 2002 18:10:38 -0000	1.1
--- testsuite/26_numerics/valarray_name_lookup.C	2 Aug 2002 22:47:47 -0000
*************** int main()
*** 116,119 ****
--- 116,142 ----
    v = log(u);
    v = log10(u);
    v = sqrt(u);  
+ 
+   Array w = u + v;
+   w = u - v;
+   w = u * v;
+   w = u / v;
+   w = u % v;
+ 
+   w = u ^ v;
+   w = u & v;
+   w = u | v;
+ 
+   w = u << v;
+   w = u >> v;
+ 
+   z = u == v;
+   z = u != v;
+   z = u < v;
+   z = u <= v;
+   z = u > v;
+   z = u >= v;
+ 
+   w = atan2(u, v);
+   w = pow(u, v);
  }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]