Skip to content

Instantly share code, notes, and snippets.

@BogdanAriton
Created June 15, 2021 15:10
Show Gist options
  • Select an option

  • Save BogdanAriton/5c78d3cff7be38819c111ebbd71457db to your computer and use it in GitHub Desktop.

Select an option

Save BogdanAriton/5c78d3cff7be38819c111ebbd71457db to your computer and use it in GitHub Desktop.
// what this does is just simply return a pointer to the first element in the vector
std::vector<type>::iterator myItr = myVector.begin();
// we can simply for loop over the items using the iterator
for (; myItr != myVector.end(); ++myItr)
{
// print them out
}
// You could simply use a for each loop to get the items directly
for (auto &item : myVector)
{
// print them out
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment