boolean_testable.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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_BOOLEAN_TESTABLE_H
  9. #define _LIBCPP___CONCEPTS_BOOLEAN_TESTABLE_H
  10. #include <__concepts/convertible_to.h>
  11. #include <__config>
  12. #include <__utility/forward.h>
  13. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  14. # pragma GCC system_header
  15. #endif
  16. _LIBCPP_BEGIN_NAMESPACE_STD
  17. #if _LIBCPP_STD_VER >= 20
  18. // [concepts.booleantestable]
  19. template <class _Tp>
  20. concept __boolean_testable_impl = convertible_to<_Tp, bool>;
  21. template <class _Tp>
  22. concept __boolean_testable = __boolean_testable_impl<_Tp> && requires(_Tp&& __t) {
  23. { !_VSTD::forward<_Tp>(__t) } -> __boolean_testable_impl;
  24. };
  25. #endif // _LIBCPP_STD_VER >= 20
  26. _LIBCPP_END_NAMESPACE_STD
  27. #endif // _LIBCPP___CONCEPTS_BOOLEAN_TESTABLE_H