slices ; Stroustrup & libstdc++
Gerhard Wesp
gwesp@cosy.sbg.ac.at
Fri Jun 16 03:59:00 GMT 2000
hi all,
i just tried a slice_array example from stroustrup, 3rd ed., p. 671
which fails with the following error:
grisu ~/c++% cat slice.cc
#include <valarray>
void f(std::valarray<double>& d)
{
std::slice_array<double>& v_even = d[std::slice(0,d.size()/2,2)];
}
grisu ~/c++% g++ -fhonor-std -c slice.cc
slice.cc: In function `void f(std::valarray<double> &)':
slice.cc:5: initialization of non-const reference type `class std::slice_array<double> &'
slice.cc:5: from rvalue of type `std::slice_array<double>'
grisu ~/c++% g++ -v
Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)
is stroustrup wrong, or is libstdc++ (i'm using version
libstdc++.so.3.0.0) wrong, or am i missing something?
greetings,
-gerhard
More information about the Libstdc++
mailing list