Hello. I'm new to C++ and I just learned how to use vectors and lists and indices and iterators, but i'm confused about iterators. Mainly, why should I use them instead of indices? They seem to add more complexity to accomplish the same thing as using indices... so could someone please clarify for me?
falcon60
0
Newbie Poster
Recommended Answers
Jump to PostWhen using list, you have to use iterators. When using vectors you
have a choice of using index or iterators, usually you should pick the index
version( which means use the operator [] ). The STL uses iterators
to generalize their functions. For example using std::sort(..), it takes in
a …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.