This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
valarray problem with gcc-2.95.1
- To: libstdc++ at sourceware dot cygnus dot com
- Subject: valarray problem with gcc-2.95.1
- From: Serge Barral <sbarral at ippt dot gov dot pl>
- Date: Wed, 03 Nov 1999 11:35:15 +0100
Hi,
I'm using libsdc++-2.90.6 with gcc-2.95.1, and I have problems when
slicing a valarray. For instance this code:
#include <valarray>
using namespace std;
int main()
{
slice range(1,2,1);
double l[]={1.0 , 2.0 , 3.0 , 4.0};
valarray<double> c(l,4);
valarray<double> b(2);
b=c[range]+c[range]; // error here
return 0;
}
gives the following compile error:
>rien.cpp:In function `int main()':
>rien.cpp:12: no match for `slice_array<double> + slice_array<double>'
It looks like gcc does not choose the right signature for 'operator[]'
of class valarray, which I think in this case should be:
_Expr<_SClos<_ValArray,_Tp>, _Tp> operator[](slice) const;
and not:
slice_array<_Tp> operator[](slice);
Surprisingly, if I comment out the second signature in the file
'std_valarray.h', the code compiles. However, an expression like
'b=exp(c[slice(..,..,..])' will still not compile.
I'm quite new to c++, so maybe I'm missing something?
Is it really a problem with gcc? In this case, should I try gcc-2.95.0
or 2.95.2?
Thanks for help.
Serge