Title
Valarray operator[] const returning value
Status
dup
Section
[valarray.access]
Submitter
Levente Farkas

Created on 1998-09-09.00:00:00 last changed 163 months ago

Messages

Date: 2010-10-21.18:28:33

Rationale:

The LWG believes that the interface was deliberately designed that way. That is what valarray was designed to do; that's where the "value array" name comes from. LWG members further comment that "we don't want valarray to be a full STL container." [valarray.access] specifies properties that indicate "an absence of aliasing" for non-constant arrays; this allows optimizations, including special hardware optimizations, that are not otherwise possible.

Duplicate: 389

Date: 1998-09-09.00:00:00

valarray:

    T operator[] (size_t) const;

why not

    const T& operator[] (size_t) const;

as in vector ???

One can't copy even from a const valarray eg:

    memcpy(ptr, &v[0], v.size() * sizeof(double));

[I] find this bug in valarray is very difficult.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg178
1998-09-09 00:00:00admincreate