This paper provides proposed wording for "option #5" in N3257 by Jonathan Wakely and Bjarne Stroustrup, which specifies that the range-based for loop should look for member functions
end() first, and fall back to the current ADL-based behavior only when the type of the range does not contain either "begin" or "end".
Modify 6.5.4 [stmt.ranged]p1 by inserting the following new bullet after the first:
_RangeTis an array type, begin-expr and end-expr are
__range + __bound, respectively, where
__boundis the array bound. If
_RangeTis an array of unknown size or an array of incomplete type, the program is ill-formed.;
_RangeTis a class type, the unqualified-ids
endare looked up in the scope of class
_RangeTas if by class member access lookup (3.4.5), and if either (or both) finds at least one declaration, begin-expr and end-expr are
end(__range), respectively, where begin and end are looked up with argument-dependent lookup (3.4.2). For the purposes of this name lookup, namespace std is an associated namespace.