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