• Saves Valuable Time
  • Trusted Accuracy for 14 Years
  • 15-Day Money-Back Guarantee

C++ Equivalent to the Java For Each Loop

The C++ syntax is identical:

Java C++
for (String s : StringList)
{
    ...
}
//C++11:
for (std::string s : StringList)
{
    ...
}
//prior to C++11, the conversion is unpleasant
//(assuming a vector of std::string):
for (std::vector<std::string>::const_iterator s = StringList.begin(); s != StringList.end(); ++s)
{
    ...
}


Use Java to C++ Converter to convert from Java to C++.     

Additional resource: Java and C++ Equivalents


Copyright © 1997 – 2018 Tangible Software Solutions, Inc.