C++ rookie here. I wrote a function that returns an iterator from a vector, and I want to use this iterator to iterate through the vector from beginning to end. However, the vector iterator is used like this
for (auto iterator = vec.begin(); iterator != vec.end(); iterator ++) {
// do something here
}
which means I also need a vec.end() for this to work. Is there anyway I can only use vec.begin() to iterate through a vector, as I commonly did in python
for value in some_iterator:
# do something
edit: some irrelevant update:
I see some comments about my python iterator vs iterable. The iterator can indeed be used this way (at least in Python 3). For example:
some_list = [1,2,3,4]
some_iterator = iter(some_list)
for value in some_iterator:
print(value)