KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I need to access each element in a vector and also know what index the element is in. So far I could come up with two ways for (iterator it= aVector.begin(), int index= 0; it!= aVector.end(); ++it, ++index) leaving the type signature. also it looks like i can't use auto for (int index = 0; index < aVector.size(); ++index) { // access using [] } Which one is more efficient or is there a better way to do this?
Tags (comma-separated)
Save Edits
Cancel