which STL Algorithm should i use if I want to find something but Don’t want it to return last if not found?
My use case is I need to find or return null in the vector of user-defined types.
Find and Find_If seem to return the last item if not found. I need to do “someting else” if the element is not found.
Thanks
The
.end()if a vector does not point to the “last item”, but the empty space after the last item. If you need to do something else, just put it in a condition.