We learned about three different ways to iterate or loop over a vector in reverse direction. We iterated over all elements of a vector in reverse direction. reverse iterators, for_each() and Lambda function Iterate over a vector in backward direction using Inside the lambda function we can perform any operation like printing the elements or any other operation. ![]() If we pass the reverse iterators returned by rbegin() and rend() to for_each(), then it will iterate over the elements of vector in reverse direction and apply a lambda function on each item of the vector.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |