assignable.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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_ASSIGNABLE_H
  9. #define _LIBCPP___CONCEPTS_ASSIGNABLE_H
  10. #include <__concepts/common_reference_with.h>
  11. #include <__concepts/same_as.h>
  12. #include <__config>
  13. #include <__utility/forward.h>
  14. #include <type_traits>
  15. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  16. # pragma GCC system_header
  17. #endif
  18. _LIBCPP_BEGIN_NAMESPACE_STD
  19. #if !defined(_LIBCPP_HAS_NO_CONCEPTS)
  20. // [concept.assignable]
  21. template<class _Lhs, class _Rhs>
  22. concept assignable_from =
  23. is_lvalue_reference_v<_Lhs> &&
  24. common_reference_with<__make_const_lvalue_ref<_Lhs>, __make_const_lvalue_ref<_Rhs>> &&
  25. requires (_Lhs __lhs, _Rhs&& __rhs) {
  26. { __lhs = _VSTD::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
  27. };
  28. #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
  29. _LIBCPP_END_NAMESPACE_STD
  30. #endif // _LIBCPP___CONCEPTS_ASSIGNABLE_H