Valarray: bug in binary operator
Serge Barral
sbarral@ippt.gov.pl
Thu Nov 18 05:13:00 GMT 1999
Hi,
A code like the following would result in a core dump:
valarray<double> A(1.0,80), B(80);
B=A*(A+1);
More generaly, a binary operator taking a valarray as first argument and
a template expression as second argument gives either unexpected results
or a segfault ( at least with the libstdc++ of gcc 2.95.1 and with
libstdc++2.90.6 - I didn't try the cvs version).
The patch below seems to adress this problem.
Congratulation for your implementation of valarray. I was looking for
something more lightweight than Blitz++, and your valarray really works
fine: compilation is 5 time faster, and doesn't eat all my RAM (I didn't
make a run-time comparison thought)
Serge
===========================================================
in valarray_meta.h
452c452
< _BinClos (const valarray<_Tp> __e1, const _Dom& __e2)
---
> _BinClos (const valarray<_Tp>& __e1, const _Dom& __e2)
More information about the Libstdc++
mailing list