This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/49022] [C++0x][DR 2058] std::begin and std::end specialized for std::valarray with some operators are missing.
- From: "gdr at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 14 Jun 2011 13:54:41 +0000
- Subject: [Bug libstdc++/49022] [C++0x][DR 2058] std::begin and std::end specialized for std::valarray with some operators are missing.
- Auto-submitted: auto-generated
- References: <bug-49022-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49022
--- Comment #24 from Gabriel Dos Reis <gdr at gcc dot gnu.org> 2011-06-14 13:54:13 UTC ---
(In reply to comment #18)
> It should be identical to
>
> auto&& range = v1 + v2;
> for (auto b = std::begin(range), e = std::end(range); b != e; ++b)
> { ... }
> (see 6.5.4 [stmt.ranged])
This will not work with expression template-based implementation
of valarray. The reason is that `range' may be a surrogate, and
you are likely to get rubbish addresses.
I urge people to drop range-based iteration on valarrays.
It wasn't something we were dieing for. It grew out of
someone's idea of "uniformity" that failed to appreciate
that a valarray is not your usual container.
- Gaby