]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
valarray_after.h (_Expr<>::operator[](slice)): Don't assume the closure implements...
authorGabriel Dos Reis <gdr@integrable-solutions.net>
Sat, 17 Dec 2005 15:36:35 +0000 (15:36 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Sat, 17 Dec 2005 15:36:35 +0000 (15:36 +0000)
        * include/bits/valarray_after.h (_Expr<>::operator[](slice)):
        Don't assume the closure implements general indexing, as a matter
        of fact, most of them don't.
        (_Expr<>::operator[](const gslice&)): Likewise.
        (_Expr<>::operator[](const valarray<bool>&)): Likewise.
        (_Expr<>::operator[](const valarray<size_t>&)): Likewise.
        (_Expr<>::shift): Fix thinko.
        (_Expr<>::cshift): Likewise.
        (_Expr<>::apply): Likewise.

From-SVN: r108714

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/valarray_after.h

index 28448e5ebd3278b6ba51e88d5aaeb33f432e4e2e..273e2f1a15c82bb21653fa9a706157a80e56aef3 100644 (file)
@@ -1,3 +1,15 @@
+2005-12-17  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+
+       * include/bits/valarray_after.h (_Expr<>::operator[](slice)): 
+       Don't assume the closure implements general indexing, as a matter
+       of fact, most of them don't.
+       (_Expr<>::operator[](const gslice&)): Likewise.
+       (_Expr<>::operator[](const valarray<bool>&)): Likewise.
+       (_Expr<>::operator[](const valarray<size_t>&)): Likewise.
+       (_Expr<>::shift): Fix thinko.
+       (_Expr<>::cshift): Likewise.
+       (_Expr<>::apply): Likewise.
+
 2005-12-16  Paolo Carlini  <pcarlini@suse.de>
 
        * testsuite/tr1/4_metaprogramming/type_properties/is_empty/is_empty.cc:
index 4838cd44b4fc20e3de668224dc4b61cb1a0dbbb7..8d73d42f27c7f226e549389409ed95b0efbfe6f9 100644 (file)
@@ -222,47 +222,71 @@ namespace std
   template<class _Clos, typename _Tp>
     inline valarray<_Tp>
     _Expr<_Clos, _Tp>::operator[](slice __s) const
-    { return _M_closure[__s]; }
+    {
+      valarray<_Tp> __v = valarray<_Tp>(*this)[__s];
+      return __v;
+    }
 
   template<class _Clos, typename _Tp>
     inline valarray<_Tp>
     _Expr<_Clos, _Tp>::operator[](const gslice& __gs) const
-    { return _M_closure[__gs]; }
+    {
+      valarray<_Tp> __v = valarray<_Tp>(*this)[__gs];
+      return __v;
+    }
 
   template<class _Clos, typename _Tp>
     inline valarray<_Tp>
     _Expr<_Clos, _Tp>::operator[](const valarray<bool>& __m) const
-    { return _M_closure[__m]; }
+    {
+      valarray<_Tp> __v = valarray<_Tp>(*this)[__m];
+      return __v;
+    }
 
   template<class _Clos, typename _Tp>
     inline valarray<_Tp>
     _Expr<_Clos, _Tp>::operator[](const valarray<size_t>& __i) const
-    { return _M_closure[__i]; }
+    {
+      valarray<_Tp> __v = valarray<_Tp>(*this)[__i];
+      return __v;
+    }
 
   template<class _Clos, typename _Tp>
     inline size_t
     _Expr<_Clos, _Tp>::size() const
-    { return _M_closure.size (); }
+    { 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); }
+    {
+      valarray<_Tp> __v = valarray<_Tp>(*this).shift(__n);
+      return __v;
+    }
 
   template<class _Clos, typename _Tp>
     inline valarray<_Tp>
     _Expr<_Clos, _Tp>::cshift(int __n) const
-    { return valarray<_Tp>(_M_closure).cshift(__n); }
+    {
+      valarray<_Tp> __v = valarray<_Tp>(*this).cshift(__n);
+      return __v;
+    }
 
   template<class _Clos, typename _Tp>
     inline valarray<_Tp>
     _Expr<_Clos, _Tp>::apply(_Tp __f(const _Tp&)) const
-    { return valarray<_Tp>(_M_closure).apply(__f); }
+    {
+      valarray<_Tp> __v = valarray<_Tp>(*this).apply(__f);
+      return __v;
+    }
 
   template<class _Clos, typename _Tp>
     inline valarray<_Tp>
     _Expr<_Clos, _Tp>::apply(_Tp __f(_Tp)) const
-    { return valarray<_Tp>(_M_closure).apply(__f); }
+    {
+      valarray<_Tp> __v = valarray<_Tp>(*this).apply(__f);
+      return __v;
+    }
 
   // XXX: replace this with a more robust summation algorithm.
   template<class _Clos, typename _Tp>