assignable.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_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 <__type_traits/is_reference.h>
  14. #include <__type_traits/make_const_lvalue_ref.h>
  15. #include <__utility/forward.h>
  16. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  17. # pragma GCC system_header
  18. #endif
  19. _LIBCPP_BEGIN_NAMESPACE_STD
  20. #if _LIBCPP_STD_VER > 17
  21. // [concept.assignable]
  22. template<class _Lhs, class _Rhs>
  23. concept assignable_from =
  24. is_lvalue_reference_v<_Lhs> &&
  25. common_reference_with<__make_const_lvalue_ref<_Lhs>, __make_const_lvalue_ref<_Rhs>> &&
  26. requires (_Lhs __lhs, _Rhs&& __rhs) {
  27. { __lhs = _VSTD::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
  28. };
  29. #endif // _LIBCPP_STD_VER > 17
  30. _LIBCPP_END_NAMESPACE_STD
  31. #endif // _LIBCPP___CONCEPTS_ASSIGNABLE_H