algorithm 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  5. // See https://llvm.org/LICENSE.txt for license information.
  6. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifndef _LIBCPP_EXPERIMENTAL_ALGORITHM
  10. #define _LIBCPP_EXPERIMENTAL_ALGORITHM
  11. /*
  12. experimental/algorithm synopsis
  13. #include <algorithm>
  14. namespace std {
  15. namespace experimental {
  16. inline namespace fundamentals_v1 {
  17. template <class ForwardIterator, class Searcher>
  18. ForwardIterator search(ForwardIterator first, ForwardIterator last,
  19. const Searcher &searcher);
  20. // sample removed because it's now part of C++17
  21. } // namespace fundamentals_v1
  22. } // namespace experimental
  23. } // namespace std
  24. */
  25. #include <__debug>
  26. #include <algorithm>
  27. #include <experimental/__config>
  28. #include <type_traits>
  29. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  30. # pragma GCC system_header
  31. #endif
  32. _LIBCPP_BEGIN_NAMESPACE_LFTS
  33. template <class _ForwardIterator, class _Searcher>
  34. _LIBCPP_INLINE_VISIBILITY
  35. _ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s)
  36. { return __s(__f, __l).first; }
  37. _LIBCPP_END_NAMESPACE_LFTS
  38. #endif /* _LIBCPP_EXPERIMENTAL_ALGORITHM */