8.7 KiB
[alg.find.last]
26 Algorithms library [algorithms]
26.6 Non-modifying sequence operations [alg.nonmodifying]
26.6.7 Find last [alg.find.last]
`template<forward_iterator I, sentinel_for S, class Proj = identity, class T = projected_value_t<I, Proj>> requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> constexpr subrange ranges::find_last(I first, S last, const T& value, Proj proj = {}); template<forward_range R, class Proj = identity, class T = projected_value_t<iterator_t, Proj>> requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t, Proj>, const T*> constexpr borrowed_subrange_t ranges::find_last(R&& r, const T& value, Proj proj = {});
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for S, class Proj = identity, class T = projected_value_t<I, Proj>> requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> subrange ranges::find_last(Ep&& exec, I first, S last, const T& value, Proj proj = {}); template<execution-policy Ep, sized-random-access-range R, class Proj = identity, class T = projected_value_t<iterator_t, Proj>> requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t, Proj>, const T*> borrowed_subrange_t ranges::find_last(Ep&& exec, R&& r, const T& value, Proj proj = {});
template<forward_iterator I, sentinel_for S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> constexpr subrange ranges::find_last_if(I first, S last, Pred pred, Proj proj = {}); template<forward_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t, Proj>> Pred> constexpr borrowed_subrange_t ranges::find_last_if(R&& r, Pred pred, Proj proj = {});
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> subrange ranges::find_last_if(Ep&& exec, I first, S last, Pred pred, Proj proj = {}); template<execution-policy Ep, sized-random-access-range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t, Proj>> Pred> borrowed_subrange_t ranges::find_last_if(Ep&& exec, R&& r, Pred pred, Proj proj = {});
template<forward_iterator I, sentinel_for S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> constexpr subrange ranges::find_last_if_not(I first, S last, Pred pred, Proj proj = {}); template<forward_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t, Proj>> Pred> constexpr borrowed_subrange_t ranges::find_last_if_not(R&& r, Pred pred, Proj proj = {});
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> subrange ranges::find_last_if_not(Ep&& exec, I first, S last, Pred pred, Proj proj = {}); template<execution-policy Ep, sized-random-access-range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t, Proj>> Pred> borrowed_subrange_t ranges::find_last_if_not(Ep&& exec, R&& r, Pred pred, Proj proj = {}); `
Let E be:
bool(invoke(proj, *i) == value) for ranges::find_last;
bool(invoke(pred, invoke(proj, *i))) for ranges::find_last_if;
bool(!invoke(pred, invoke(proj, *i))) for ranges::find_last_if_not.
Returns: Let i be the last iterator in the range [first, last) for which E is true.
Returns {i, last}, or{last, last} if no such iterator is found.
Complexity: At most last - first applications of the corresponding predicate and projection.