xref: /freebsd/contrib/llvm-project/libcxx/include/__concepts/assignable.h (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
1349cc55cSDimitry Andric //===----------------------------------------------------------------------===//
2349cc55cSDimitry Andric //
3349cc55cSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4349cc55cSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5349cc55cSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6349cc55cSDimitry Andric //
7349cc55cSDimitry Andric //===----------------------------------------------------------------------===//
8349cc55cSDimitry Andric 
9349cc55cSDimitry Andric #ifndef _LIBCPP___CONCEPTS_ASSIGNABLE_H
10349cc55cSDimitry Andric #define _LIBCPP___CONCEPTS_ASSIGNABLE_H
11349cc55cSDimitry Andric 
12349cc55cSDimitry Andric #include <__concepts/common_reference_with.h>
13349cc55cSDimitry Andric #include <__concepts/same_as.h>
14349cc55cSDimitry Andric #include <__config>
15bdd1243dSDimitry Andric #include <__type_traits/is_reference.h>
16bdd1243dSDimitry Andric #include <__type_traits/make_const_lvalue_ref.h>
17349cc55cSDimitry Andric #include <__utility/forward.h>
18349cc55cSDimitry Andric 
19349cc55cSDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20349cc55cSDimitry Andric #  pragma GCC system_header
21349cc55cSDimitry Andric #endif
22349cc55cSDimitry Andric 
23349cc55cSDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD
24349cc55cSDimitry Andric 
2506c3fb27SDimitry Andric #if _LIBCPP_STD_VER >= 20
26349cc55cSDimitry Andric 
27349cc55cSDimitry Andric // [concept.assignable]
28349cc55cSDimitry Andric 
29349cc55cSDimitry Andric template <class _Lhs, class _Rhs>
30349cc55cSDimitry Andric concept assignable_from =
31349cc55cSDimitry Andric     is_lvalue_reference_v<_Lhs> &&
32349cc55cSDimitry Andric     common_reference_with<__make_const_lvalue_ref<_Lhs>, __make_const_lvalue_ref<_Rhs>> &&
33349cc55cSDimitry Andric     requires(_Lhs __lhs, _Rhs&& __rhs) {
34*5f757f3fSDimitry Andric       { __lhs = std::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
35349cc55cSDimitry Andric     };
36349cc55cSDimitry Andric 
3706c3fb27SDimitry Andric #endif // _LIBCPP_STD_VER >= 20
38349cc55cSDimitry Andric 
39349cc55cSDimitry Andric _LIBCPP_END_NAMESPACE_STD
40349cc55cSDimitry Andric 
41349cc55cSDimitry Andric #endif // _LIBCPP___CONCEPTS_ASSIGNABLE_H
42