I have this requirement to find the last element in the vector which is smaller than a value.
Like find_first_of but instead of first i want last. I searched and found that there is no find_last_of but there is find_first_of.
Why is that so? Is the standard way is to use find_first_of with reverse iterators?
This is how it is done with reverse iterators:
Use reverse iterators, like this:
Live demo.
Just one thing. Be careful with the predicate if you're looking to find the tail-end of the range which includes the predicated element:
result:
From ZenXml: