This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
slices ; Stroustrup & libstdc++
- To: libstdc++ at sourceware dot cygnus dot com
- Subject: slices ; Stroustrup & libstdc++
- From: Gerhard Wesp <gwesp at cosy dot sbg dot ac dot at>
- Date: Fri, 16 Jun 2000 12:59:00 +0200
- Reply-To: gwesp at cosy dot sbg dot ac dot at
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