# 11 Algorithms library [algorithms]

## 11.3 Non-modifying sequence operations [alg.nonmodifying]

### 11.3.5 Find [alg.find]

``` template <InputIterator I, Sentinel<I> S, class T, class Proj = identity> requires IndirectRelation<equal_to<>, projected<I, Proj>, const T*> I find(I first, S last, const T& value, Proj proj = Proj{}); template <InputRange Rng, class T, class Proj = identity> requires IndirectRelation<equal_to<>, projected<iterator_t<Rng>, Proj>, const T*> safe_iterator_t<Rng> find(Rng&& rng, const T& value, Proj proj = Proj{}); template <InputIterator I, Sentinel<I> S, class Proj = identity, IndirectUnaryPredicate<projected<I, Proj>> Pred> I find_if(I first, S last, Pred pred, Proj proj = Proj{}); template <InputRange Rng, class Proj = identity, IndirectUnaryPredicate<projected<iterator_t<Rng>, Proj>> Pred> safe_iterator_t<Rng> find_if(Rng&& rng, Pred pred, Proj proj = Proj{}); template <InputIterator I, Sentinel<I> S, class Proj = identity, IndirectUnaryPredicate<projected<I, Proj>> Pred> I find_if_not(I first, S last, Pred pred, Proj proj = Proj{}); template <InputRange Rng, class Proj = identity, IndirectUnaryPredicate<projected<iterator_t<Rng>, Proj>> Pred> safe_iterator_t<Rng> find_if_not(Rng&& rng, Pred pred, Proj proj = Proj{}); ```

Returns: The first iterator i in the range [first,last) for which the following corresponding conditions hold: invoke(proj, *i) == value, invoke(pred, invoke(proj, *i)) != false, invoke(pred, invoke(proj, *i)) == false. Returns last if no such iterator is found.

Complexity: At most last - first applications of the corresponding predicate and projection.