invocable.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef _LIBCPP___CONCEPTS_INVOCABLE_H
  9. #define _LIBCPP___CONCEPTS_INVOCABLE_H
  10. #include <__config>
  11. #include <__functional/invoke.h>
  12. #include <__utility/forward.h>
  13. #include <type_traits>
  14. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  15. # pragma GCC system_header
  16. #endif
  17. _LIBCPP_BEGIN_NAMESPACE_STD
  18. #if !defined(_LIBCPP_HAS_NO_CONCEPTS)
  19. // [concept.invocable]
  20. template<class _Fn, class... _Args>
  21. concept invocable = requires(_Fn&& __fn, _Args&&... __args) {
  22. _VSTD::invoke(_VSTD::forward<_Fn>(__fn), _VSTD::forward<_Args>(__args)...); // not required to be equality preserving
  23. };
  24. // [concept.regular.invocable]
  25. template<class _Fn, class... _Args>
  26. concept regular_invocable = invocable<_Fn, _Args...>;
  27. #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
  28. _LIBCPP_END_NAMESPACE_STD
  29. #endif // _LIBCPP___CONCEPTS_INVOCABLE_H