valarray_meta.h (_Expr<>::shift, [...]): Implement.
authorGabriel Dos Reis <gdr@codesourcery.com>
Fri, 18 Aug 2000 11:01:22 +0000 (11:01 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Fri, 18 Aug 2000 11:01:22 +0000 (11:01 +0000)
* bits/valarray_meta.h (_Expr<>::shift, _Expr::cshift,
_Expr<>::apply): Implement.

From-SVN: r35785

libstdc++-v3/ChangeLog
libstdc++-v3/bits/valarray_meta.h

index 829722b7a1a44a749a77e8580f9ced7278f9648d..273a0abd23c8003055304c7817866fb5cabac256 100644 (file)
@@ -1,3 +1,8 @@
+2000-08-18  Gabriel Dos Reis  <gdr@codesourcery.com>
+
+       * bits/valarray_meta.h (_Expr<>::shift, _Expr::cshift,
+       _Expr<>::apply): Implement. 
+
 2000-08-18  Gabriel Dos Reis  <gdr@codesourcery.com>
 
        * bits/valarray_meta.h (_Expr<>::min, _Expr<>::max): Implement.
index f52ddbfd2f5e41541f39226f6cf1be5493c65b1c..df637d0684abbeaa4d82261b5527228a9c0814f4 100644 (file)
@@ -672,10 +672,9 @@ namespace std {
 
       value_type min() const;
       value_type max() const;
-//     _Meta<_ApplyFunctionWithValue<_Expr>, value_type>
-//     apply (value_type _M_func (value_type)) const;
-//     _Meta<_ApplyFunctionWithConstRef<_Expr>, value_type>
-//     apply (value_type _M_func (const value_type&)) const;
+
+      valarray<value_type> apply(value_type (*) (const value_type&)) const;
+      valarray<value_type> apply(value_type (*) (value_type)) const;
         
     private:
         const _Clos _M_closure;
@@ -718,7 +717,27 @@ namespace std {
     template<class _Clos, typename _Tp>
     inline size_t
     _Expr<_Clos,_Tp>::size () const  { return _M_closure.size (); }
+
+  template<class _Clos, typename _Tp>
+  inline valarray<_Tp>
+  _Expr<_Clos, _Tp>::shift(int __n) const
+  { return valarray<_Tp>(_M_closure).shift(__n); }
+
+  template<class _Clos, typename _Tp>
+  inline valarray<_Tp>
+  _Expr<_Clos, _Tp>::cshift(int __n) const
+  { return valarray<_Tp>(_M_closure).cshift(__n); }
+
+  ttemplate<class _Clos, typename _Tp>
+  inline valarray<_Tp>
+  _Expr<_Clos, _Tp>::apply(_Tp __f(const _Tp&)) const
+  { return valarray<_Tp>(_M_closure).apply(__f); }
     
+  ttemplate<class _Clos, typename _Tp>
+  inline valarray<_Tp>
+  _Expr<_Clos, _Tp>::apply(_Tp __f(_Tp)) const
+  { return valarray<_Tp>(_M_closure).apply(__f); }
+
     // XXX: replace this with a more robust summation algorithm.
     template<class _Clos, typename _Tp>
     inline _Tp