Currently I'm trying to convert some of C++'s named requirements to C++20 concepts (https://godbolt.org/z/EdY5d6319 still highly WIP!). However, I stumpled upon a problem.
Given the final C++20 working draft (http://open-std.org/jtc1/sc22/wg21/docs/papers/2020/n4861.pdf):
- page 790: requirements for an allocator-aware container:
Given an allocator-aware container X with value_type T the expressiona == twhereadenotes a non-const lvalue of type X andtan lvalue or const rvalue of type X is required.
Preconditions: T is Cpp17CopyInsertable into X and Cpp17CopyAssignable.
-> Therefore,X::value_typemust be CopyAssignable. - page 699:
is_copy_assignable:
"For a referenceable type T, the same result asis_assignable_v<T&, const T&>, otherwisefalse." - page 849:
std::map:
"A map meets all of the requirements of a container, of a reversible container (22.2), of an associative container (22.2.6), and of an allocator-aware container (Table 76)."
So std::map<Key, T> meets the requirements of an allocator-aware container. Therefore, std::map<Key, T>::value_type must be CopyAssignable.
However, std::map<Key, T>::value_type is defined as std::pair<const Key, T>, which is not CopyAssignable due to Key beeing const.
Therefore, std::map does not meet the allocator-aware container requirements, which contradicts page 849 in the standard draft.
What do I miss here?