Section: 23.2.5 [container.node], 20.2.8.1 [allocator.uses.trait] Status: New Submitter: Jiang An Opened: 2024-09-21 Last modified: 2024-10-09
Priority: 3
View all issues with New status.
Discussion:
Currently, node handle types (23.2.5 [container.node]) have the member
allocator_type type alias, which makes std::uses_allocator report
true for them. However, they don't have allocator-extended constructors,
and it's unclear to me whether it's better to make them have such constructors.
#include <set>
#include <map>
int main() {
std::pmr::set<int> s{1};
std::pmr::map<int, decltype(s)::node_type> m;
m.emplace(1, s.extract(1));
}
Perhaps we should consistently treat node handles not uses-allocator-constructible.
[2024-10-09; Reflector poll]
Set priority to 3 after reflector poll.
"Strike the carve outs for program-defined specializations."
If it's broken for uses_allocator<NH, A> to be true
when NH is not a program-defined type, then we don't want to allow users
to make it true for a program-defined A, that would still be broken.
Previous resolution [SUPERSEDED]:
This wording is relative to N4988.
Modify 23.2.5.1 [container.node.overview] as indicated:
[…]
-4- If a user-defined specialization ofpairexists forpair<const Key, T>orpair<Key, T>, whereKeyis the container'skey_typeandTis the container'smapped_type, the behavior of operations involving node handles is undefined. -?- For each node handle typeNHand any typeA, ifuses_allocator<NH, A>is not a program-defined specialization, it meets the Cpp17BinaryTypeTrait requirements (21.3.2 [meta.rqmts]) and its base characteristic isfalse_type.
[2024-10-09; Adjust wording as requested in reflector poll]
Proposed resolution:
This wording is relative to N4988.
Modify 23.2.5.1 [container.node.overview] as indicated:
[…]
-4- If a user-defined specialization ofpairexists forpair<const Key, T>orpair<Key, T>, whereKeyis the container'skey_typeandTis the container'smapped_type, the behavior of operations involving node handles is undefined. -?- For each node handle typeNHand any typeA,uses_allocator<NH, A>meets the Cpp17BinaryTypeTrait requirements (21.3.2 [meta.rqmts]) and its base characteristic isfalse_type.