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

Generated on Thu Jul 23 21:16:35 2009 for libstdc++ by  doxygen 1.5.8