xref: /llvm-project/libcxx/include/__concepts/assignable.h (revision 77a00c0d546cd4aa8311b5b9031ae9ea8cdb050c)
158915667SArthur O'Dwyer //===----------------------------------------------------------------------===//
258915667SArthur O'Dwyer //
358915667SArthur O'Dwyer // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
458915667SArthur O'Dwyer // See https://llvm.org/LICENSE.txt for license information.
558915667SArthur O'Dwyer // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
658915667SArthur O'Dwyer //
758915667SArthur O'Dwyer //===----------------------------------------------------------------------===//
858915667SArthur O'Dwyer 
958915667SArthur O'Dwyer #ifndef _LIBCPP___CONCEPTS_ASSIGNABLE_H
1058915667SArthur O'Dwyer #define _LIBCPP___CONCEPTS_ASSIGNABLE_H
1158915667SArthur O'Dwyer 
1258915667SArthur O'Dwyer #include <__concepts/common_reference_with.h>
1358915667SArthur O'Dwyer #include <__concepts/same_as.h>
1458915667SArthur O'Dwyer #include <__config>
1566ba7c32SNikolas Klauser #include <__type_traits/is_reference.h>
167ae66e5eSNikolas Klauser #include <__type_traits/make_const_lvalue_ref.h>
1758915667SArthur O'Dwyer #include <__utility/forward.h>
1858915667SArthur O'Dwyer 
1958915667SArthur O'Dwyer #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2058915667SArthur O'Dwyer #  pragma GCC system_header
2158915667SArthur O'Dwyer #endif
2258915667SArthur O'Dwyer 
2358915667SArthur O'Dwyer _LIBCPP_BEGIN_NAMESPACE_STD
2458915667SArthur O'Dwyer 
254f15267dSNikolas Klauser #if _LIBCPP_STD_VER >= 20
2658915667SArthur O'Dwyer 
2758915667SArthur O'Dwyer // [concept.assignable]
2858915667SArthur O'Dwyer 
2958915667SArthur O'Dwyer template <class _Lhs, class _Rhs>
3058915667SArthur O'Dwyer concept assignable_from =
3158915667SArthur O'Dwyer     is_lvalue_reference_v<_Lhs> &&
3258915667SArthur O'Dwyer     common_reference_with<__make_const_lvalue_ref<_Lhs>, __make_const_lvalue_ref<_Rhs>> &&
requires(_Lhs __lhs,_Rhs && __rhs)3358915667SArthur O'Dwyer     requires(_Lhs __lhs, _Rhs&& __rhs) {
34*77a00c0dSLouis Dionne       { __lhs = std::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
3558915667SArthur O'Dwyer     };
3658915667SArthur O'Dwyer 
374f15267dSNikolas Klauser #endif // _LIBCPP_STD_VER >= 20
3858915667SArthur O'Dwyer 
3958915667SArthur O'Dwyer _LIBCPP_END_NAMESPACE_STD
4058915667SArthur O'Dwyer 
4158915667SArthur O'Dwyer #endif // _LIBCPP___CONCEPTS_ASSIGNABLE_H
42