[cfe-dev] [clang++][c++11] complier problems about "ranged-based for"
James Dennett
james.dennett at gmail.com
Fri Mar 8 09:44:45 PST 2013
On Fri, Mar 8, 2013 at 2:32 AM, ZhangXiongpang <zhangxiongpang at gmail.com> wrote:
> James Dennett wrote
>>> In case (1), where "begin" and "end" are looked up as class members,
>>> C++ doesn't allow the syntax object.TypeName,
>
> I know C++ doesn't allow the syntax "object.TypeName",
> but the "object"(__begin) is a also a function object,
> it is callable. so why not treat the object as a function?
I'm sorry, I don't understand your question. Are you talking about
the case of your test (3), which compiles successfully (as it should),
or something else?
> James Dennett wrote
>>> In case (2), "begin" and "end" are found via argument-dependent
>>> lookup, which only finds function (and function template) names.
>
> I'm confused that if standard only permit implement to find function,
> why not explicitly saying that "begin" and "end" shall be functions?
Because it doesn't need to. The Standard is not a tutorial, and tries
to avoid redundancy.
-- James
More information about the cfe-dev
mailing list