Issue 3116: OUTERMOST_ALLOC_TRAITS needs remove_reference_t (original) (raw)
This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
3116. _OUTERMOSTALLOCTRAITS_ needs remove_reference_t
Section: 20.6.4 [allocator.adaptor.members] Status: C++20 Submitter: Tim Song Opened: 2018-06-04 Last modified: 2021-02-25
Priority: 0
View all other issues in [allocator.adaptor.members].
View all issues with C++20 status.
Discussion:
_OUTERMOSTALLOCTRAITS_(x) is currently defined in 20.6.4 [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.
[2018-06 Rapperswil Thursday issues processing]
Status to Ready
[2018-11, Adopted in San Diego]
Proposed resolution:
This wording is relative to N4750.
[Drafting note: The subclause only uses
_OUTERMOSTALLOCTRAITS_(*this)and only in non-constmember functions, so the result is also non-const. Thus,remove_reference_tis sufficient; there's no need to further remove cv-qualification. — _end drafting note_]
- Modify 20.6.4 [allocator.adaptor.members]p1 as indicated:
-1- In the
constructmember functions,_OUTERMOST_(x)isxifxdoes not have anouter_allocator()member function and_OUTERMOST_(x.outer_allocator())if the expressionx.outer_allocator()is valid (13.10.3 [temp.deduct]) andxotherwise;_OUTERMOSTALLOCTRAITS_(x)isallocator_traits<remove_reference_t<decltype(_OUTERMOST_(x))>>. [Note: […] — _end note_]