• Saves Valuable Time
  • Trusted Accuracy for 12 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 – 2017 Tangible Software Solutions Inc.