|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
-
-
-
-
-
-
-
-
-
-
-
-
- #ifndef RANGES_V3_ALGORITHM_FIND_HPP
- #define RANGES_V3_ALGORITHM_FIND_HPP
-
- #include <utility>
-
- #include <range/v3/range_fwd.hpp>
-
- #include <range/v3/functional/identity.hpp>
- #include <range/v3/functional/invoke.hpp>
- #include <range/v3/iterator/concepts.hpp>
- #include <range/v3/iterator/traits.hpp>
- #include <range/v3/range/access.hpp>
- #include <range/v3/range/concepts.hpp>
- #include <range/v3/range/dangling.hpp>
- #include <range/v3/range/traits.hpp>
- #include <range/v3/utility/static_const.hpp>
-
- namespace ranges
- {
-
-
- RANGES_BEGIN_NIEBLOID(find)
-
-
-
-
-
-
-
-
-
- template<typename I, typename S, typename V, typename P = identity>
- auto RANGES_FUN_NIEBLOID(find)(I first, S last, V const & val, P proj = P{})
- ->CPP_ret(I)(
- requires input_iterator<I> && sentinel_for<S, I> &&
- indirect_relation<equal_to, projected<I, P>, V const *>)
- {
- for(; first != last; ++first)
- if(invoke(proj, *first) == val)
- break;
- return first;
- }
-
-
- template<typename Rng, typename V, typename P = identity>
- auto RANGES_FUN_NIEBLOID(find)(Rng && rng, V const & val, P proj = P{})
- ->CPP_ret(safe_iterator_t<Rng>)(
- requires input_range<Rng> &&
- indirect_relation<equal_to, projected<iterator_t<Rng>, P>, V const *>)
- {
- return (*this)(begin(rng), end(rng), val, std::move(proj));
- }
-
- RANGES_END_NIEBLOID(find)
-
- namespace cpp20
- {
- using ranges::find;
- }
-
- }
-
- #endif
|