//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 // template S, class Proj = identity, // indirect_unary_predicate> Pred> // constexpr subrange ranges::find_last_if(I first, S last, Pred pred, Proj proj = {}); // template, Proj>> Pred> // constexpr borrowed_subrange_t ranges::find_last_if(R&& r, Pred pred, Proj proj = {}); #include #include #include #include #include "almost_satisfies_types.h" #include "test_iterators.h" struct Predicate { bool operator()(int); }; template concept HasFindLastIfIt = requires(It it, Sent sent) { std::ranges::find_last_if(it, sent, Predicate{}); }; static_assert(HasFindLastIfIt); static_assert(HasFindLastIfIt>); static_assert(!HasFindLastIfIt>); static_assert(!HasFindLastIfIt); static_assert(!HasFindLastIfIt); static_assert(!HasFindLastIfIt, SentinelForNotSemiregular>); static_assert(!HasFindLastIfIt, InputRangeNotSentinelEqualityComparableWith>); static_assert(!HasFindLastIfIt); static_assert(!HasFindLastIfIt); template concept HasFindLastIfPred = requires(int* it, Pred pred) { std::ranges::find_last_if(it, it, pred); }; static_assert(!HasFindLastIfPred); static_assert(!HasFindLastIfPred); template concept HasFindLastIfR = requires(R r) { std::ranges::find_last_if(r, Predicate{}); }; static_assert(HasFindLastIfR>); static_assert(!HasFindLastIfR); static_assert(!HasFindLastIfR); static_assert(!HasFindLastIfR); static_assert(!HasFindLastIfR); static_assert(!HasFindLastIfR); template constexpr auto make_range(auto& a) { return std::ranges::subrange(It(std::ranges::begin(a)), Sent(It(std::ranges::end(a)))); } template