Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

83 Zeilen
1.9KB

  1. /// \file
  2. // Range v3 library
  3. //
  4. // Copyright Eric Niebler 2013-present
  5. //
  6. // Use, modification and distribution is subject to the
  7. // Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. //
  11. // Project home: https://github.com/ericniebler/range-v3
  12. //
  13. #ifndef RANGES_V3_FUNCTIONAL_CONCEPTS_HPP
  14. #define RANGES_V3_FUNCTIONAL_CONCEPTS_HPP
  15. #include <concepts/concepts.hpp>
  16. #include <range/v3/functional/invoke.hpp>
  17. namespace ranges
  18. {
  19. /// \addtogroup group-functional
  20. /// @{
  21. // clang-format off
  22. CPP_def
  23. (
  24. template(typename Fun, typename... Args)
  25. (concept invocable)(Fun, Args...),
  26. requires (Fun&& fn)
  27. (
  28. invoke(static_cast<Fun &&>(fn), std::declval<Args>()...)
  29. )
  30. );
  31. CPP_def
  32. (
  33. template(typename Fun, typename... Args)
  34. (concept regular_invocable)(Fun, Args...),
  35. invocable<Fun, Args...>
  36. // Axiom: equality_preserving(invoke(f, args...))
  37. );
  38. CPP_def
  39. (
  40. template(typename Fun, typename... Args)
  41. (concept predicate)(Fun, Args...),
  42. regular_invocable<Fun, Args...> &&
  43. convertible_to<invoke_result_t<Fun, Args...>, bool>
  44. );
  45. CPP_def
  46. (
  47. template(typename R, typename T, typename U)
  48. concept relation,
  49. predicate<R, T, T> &&
  50. predicate<R, U, U> &&
  51. predicate<R, T, U> &&
  52. predicate<R, U, T>
  53. );
  54. CPP_def
  55. (
  56. template(typename R, typename T, typename U)
  57. concept strict_weak_order,
  58. relation<R, T, U>
  59. );
  60. // clang-format on
  61. namespace cpp20
  62. {
  63. using ranges::invocable;
  64. using ranges::predicate;
  65. using ranges::regular_invocable;
  66. using ranges::relation;
  67. using ranges::strict_weak_order;
  68. } // namespace cpp20
  69. /// @}
  70. } // namespace ranges
  71. #endif