Skip to content

Instantly share code, notes, and snippets.

@BogdanAriton
Created June 15, 2021 15:31
Show Gist options
  • Save BogdanAriton/4155a33d674b5264b60e1630edb1b9f7 to your computer and use it in GitHub Desktop.
Save BogdanAriton/4155a33d674b5264b60e1630edb1b9f7 to your computer and use it in GitHub Desktop.
int main()
{
LinkedList<unsigned long long> longList = {12, 3123, 4324532, 4324231313, 54654645, 654768768, 4333423545, 12123423};
for (const auto &item : longList) // each item returned will call the dereferencing operator on the iterator thus getting back the data from the node
{
std::cout << item << '\n';
}
// we can get an iterator that can be incremented
auto iterator = longList.begin();
std::cout << "This is the second element: " << *(++iterator) << '\n';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment