Created on 2025-12-24.00:00:00 last changed 4 days ago
Proposed resolution:
This wording is relative to N5032.
Modify [concept.assignable] as indicated:
template<class LHS, class RHS>
concept assignable_from =
is_lvalue_reference_v<LHS> &&
common_reference_with<const remove_reference_t<LHS>&, const remove_reference_t<RHS>&> &&
requires(LHS lhs, RHS&& rhs) {
{ lhs = std::forward<RHS>(rhs) } -> same_as<LHS>;
};
Currently, std::assignable_from<std::unique_ptr<int>&, std::nullptr_t> is `false`, because the common reference type of unique_ptr<int>& and `nullptr_t` is unique_ptr<int>, and a const unique_ptr<int> lvalue can't be converted to the common reference type.
Such design seems counter-intuitive and valueless. When `common_reference_with` is modeled, one can use the common reference type in some non-generic, homogeneous interfaces. However, it should be clear enough that the type isn't expected to be used in assignment. The earliest form of the design can be found in ericniebler/stl2#150, where cases involving move-only types didn't seem analyzed. In any case, if we want `ranges::advance` to perform assignment only when `I` and `S` are common enough, we should just limit the `common_reference_with` requirements to `ranges::advance`.| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2026-01-17 14:38:46 | admin | set | messages: + msg15879 |
| 2025-12-24 00:00:00 | admin | create | |