This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
const valarray question
- From: DJ Delorie <dj at redhat dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Tue, 8 Nov 2005 15:52:55 -0500
- Subject: const valarray question
Another interpreting-the-standards question. Consider:
const valarray<float> v(6);
slice s1, s2;
v[s1][s2];
G++ currently rejects this, because v[s1] is the _Expr<> type, not the
real valarray type, and the _Expr<> type doesn't implement (or doesn't
choose) the [](slice)const method. G++ lists alternatives that take
size_t instead of slice.
Why doesn't 26.3.1.3 apply for operator[](slice)const here? Or, why
doesn't g++ choose that method?
FYI this works:
((valarray<float>)(v[s1]))[s2];