Title
OUTERMOST_ALLOC_TRAITS needs remove_reference_t
Status
c++20
Section
[allocator.adaptor.members]
Submitter
Tim Song

Created on 2018-06-04.00:00:00 last changed 38 months ago

Messages

Date: 2018-11-12.04:39:29

Proposed resolution:

This wording is relative to N4750.

[Drafting note: The subclause only uses OUTERMOST_ALLOC_TRAITS(*this) and only in non-const member functions, so the result is also non-const. Thus, remove_reference_t is sufficient; there's no need to further remove cv-qualification. — end drafting note]

  1. Modify [allocator.adaptor.members]p1 as indicated:

    -1- In the construct member functions, OUTERMOST(x) is x if x does not have an outer_allocator() member function and OUTERMOST(x.outer_allocator()) if the expression x.outer_allocator() is valid ([temp.deduct]) and x otherwise; OUTERMOST_ALLOC_TRAITS(x) is allocator_traits<remove_reference_t<decltype(OUTERMOST(x))>>. [Note: […] — end note]

Date: 2018-11-12.04:39:29

[ 2018-11, Adopted in San Diego ]

Date: 2018-06-12.04:35:59

[ 2018-06 Rapperswil Thursday issues processing ]

Status to Ready

Date: 2018-06-04.00:00:00

OUTERMOST_ALLOC_TRAITS(x) is currently defined in [allocator.adaptor.members]p1 as allocator_traits<decltype(OUTERMOST(x))>. However, OUTERMOST(x), as defined and used in this subclause, is an lvalue for which decltype produces an lvalue reference. That referenceness needs to be removed before the type can be used with allocator_traits.

While we are here, the current wording for OUTERMOST uses the imprecise "if x does not have an outer_allocator() member function". What we meant to check is the validity of the expression x.outer_allocator(), not whether x has some (possibly ambiguous and/or inaccessible) member function named outer_allocator.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2018-11-12 04:39:29adminsetmessages: + msg10194
2018-11-12 04:39:29adminsetstatus: voting -> wp
2018-10-08 05:13:59adminsetstatus: ready -> voting
2018-06-12 04:35:59adminsetmessages: + msg9913
2018-06-12 04:35:59adminsetstatus: new -> ready
2018-06-04 20:24:42adminsetmessages: + msg9864
2018-06-04 00:00:00admincreate