create an object in a loop c++ code example Example: c++ loop trhought object for (auto const& i : data) { std::cout << i.name; }