From 0911e38f05e183603a05a8c6582ddc79f2b817c0 Mon Sep 17 00:00:00 2001 From: gdr Date: Sat, 17 Dec 2005 15:36:35 +0000 Subject: * 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&)): Likewise. (_Expr<>::operator[](const valarray&)): Likewise. (_Expr<>::shift): Fix thinko. (_Expr<>::cshift): Likewise. (_Expr<>::apply): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@108714 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/include/bits/valarray_after.h | 42 +++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 9 deletions(-) (limited to 'libstdc++-v3/include') diff --git a/libstdc++-v3/include/bits/valarray_after.h b/libstdc++-v3/include/bits/valarray_after.h index 4838cd44b4f..8d73d42f27c 100644 --- a/libstdc++-v3/include/bits/valarray_after.h +++ b/libstdc++-v3/include/bits/valarray_after.h @@ -222,47 +222,71 @@ namespace std template inline valarray<_Tp> _Expr<_Clos, _Tp>::operator[](slice __s) const - { return _M_closure[__s]; } + { + valarray<_Tp> __v = valarray<_Tp>(*this)[__s]; + return __v; + } template 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 inline valarray<_Tp> _Expr<_Clos, _Tp>::operator[](const valarray& __m) const - { return _M_closure[__m]; } + { + valarray<_Tp> __v = valarray<_Tp>(*this)[__m]; + return __v; + } template inline valarray<_Tp> _Expr<_Clos, _Tp>::operator[](const valarray& __i) const - { return _M_closure[__i]; } + { + valarray<_Tp> __v = valarray<_Tp>(*this)[__i]; + return __v; + } template inline size_t _Expr<_Clos, _Tp>::size() const - { return _M_closure.size (); } + { return _M_closure.size(); } template 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 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 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 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 -- cgit v1.2.1