This is the mail archive of the libstdc++@gcc.gnu.org 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]
Other format: [Raw text]

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];


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