slices ; Stroustrup & libstdc++
Gabriel Dos Reis
Gabriel.Dos-Reis@cmla.ens-cachan.fr
Sun Jun 18 14:09:00 GMT 2000
<llewelly@dbritsch.dsl.xmission.com> writes:
| On Sat, 17 Jun 2000 llewelly@dbritsch.dsl.xmission.com wrote:
|
| > On Sat, 17 Jun 2000, brent verner wrote:
| >
| > > on Fri, Jun 16, 2000 at 12:59:00PM +0200, Gerhard Wesp typed aloud:
| > > | 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)];
|
| A bit more info:
| 26.3.2.4 has:
|
| slice_array<T> operator[](slice);
|
| and since temporaries cannot be assigned to non-const references, this
| code seems to be wrong.
Exactly.
-- Gaby
More information about the Libstdc++
mailing list