[Top-posting elided.]
"red floyd" <redfloyd@gmail.com> wrote in message
news:bb2cad9a-132d-4012-ae14-3c650b267528@n30g2000vba.googlegroups.com...
On Feb 26, 1:01 pm, "mlt" <a...@asd.com> wrote:
Will the new java For each construct be integrated into C++?
What is the java For each construct? And why would a java construct
be integrated into C++?
Currently, there's the std::for_each() algorithm, and in C++0x, there
will be a new for loop syntax to iterate over an entire container.
mlt wrote:
Ok so C++ already supports something like this:
http://java.sun.com/j2se/1.5.0/docs/guide/language/foreach.html
C++ supports several constructs that are varying degrees of "like this."
The closest thing compatible with the current standard is probably either
Boost.Foreach, or std::for_each with a Boost.Lambda expression. The most
commonly used is probably either the plain old for-loop or std::for_each
with a separately defined functor. The closest available in the core
language probably is the new syntax mentioned by red floyd, but it's still
not standard, and not available in most compilers.
so "For each" actually is working in C++ like in java.