cpp list for loop code example
Example 1: traverse through list c++
for (auto it = mylist.begin(); it != mylist.end(); ++it)
cout << ' ' << *it;
Example 2: cpp loop through object
std::list<Student>::iterator it;
for (it = data.begin(); it != data.end(); ++it){
std::cout << it->name;
}