This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug c++/59165] gcc looks up begin(), end() for for-range loops for ints in namespace std


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59165

Daniel KrÃgler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #4 from Daniel KrÃgler <daniel.kruegler at googlemail dot com> ---
(In reply to Jonathan Wakely from comment #3)
> I think I remember the rationale now: std::begin and std::end only work if
> c.begin() and c.end() xist, in which case range-based for will use those
> members directly anyway.

This is not really the *reason* for the language change. The actual reason
becomes a bit clearer when looking at the dup of CWG 1442:

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#1445

I remember that this dup was actually inspired by the observation that
BOOST_FOR_EACH behaved subtly different to the language for-each lookup rules,
albeit both constructs are intended to perform the same thing. CWG 1442 just
ensured that the lookup rule in for each corresponds to existing lookup rules
in other places and is thus easier to understand.

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