# valarray_after.h

Go to the documentation of this file.

    00001 // The template and inlines for the -*- C++ -*- internal _Meta class.
    00002
    00003 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
    00004 // Free Software Foundation, Inc.
    00005 //
    00006 // This file is part of the GNU ISO C++ Library.  This library is free
    00007 // software; you can redistribute it and/or modify it under the
    00008 // terms of the GNU General Public License as published by the
    00009 // Free Software Foundation; either version 2, or (at your option)
    00010 // any later version.
    00011
    00012 // This library is distributed in the hope that it will be useful,
    00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00015 // GNU General Public License for more details.
    00016
    00017 // You should have received a copy of the GNU General Public License along
    00018 // with this library; see the file COPYING.  If not, write to the Free
    00019 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    00020 // USA.
    00021
    00022 // As a special exception, you may use this file as part of a free software
    00023 // library without restriction.  Specifically, if other files instantiate
    00024 // templates or use macros or inline functions from this file, or you compile
    00025 // this file and link it with other files to produce an executable, this
    00026 // file does not by itself cause the resulting executable to be covered by
    00027 // the GNU General Public License.  This exception does not however
    00028 // invalidate any other reasons why the executable file might be covered by
    00029 // the GNU General Public License.
    00030
    00031 // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
    00032
    00033 /** @file valarray_after.h
    00034  *  This is an internal header file, included by other library headers.
    00035  *  You should not attempt to use it directly.
    00036  */
    00037
    00038 #ifndef _VALARRAY_AFTER_H
    00039 #define _VALARRAY_AFTER_H 1
    00040
    00041 #pragma GCC system_header
    00042
    00043 namespace std
    00044 {
    00045   //
    00046   // gslice_array closure.
    00047   //
    00048   template<class _Dom>
    00049     class _GBase
    00050     {
    00051     public:
    00052       typedef typename _Dom::value_type value_type;
    00053
    00054       _GBase (const _Dom& __e, const valarray<size_t>& __i)
    00055       : _M_expr (__e), _M_index(__i) {}
    00056
    00057       value_type
    00058       operator[] (size_t __i) const
    00059       { return _M_expr[_M_index[__i]]; }
    00060
    00061       size_t
    00062       size () const
    00063       { return _M_index.size(); }
    00064
    00065     private:
    00066       const _Dom&         _M_expr;
    00067       const valarray<size_t>& _M_index;
    00068     };
    00069
    00070   template<typename _Tp>
    00071     class _GBase<_Array<_Tp> >
    00072     {
    00073     public:
    00074       typedef _Tp value_type;
    00075
    00076       _GBase (_Array<_Tp> __a, const valarray<size_t>& __i)
    00077       : _M_array (__a), _M_index(__i) {}
    00078
    00079       value_type
    00080       operator[] (size_t __i) const
    00081       { return _M_array._M_data[_M_index[__i]]; }
    00082
    00083       size_t
    00084       size () const
    00085       { return _M_index.size(); }
    00086
    00087     private:
    00088       const _Array<_Tp>       _M_array;
    00089       const valarray<size_t>& _M_index;
    00090     };
    00091
    00092   template<class _Dom>
    00093     struct _GClos<_Expr, _Dom>
    00094     : _GBase<_Dom>
    00095     {
    00096       typedef _GBase<_Dom> _Base;
    00097       typedef typename _Base::value_type value_type;
    00098
    00099       _GClos (const _Dom& __e, const valarray<size_t>& __i)
    00100       : _Base (__e, __i) {}
    00101     };
    00102
    00103   template<typename _Tp>
    00104     struct _GClos<_ValArray, _Tp>
    00105     : _GBase<_Array<_Tp> >
    00106     {
    00107       typedef _GBase<_Array<_Tp> > _Base;
    00108       typedef typename _Base::value_type value_type;
    00109
    00110       _GClos (_Array<_Tp> __a, const valarray<size_t>& __i)
    00111       : _Base (__a, __i) {}
    00112     };
    00113
    00114   //
    00115   // indirect_array closure
    00116   //
    00117   template<class _Dom>
    00118     class _IBase
    00119     {
    00120     public:
    00121       typedef typename _Dom::value_type value_type;
    00122
    00123       _IBase (const _Dom& __e, const valarray<size_t>& __i)
    00124       : _M_expr (__e), _M_index (__i) {}
    00125
    00126       value_type
    00127       operator[] (size_t __i) const
    00128       { return _M_expr[_M_index[__i]]; }
    00129
    00130       size_t
    00131       size() const
    00132       { return _M_index.size(); }
    00133
    00134     private:
    00135       const _Dom&         _M_expr;
    00136       const valarray<size_t>& _M_index;
    00137     };
    00138
    00139   template<class _Dom>
    00140     struct _IClos<_Expr, _Dom>
    00141     : _IBase<_Dom>
    00142     {
    00143       typedef _IBase<_Dom> _Base;
    00144       typedef typename _Base::value_type value_type;
    00145
    00146       _IClos (const _Dom& __e, const valarray<size_t>& __i)
    00147       : _Base (__e, __i) {}
    00148     };
    00149
    00150   template<typename _Tp>
    00151     struct _IClos<_ValArray, _Tp>
    00152     : _IBase<valarray<_Tp> >
    00153     {
    00154       typedef _IBase<valarray<_Tp> > _Base;
    00155       typedef _Tp value_type;
    00156
    00157       _IClos (const valarray<_Tp>& __a, const valarray<size_t>& __i)
    00158       : _Base (__a, __i) {}
    00159     };
    00160
    00161   //
    00162   // class _Expr
    00163   //
    00164   template<class _Clos, typename _Tp>
    00165     class _Expr
    00166     {
    00167     public:
    00168       typedef _Tp value_type;
    00169
    00170       _Expr(const _Clos&);
    00171
    00172       const _Clos& operator()() const;
    00173
    00174       value_type operator[](size_t) const;
    00175       valarray<value_type> operator[](slice) const;
    00176       valarray<value_type> operator[](const gslice&) const;
    00177       valarray<value_type> operator[](const valarray<bool>&) const;
    00178       valarray<value_type> operator[](const valarray<size_t>&) const;
    00179
    00180       _Expr<_UnClos<__unary_plus, std::_Expr, _Clos>, value_type>
    00181       operator+() const;
    00182
    00183       _Expr<_UnClos<__negate, std::_Expr, _Clos>, value_type>
    00184       operator-() const;
    00185
    00186       _Expr<_UnClos<__bitwise_not, std::_Expr, _Clos>, value_type>
    00187       operator~() const;
    00188
    00189       _Expr<_UnClos<__logical_not, std::_Expr, _Clos>, bool>
    00190       operator!() const;
    00191
    00192       size_t size() const;
    00193       value_type sum() const;
    00194
    00195       valarray<value_type> shift(int) const;
    00196       valarray<value_type> cshift(int) const;
    00197
    00198       value_type min() const;
    00199       value_type max() const;
    00200
    00201       valarray<value_type> apply(value_type (*)(const value_type&)) const;
    00202       valarray<value_type> apply(value_type (*)(value_type)) const;
    00203
    00204     private:
    00205       const _Clos _M_closure;
    00206     };
    00207
    00208   template<class _Clos, typename _Tp>
    00209     inline
    00210     _Expr<_Clos, _Tp>::_Expr(const _Clos& __c) : _M_closure(__c) {}
    00211
    00212   template<class _Clos, typename _Tp>
    00213     inline const _Clos&
    00214     _Expr<_Clos, _Tp>::operator()() const
    00215     { return _M_closure; }
    00216
    00217   template<class _Clos, typename _Tp>
    00218     inline _Tp
    00219     _Expr<_Clos, _Tp>::operator[](size_t __i) const
    00220     { return _M_closure[__i]; }
    00221
    00222   template<class _Clos, typename _Tp>
    00223     inline valarray<_Tp>
    00224     _Expr<_Clos, _Tp>::operator[](slice __s) const
    00225     { return _M_closure[__s]; }
    00226
    00227   template<class _Clos, typename _Tp>
    00228     inline valarray<_Tp>
    00229     _Expr<_Clos, _Tp>::operator[](const gslice& __gs) const
    00230     { return _M_closure[__gs]; }
    00231
    00232   template<class _Clos, typename _Tp>
    00233     inline valarray<_Tp>
    00234     _Expr<_Clos, _Tp>::operator[](const valarray<bool>& __m) const
    00235     { return _M_closure[__m]; }
    00236
    00237   template<class _Clos, typename _Tp>
    00238     inline valarray<_Tp>
    00239     _Expr<_Clos, _Tp>::operator[](const valarray<size_t>& __i) const
    00240     { return _M_closure[__i]; }
    00241
    00242   template<class _Clos, typename _Tp>
    00243     inline size_t
    00244     _Expr<_Clos, _Tp>::size() const
    00245     { return _M_closure.size (); }
    00246
    00247   template<class _Clos, typename _Tp>
    00248     inline valarray<_Tp>
    00249     _Expr<_Clos, _Tp>::shift(int __n) const
    00250     { return valarray<_Tp>(_M_closure).shift(__n); }
    00251
    00252   template<class _Clos, typename _Tp>
    00253     inline valarray<_Tp>
    00254     _Expr<_Clos, _Tp>::cshift(int __n) const
    00255     { return valarray<_Tp>(_M_closure).cshift(__n); }
    00256
    00257   template<class _Clos, typename _Tp>
    00258     inline valarray<_Tp>
    00259     _Expr<_Clos, _Tp>::apply(_Tp __f(const _Tp&)) const
    00260     { return valarray<_Tp>(_M_closure).apply(__f); }
    00261
    00262   template<class _Clos, typename _Tp>
    00263     inline valarray<_Tp>
    00264     _Expr<_Clos, _Tp>::apply(_Tp __f(_Tp)) const
    00265     { return valarray<_Tp>(_M_closure).apply(__f); }
    00266
    00267   // XXX: replace this with a more robust summation algorithm.
    00268   template<class _Clos, typename _Tp>
    00269     inline _Tp
    00270     _Expr<_Clos, _Tp>::sum() const
    00271     {
    00272       size_t __n = _M_closure.size();
    00273       if (__n == 0)
    00274     return _Tp();
    00275       else
    00276     {
    00277       _Tp __s = _M_closure[--__n];
    00278       while (__n != 0)
    00279         __s += _M_closure[--__n];
    00280       return __s;
    00281         }
    00282     }
    00283
    00284   template<class _Clos, typename _Tp>
    00285     inline _Tp
    00286     _Expr<_Clos, _Tp>::min() const
    00287     { return __valarray_min(_M_closure); }
    00288
    00289   template<class _Clos, typename _Tp>
    00290     inline _Tp
    00291     _Expr<_Clos, _Tp>::max() const
    00292     { return __valarray_max(_M_closure); }
    00293
    00294   template<class _Dom, typename _Tp>
    00295     inline _Expr<_UnClos<__logical_not, _Expr, _Dom>, bool>
    00296     _Expr<_Dom, _Tp>::operator!() const
    00297     {
    00298       typedef _UnClos<__logical_not, std::_Expr, _Dom> _Closure;
    00299       return _Expr<_Closure, _Tp>(_Closure(this->_M_closure));
    00300     }
    00301
    00302 #define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name)                           \
    00303   template<class _Dom, typename _Tp>                                      \
    00304     inline _Expr<_UnClos<_Name, std::_Expr, _Dom>, _Tp>                   \
    00305     _Expr<_Dom, _Tp>::operator _Op() const                                \
    00306     {                                                                     \
    00307       typedef _UnClos<_Name, std::_Expr, _Dom> _Closure;                  \
    00308       return _Expr<_Closure, _Tp>(_Closure(this->_M_closure));            \
    00309     }
    00310
    00311     _DEFINE_EXPR_UNARY_OPERATOR(+, __unary_plus)
    00312     _DEFINE_EXPR_UNARY_OPERATOR(-, __negate)
    00313     _DEFINE_EXPR_UNARY_OPERATOR(~, __bitwise_not)
    00314
    00315 #undef _DEFINE_EXPR_UNARY_OPERATOR
    00316
    00317 #define _DEFINE_EXPR_BINARY_OPERATOR(_Op, _Name)                        \
    00318   template<class _Dom1, class _Dom2>                    \
    00319     inline _Expr<_BinClos<_Name, _Expr, _Expr, _Dom1, _Dom2>,           \
    00320            typename __fun<_Name, typename _Dom1::value_type>::result_type> \
    00321     operator _Op(const _Expr<_Dom1, typename _Dom1::value_type>& __v,   \
    00322              const _Expr<_Dom2, typename _Dom2::value_type>& __w)   \
    00323     {                                                                   \
    00324       typedef typename _Dom1::value_type _Arg;                          \
    00325       typedef typename __fun<_Name, _Arg>::result_type _Value;          \
    00326       typedef _BinClos<_Name, _Expr, _Expr, _Dom1, _Dom2> _Closure;     \
    00327       return _Expr<_Closure, _Value>(_Closure(__v(), __w()));           \
    00328     }                                                                   \
    00329                                                                         \
    00330   template<class _Dom>                                                  \
    00331     inline _Expr<_BinClos<_Name, _Expr, _Constant, _Dom,                \
    00332                           typename _Dom::value_type>,                   \
    00333              typename __fun<_Name, typename _Dom::value_type>::result_type> \
    00334     operator _Op(const _Expr<_Dom, typename _Dom::value_type>& __v,     \
    00335                  const typename _Dom::value_type& __t)                  \
    00336     {                                                                   \
    00337       typedef typename _Dom::value_type _Arg;                           \
    00338       typedef typename __fun<_Name, _Arg>::result_type _Value;          \
    00339       typedef _BinClos<_Name, _Expr, _Constant, _Dom, _Arg> _Closure;   \
    00340       return _Expr<_Closure, _Value>(_Closure(__v(), __t));             \
    00341     }                                                                   \
    00342                                                                         \
    00343   template<class _Dom>                                                  \
    00344     inline _Expr<_BinClos<_Name, _Constant, _Expr,                      \
    00345                           typename _Dom::value_type, _Dom>,             \
    00346              typename __fun<_Name, typename _Dom::value_type>::result_type> \
    00347     operator _Op(const typename _Dom::value_type& __t,                  \
    00348                  const _Expr<_Dom, typename _Dom::value_type>& __v)     \
    00349     {                                                                   \
    00350       typedef typename _Dom::value_type _Arg;                           \
    00351       typedef typename __fun<_Name, _Arg>::result_type _Value;          \
    00352       typedef _BinClos<_Name, _Constant, _Expr, _Arg, _Dom> _Closure;   \
    00353       return _Expr<_Closure, _Value>(_Closure(__t, __v()));             \
    00354     }                                                                   \
    00355                                                                         \
    00356   template<class _Dom>                                                  \
    00357     inline _Expr<_BinClos<_Name, _Expr, _ValArray,                      \
    00358                           _Dom, typename _Dom::value_type>,             \
    00359              typename __fun<_Name, typename _Dom::value_type>::result_type> \
    00360     operator _Op(const _Expr<_Dom,typename _Dom::value_type>& __e,      \
    00361                  const valarray<typename _Dom::value_type>& __v)        \
    00362     {                                                                   \
    00363       typedef typename _Dom::value_type _Arg;                           \
    00364       typedef typename __fun<_Name, _Arg>::result_type _Value;          \
    00365       typedef _BinClos<_Name, _Expr, _ValArray, _Dom, _Arg> _Closure;   \
    00366       return _Expr<_Closure, _Value>(_Closure(__e(), __v));             \
    00367     }                                                                   \
    00368                                                                         \
    00369   template<class _Dom>                                                  \
    00370     inline _Expr<_BinClos<_Name, _ValArray, _Expr,                      \
    00371                  typename _Dom::value_type, _Dom>,                      \
    00372              typename __fun<_Name, typename _Dom::value_type>::result_type> \
    00373     operator _Op(const valarray<typename _Dom::value_type>& __v,        \
    00374                  const _Expr<_Dom, typename _Dom::value_type>& __e)     \
    00375     {                                                                   \
    00376       typedef typename _Dom::value_type _Tp;                            \
    00377       typedef typename __fun<_Name, _Tp>::result_type _Value;           \
    00378       typedef _BinClos<_Name, _ValArray, _Expr, _Tp, _Dom> _Closure;    \
    00379       return _Expr<_Closure, _Value>(_Closure(__v, __e ()));            \
    00380     }
    00381
    00382     _DEFINE_EXPR_BINARY_OPERATOR(+, __plus)
    00383     _DEFINE_EXPR_BINARY_OPERATOR(-, __minus)
    00384     _DEFINE_EXPR_BINARY_OPERATOR(*, __multiplies)
    00385     _DEFINE_EXPR_BINARY_OPERATOR(/, __divides)
    00386     _DEFINE_EXPR_BINARY_OPERATOR(%, __modulus)
    00387     _DEFINE_EXPR_BINARY_OPERATOR(^, __bitwise_xor)
    00388     _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and)
    00389     _DEFINE_EXPR_BINARY_OPERATOR(|, __bitwise_or)
    00390     _DEFINE_EXPR_BINARY_OPERATOR(<<, __shift_left)
    00391     _DEFINE_EXPR_BINARY_OPERATOR(>>, __shift_right)
    00392     _DEFINE_EXPR_BINARY_OPERATOR(&&, __logical_and)
    00393     _DEFINE_EXPR_BINARY_OPERATOR(||, __logical_or)
    00394     _DEFINE_EXPR_BINARY_OPERATOR(==, __equal_to)
    00395     _DEFINE_EXPR_BINARY_OPERATOR(!=, __not_equal_to)
    00396     _DEFINE_EXPR_BINARY_OPERATOR(<, __less)
    00397     _DEFINE_EXPR_BINARY_OPERATOR(>, __greater)
    00398     _DEFINE_EXPR_BINARY_OPERATOR(<=, __less_equal)
    00399     _DEFINE_EXPR_BINARY_OPERATOR(>=, __greater_equal)
    00400
    00401 #undef _DEFINE_EXPR_BINARY_OPERATOR
    00402
    00403 #define _DEFINE_EXPR_UNARY_FUNCTION(_Name)                               \
    00404   template<class _Dom>                                                   \
    00405     inline _Expr<_UnClos<__##_Name, _Expr, _Dom>,                        \
    00406                  typename _Dom::value_type>                              \
    00407     _Name(const _Expr<_Dom, typename _Dom::value_type>& __e)             \
    00408     {                                                                    \
    00409       typedef typename _Dom::value_type _Tp;                             \
    00410       typedef _UnClos<__##_Name, _Expr, _Dom> _Closure;                  \
    00411       return _Expr<_Closure, _Tp>(_Closure(__e()));                      \
    00412     }                                                                    \
    00413                                                                          \
    00414   template<typename _Tp>                                                 \
    00415     inline _Expr<_UnClos<__##_Name, _ValArray, _Tp>, _Tp>                \
    00416     _Name(const valarray<_Tp>& __v)                                      \
    00417     {                                                                    \
    00418       typedef _UnClos<__##_Name, _ValArray, _Tp> _Closure;               \
    00419       return _Expr<_Closure, _Tp>(_Closure(__v));                        \
    00420     }
    00421
    00422     _DEFINE_EXPR_UNARY_FUNCTION(abs)
    00423     _DEFINE_EXPR_UNARY_FUNCTION(cos)
    00424     _DEFINE_EXPR_UNARY_FUNCTION(acos)
    00425     _DEFINE_EXPR_UNARY_FUNCTION(cosh)
    00426     _DEFINE_EXPR_UNARY_FUNCTION(sin)
    00427     _DEFINE_EXPR_UNARY_FUNCTION(asin)
    00428     _DEFINE_EXPR_UNARY_FUNCTION(sinh)
    00429     _DEFINE_EXPR_UNARY_FUNCTION(tan)
    00430     _DEFINE_EXPR_UNARY_FUNCTION(tanh)
    00431     _DEFINE_EXPR_UNARY_FUNCTION(atan)
    00432     _DEFINE_EXPR_UNARY_FUNCTION(exp)
    00433     _DEFINE_EXPR_UNARY_FUNCTION(log)
    00434     _DEFINE_EXPR_UNARY_FUNCTION(log10)
    00435     _DEFINE_EXPR_UNARY_FUNCTION(sqrt)
    00436
    00437 #undef _DEFINE_EXPR_UNARY_FUNCTION
    00438
    00439 #define _DEFINE_EXPR_BINARY_FUNCTION(_Fun)                             \
    00440   template<class _Dom1, class _Dom2>                                   \
    00441     inline _Expr<_BinClos<__##_Fun, _Expr, _Expr, _Dom1, _Dom2>,       \
    00442          typename _Dom1::value_type>                           \
    00443     _Fun(const _Expr<_Dom1, typename _Dom1::value_type>& __e1,         \
    00444       const _Expr<_Dom2, typename _Dom2::value_type>& __e2)        \
    00445     {                                                                  \
    00446       typedef typename _Dom1::value_type _Tp;                          \
    00447       typedef _BinClos<__##_Fun, _Expr, _Expr, _Dom1, _Dom2> _Closure; \
    00448       return _Expr<_Closure, _Tp>(_Closure(__e1(), __e2()));           \
    00449     }                                                                  \
    00450                                                                        \
    00451   template<class _Dom>                                                 \
    00452     inline _Expr<_BinClos<__##_Fun, _Expr, _ValArray, _Dom,            \
    00453               typename _Dom::value_type>,                  \
    00454          typename _Dom::value_type>                            \
    00455     _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e,            \
    00456      const valarray<typename _Dom::value_type>& __v)               \
    00457     {                                                                  \
    00458       typedef typename _Dom::value_type _Tp;                           \
    00459       typedef _BinClos<__##_Fun, _Expr, _ValArray, _Dom, _Tp> _Closure; \
    00460       return _Expr<_Closure, _Tp>(_Closure(__e(), __v));               \
    00461     }                                                                  \
    00462                                                                        \
    00463   template<class _Dom>                                                 \
    00464     inline _Expr<_BinClos<__##_Fun, _ValArray, _Expr,                  \
    00465               typename _Dom::value_type, _Dom>,            \
    00466          typename _Dom::value_type>                            \
    00467     _Fun(const valarray<typename _Dom::valarray>& __v,                 \
    00468      const _Expr<_Dom, typename _Dom::value_type>& __e)            \
    00469     {                                                                  \
    00470       typedef typename _Dom::value_type _Tp;                           \
    00471       typedef _BinClos<__##_Fun, _ValArray, _Expr, _Tp, _Dom> _Closure; \
    00472       return _Expr<_Closure, _Tp>(_Closure(__v, __e()));               \
    00473     }                                                                  \
    00474                                                                        \
    00475   template<class _Dom>                                                 \
    00476     inline _Expr<_BinClos<__##_Fun, _Expr, _Constant, _Dom,            \
    00477               typename _Dom::value_type>,                  \
    00478          typename _Dom::value_type>                            \
    00479     _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e,            \
    00480      const typename _Dom::value_type& __t)                         \
    00481     {                                                                  \
    00482       typedef typename _Dom::value_type _Tp;                           \
    00483       typedef _BinClos<__##_Fun, _Expr, _Constant, _Dom, _Tp> _Closure;\
    00484       return _Expr<_Closure, _Tp>(_Closure(__e(), __t));               \
    00485     }                                                                  \
    00486                                                                        \
    00487   template<class _Dom>                                                 \
    00488     inline _Expr<_BinClos<__##_Fun, _Constant, _Expr,                  \
    00489               typename _Dom::value_type, _Dom>,            \
    00490          typename _Dom::value_type>                            \
    00491     _Fun(const typename _Dom::value_type& __t,                         \
    00492      const _Expr<_Dom, typename _Dom::value_type>& __e)            \
    00493     {                                                                  \
    00494       typedef typename _Dom::value_type _Tp;                           \
    00495       typedef _BinClos<__##_Fun, _Constant, _Expr, _Tp, _Dom> _Closure; \
    00496       return _Expr<_Closure, _Tp>(_Closure(__t, __e()));               \
    00497     }                                                                  \
    00498                                                                        \
    00499   template<typename _Tp>                                               \
    00500     inline _Expr<_BinClos<__##_Fun, _ValArray, _ValArray, _Tp, _Tp>, _Tp> \
    00501     _Fun(const valarray<_Tp>& __v, const valarray<_Tp>& __w)           \
    00502     {                                                                  \
    00503       typedef _BinClos<__##_Fun, _ValArray, _ValArray, _Tp, _Tp> _Closure; \
    00504       return _Expr<_Closure, _Tp>(_Closure(__v, __w));                 \
    00505     }                                                                  \
    00506                                                                        \
    00507   template<typename _Tp>                                               \
    00508     inline _Expr<_BinClos<__##_Fun, _ValArray, _Constant, _Tp, _Tp>, _Tp> \
    00509     _Fun(const valarray<_Tp>& __v, const _Tp& __t)                     \
    00510     {                                                                  \
    00511       typedef _BinClos<__##_Fun, _ValArray, _Constant, _Tp, _Tp> _Closure; \
    00512       return _Expr<_Closure, _Tp>(_Closure(__v, __t));                 \
    00513     }                                                                  \
    00514                                        \
    00515   template<typename _Tp>                                               \
    00516     inline _Expr<_BinClos<__##_Fun, _Constant, _ValArray, _Tp, _Tp>, _Tp> \
    00517     _Fun(const _Tp& __t, const valarray<_Tp>& __v)                     \
    00518     {                                                                  \
    00519       typedef _BinClos<__##_Fun, _Constant, _ValArray, _Tp, _Tp> _Closure; \
    00520       return _Expr<_Closure, _Tp>(_Closure(__t, __v));                 \
    00521     }
    00522
    00523 _DEFINE_EXPR_BINARY_FUNCTION(atan2)
    00524 _DEFINE_EXPR_BINARY_FUNCTION(pow)
    00525
    00526 #undef _DEFINE_EXPR_BINARY_FUNCTION
    00527
    00528 } // std::
    00529
    00530 #endif /* _CPP_VALARRAY_AFTER_H */
    00531
    00532 // Local Variables:
    00533 // mode:c++
    00534 // End: