This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

valarray problem with gcc-2.95.1


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]