fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4.  
  5. int main()
  6. {
  7. typedef std::vector<std::string> vec_type;
  8. vec_type v = { "test", "tester", "tester" };
  9.  
  10. vec_type::iterator it = v.begin();
  11. while (it != v.end())
  12. {
  13. const std::string& s = *it;
  14.  
  15. if (++it == v.end())
  16. std::cout << "LAST: " << s << '\n';
  17. else
  18. std::cout << s << '\n';
  19. }
  20. }
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
test
tester
LAST: tester