Skip to content

Instantly share code, notes, and snippets.

@zachelko
Created April 11, 2010 05:07
Show Gist options
  • Save zachelko/362512 to your computer and use it in GitHub Desktop.
Save zachelko/362512 to your computer and use it in GitHub Desktop.
STL begin() 1
std::vector<int> foo;
// Set the iterator once we've created the container
std::vector<int>::iterator iter = foo.begin();
// Add some stuff to it
foo.push_back(2);
foo.push_back(3);
// Use the iterator... oops!
while (iter != foo.end()) {
std::cerr << *iter << "\n";
++iter;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment