Section: 16.4.4.6.1 [allocator.requirements.general] Status: New Submitter: Jiang An Opened: 2024-04-07 Last modified: 2024-05-01
Priority: 3
View other active issues in [allocator.requirements.general].
View all other issues in [allocator.requirements.general].
View all issues with New status.
Discussion:
Currently, 16.4.4.6.1 [allocator.requirements.general]/2.12 imposes a precondition for
pointer_traits::pointer_to
that r
denotes an object whose storage is allocated
by the allocator.
pointer_traits::pointer_to
works on any lvalue.
[2024-05-01; Reflector poll]
Set priority to 3 after reflector poll.
"This applies to small-object optimizations too."
"An alternative way to support P0773's "near pointers" would be to require that a sentinel-node container using a "near allocator" must itself be constructed in the near segment. (This is P0773 (B) (2).)"
Proposed resolution:
This wording is relative to N4971.
Modify 16.4.4.6.1 [allocator.requirements.general] as indicated:
-2- In subclause 16.4.4.6 [allocator.requirements],
[…]
(2.10) —
p
denotes a value of typeXX::pointer
obtained by callinga1.allocate
, wherea1 == a
,(2.11) — […],
(2.12) —
r
denotes an lvalue of typeT
&obtained by the expression,*p
[…]
[…]
pointer_traits<XX::pointer>::pointer_to(r)-33- Result:
-34- Postconditions:XX::pointer
Same asLetp
p1
denote the return value.*p1
refers to the same object asr
.