I noticed quite a while ago that in Visual C ++ 10 ADL fails when at least one of the arguments is a lambda.
std::vector<float> vec; for_each(begin(vec), end(vec), [](float) {});
The above cannot be compiled on VC ++ 10 and 11 (beta) (the beginning and the end can be found through ADL). When I convert a lambda function to a regular free function, everything works as expected.
I asked about it once on the Herb Sutters blog, and also read some msdn connection messages, and the usual answers were: this is a mistake, we did not implement the latest lambda standard, but which was understandable at the time, Things were not in baked goods yet form. There were also disturbing comments on MS connect that this would not be allowed for the next version, i.e. vc 11.
My question is, should this code work under the C ++ 11 standard? I canโt figure it out. Do I really need the prefix my for_each and other algorithms with std :: when I use lambdas? I somehow suspect that this behavior will not change after the release of vC ++ 11.
source share