std::experimental::ranges::find_first_of (3) - Linux Manuals
std::experimental::ranges::find_first_of: std::experimental::ranges::find_first_of
Command to display std::experimental::ranges::find_first_of
manual in Linux: $ man 3 std::experimental::ranges::find_first_of
NAME
std::experimental::ranges::find_first_of - std::experimental::ranges::find_first_of
Synopsis
Defined in header <experimental/ranges/algorithm>
template< InputIterator I1, Sentinel<I1> S1, ForwardIterator I2, Sentinel<I2> S2,
class Proj1 = ranges::identity, class Proj2 = ranges::identity,
IndirectRelation<projected<I1, Proj1>, (1) (ranges TS)
projected<I2, Proj2>> Pred = ranges::equal_to<> >
I1 find_first_of(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = Pred{},
Proj1 proj1 = Proj1{}, Proj2 proj2 = Proj2{});
template< InputRange R1, ForwardRange R2,
class Proj1 = ranges::identity, class Proj2 = ranges::identity,
IndirectRelation<projected<ranges::iterator_t<R1>, Proj1>, (2) (ranges TS)
projected<ranges::iterator_t<R2>, Proj2>> Pred = ranges::equal_to<> >
ranges::safe_iterator_t<R1> find_first_of(R1&& r1, R2&& r2, Pred pred = Pred{},
Proj1 proj1 = Proj1{}, Proj2 proj2 = Proj2{});
1) Searches the range [first1, last1) for any of the elements in the range [first2, last2), after projecting the ranges with proj1 and proj2 respectively. The projected elements are compared using pred.
2) Same as (1), but uses r1 as the first source range and r2 as the second source range, as if using ranges::begin(r1) as first1, ranges::end(r1) as last1, ranges::begin(r2) as first2, and ranges::end(r2) as last2.
Parameters
first1, last1 - the range of elements to examine
r1 - the range of elements to examine
first2, last2 - the range of elements to search for
r2 - the range of elements to search for
pred - predicate to use to compare the projected elements with
proj1 - projection to apply to the elements in the first range
proj2 - projection to apply to the elements in the second range
Return value
Iterator to the first element in the range [first1, last1) that is equal to an element from the range [first2, last2) after projection. If no such element is found, an iterator comparing equal to last1 is returned.
Complexity
At most (S*N) applications of the predicate and each projection, where S = distance(last2 - first2) and N = last1 - first1.
Possible implementation
template< InputIterator I1, Sentinel<I1> S1, ForwardIterator I2, Sentinel<I2> S2,
class Proj1 = ranges::identity, class Proj2 = ranges::identity,
IndirectRelation<projected<I1, Proj1>,
projected<I2, Proj2>> Pred = ranges::equal_to<> >
I1 find_first_of(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = Pred{},
Proj1 proj1 = Proj1{}, Proj2 proj2 = Proj2{})
{
for (; first1 != last1; ++first1) {
for (ForwardIt it = first2; it != last2; ++it) {
if (ranges::invoke(pred, ranges::invoke(proj1, *first1),
ranges::invoke(proj2, *it))) {
return first1;
}
}
}
return first1;
}
Example
This section is incomplete
Reason: no example
See also
searches for any one of a set of elements
find_first_of (function template)
find finds the first element satisfying specific criteria
find_if (function template)
find_if_not
Pages related to std::experimental::ranges::find_first_of
- std::experimental::ranges::find_end (3) - std::experimental::ranges::find_end
- std::experimental::ranges::find,std::experimental::ranges::find_if, (3) - std::experimental::ranges::find,std::experimental::ranges::find_if,
- std::experimental::ranges::find,std::experimental::ranges::find_if,std::experimental::ranges::find_if_not (3) - std::experimental::ranges::find,std::experimental::ranges::find_if,std::experimental::ranges::find_if_not
- std::experimental::ranges::for_each (3) - std::experimental::ranges::for_each
- std::experimental::ranges::Assignable (3) - std::experimental::ranges::Assignable
- std::experimental::ranges::BidirectionalIterator (3) - std::experimental::ranges::BidirectionalIterator
- std::experimental::ranges::BidirectionalRange (3) - std::experimental::ranges::BidirectionalRange
- std::experimental::ranges::Boolean (3) - std::experimental::ranges::Boolean
- std::experimental::ranges::BoundedRange (3) - std::experimental::ranges::BoundedRange
- std::experimental::ranges::Common (3) - std::experimental::ranges::Common
- std::experimental::ranges::CommonReference (3) - std::experimental::ranges::CommonReference
- std::experimental::ranges::Constructible (3) - std::experimental::ranges::Constructible
- std::experimental::ranges::ConvertibleTo (3) - std::experimental::ranges::ConvertibleTo
- std::experimental::ranges::CopyConstructible (3) - std::experimental::ranges::CopyConstructible
- std::experimental::ranges::Copyable (3) - std::experimental::ranges::Copyable
- std::experimental::ranges::DefaultConstructible (3) - std::experimental::ranges::DefaultConstructible
- std::experimental::ranges::DerivedFrom (3) - std::experimental::ranges::DerivedFrom
- std::experimental::ranges::Destructible (3) - std::experimental::ranges::Destructible
- std::experimental::ranges::EqualityComparable, (3) - std::experimental::ranges::EqualityComparable,
- std::experimental::ranges::EqualityComparable,std::experimental::ranges::EqualityComparableWith (3) - std::experimental::ranges::EqualityComparable,std::experimental::ranges::EqualityComparableWith
- std::experimental::ranges::ForwardIterator (3) - std::experimental::ranges::ForwardIterator
- std::experimental::ranges::ForwardRange (3) - std::experimental::ranges::ForwardRange
- std::experimental::ranges::Incrementable (3) - std::experimental::ranges::Incrementable
- std::experimental::ranges::IndirectRelation (3) - std::experimental::ranges::IndirectRelation
- std::experimental::ranges::IndirectStrictWeakOrder (3) - std::experimental::ranges::IndirectStrictWeakOrder
- std::experimental::ranges::IndirectUnaryInvocable, (3) - std::experimental::ranges::IndirectUnaryInvocable,
- std::experimental::ranges::IndirectUnaryInvocable,std::experimental::ranges::IndirectRegularUnaryInvocable (3) - std::experimental::ranges::IndirectUnaryInvocable,std::experimental::ranges::IndirectRegularUnaryInvocable
- std::experimental::ranges::IndirectUnaryPredicate (3) - std::experimental::ranges::IndirectUnaryPredicate
- std::experimental::ranges::IndirectlyComparable (3) - std::experimental::ranges::IndirectlyComparable
- std::experimental::ranges::IndirectlyCopyable (3) - std::experimental::ranges::IndirectlyCopyable
- std::experimental::ranges::IndirectlyCopyableStorable (3) - std::experimental::ranges::IndirectlyCopyableStorable