Posted February 21Feb 21 Sometimes, we all need a way to iterate over a container in the opposite direction. There are several ways to reverse-iterate a container, and in this article, we’ll explore them. Reverse Iterations by Coral Kashri From the article: Probably the simplest way, taken from C is to iterate using an index location: for (int64_t index = ssize(container); index >= 0; --index) {     // do something with `container[index]` } This way is highly not recommended as it might lead to infinite loops if done incorrectly (for example by using uint64_t or size_t for the index type), and you can find more issues with this way in some previous articles about iterators in this blog. View the full article
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.