How do I access the next element in range based for loop before the next loop?
I know with an iterative approach you do something like arr[++i]
, but how do I achieve the same result in a range-based for loop?
for (auto& cmd : arr) {
steps = nextElement; //How do I get this nextElement before the next loop?
}
I understand I probably shouldn't be using a range-based for loop, but that's the requirement provided for this project.