11558Srgrimes// -*- C++ -*- 21558Srgrimes//===----------------------------------------------------------------------===// 31558Srgrimes// 41558Srgrimes// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 51558Srgrimes// See https://llvm.org/LICENSE.txt for license information. 61558Srgrimes// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 71558Srgrimes// 81558Srgrimes//===----------------------------------------------------------------------===// 91558Srgrimes 101558Srgrimes#ifndef _LIBCPP___ALGORITHM_FIND_FIRST_OF_H 111558Srgrimes#define _LIBCPP___ALGORITHM_FIND_FIRST_OF_H 121558Srgrimes 131558Srgrimes#include <__algorithm/comp.h> 141558Srgrimes#include <__config> 151558Srgrimes#include <__iterator/iterator_traits.h> 161558Srgrimes 171558Srgrimes#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 181558Srgrimes# pragma GCC system_header 191558Srgrimes#endif 201558Srgrimes 211558Srgrimes_LIBCPP_BEGIN_NAMESPACE_STD 221558Srgrimes 231558Srgrimestemplate <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> 241558Srgrimes_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator1 __find_first_of_ce( 251558Srgrimes _ForwardIterator1 __first1, 261558Srgrimes _ForwardIterator1 __last1, 271558Srgrimes _ForwardIterator2 __first2, 2823678Speter _ForwardIterator2 __last2, 2950476Speter _BinaryPredicate&& __pred) { 301558Srgrimes for (; __first1 != __last1; ++__first1) 31270895Strasz for (_ForwardIterator2 __j = __first2; __j != __last2; ++__j) 321558Srgrimes if (__pred(*__first1, *__j)) 3379530Sru return __first1; 341558Srgrimes return __last1; 351558Srgrimes} 36102231Strhodes 371558Srgrimestemplate <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> 3868960Sru_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_first_of( 39160303Sdes _ForwardIterator1 __first1, 40125200Sguido _ForwardIterator1 __last1, 41125197Sguido _ForwardIterator2 __first2, 42162395Sru _ForwardIterator2 __last2, 4368960Sru _BinaryPredicate __pred) { 4417243Sjkh return std::__find_first_of_ce(__first1, __last1, __first2, __last2, __pred); 451558Srgrimes} 4668960Sru 4717243Sjkhtemplate <class _ForwardIterator1, class _ForwardIterator2> 481558Srgrimes_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_first_of( 49162395Sru _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { 501558Srgrimes return std::__find_first_of_ce(__first1, __last1, __first2, __last2, __equal_to()); 511558Srgrimes} 521558Srgrimes 5328644Ssteve_LIBCPP_END_NAMESPACE_STD 5499501Scharnier 55155992Srodrigc#endif // _LIBCPP___ALGORITHM_FIND_FIRST_OF_H 561558Srgrimes