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]

slices ; Stroustrup & libstdc++


  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

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