Title
Size type mismatch in constraints involving Cpp17Allocator
Status
new
Section
[allocator.requirements.general]
Submitter
Jiang An

Created on 2025-05-05.00:00:00 last changed 1 month ago

Messages

Date: 2025-10-15.00:00:00

[ 2025-10-14; Reflector poll ]

Set priority to 4 after reflector poll.

"The wording technically allows you to write allocate(same_as<size_type> auto) and reject any other type."

"I imagine lots of code relies on `std::size_t` being accepted. That's surely a general design issue that's much broader than just the Cpp17Allocator requirement, and making the requirement stricter seems evolutionary."

Date: 2025-05-05.00:00:00

It seems assumed that a `size_t` value can be passed to an allocator's `allocate` member function per the simple-allocator exposition-only concept in [allocator.requirements.general] and the minimal constraints for allocator types in [container.reqmts].

However, it is not exactly required that a type meeting the Cpp17Allocator requirements can be used with `size_t` values, because only allocator_traits<A>::size_type, which is possibly not `size_t`, is required to be usable with the allocator.

Do we want to change these constraints, or change the Cpp17Allocator requirements to require accepting `size_t` values?

History
Date User Action Args
2025-10-14 17:45:42adminsetmessages: + msg15159
2025-05-05 00:00:00admincreate