This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
4267. Uses-allocator construction is meaningless for tuple of referencesSection: 22.4.4.2 [tuple.cnstr] Status: New Submitter: Jiang An Opened: 2025-05-24 Last modified: 2025-05-24
Priority: Not Prioritized
View other active issues in [tuple.cnstr].
View all other issues in [tuple.cnstr].
View all issues with New status.
Discussion:
Per 20.2.8.2 [allocator.uses.construction]/1, uses-allocator construction is only defined for objects. And presumably, an attempt to construct std::tuple
of reference from an allocator_arg_t
constructor causes a hard error.
allocator_arg_t
constructors are conditionally deleted according to 22.4.4.2 [tuple.cnstr]/33. However, it's confusing that these constructors are sometimes non-deleted when the tuple contains a reference, while there are hard errors in an instantiation instead.
Proposed resolution:
This wording is relative to N5008.
Modify 22.4.4.2 [tuple.cnstr] as indicated:
template<class Alloc> constexpr explicit(see below) tuple(allocator_arg_t, const Alloc& a); […] template<class Alloc, tuple-like UTuple> constexpr explicit(see below) tuple(allocator_arg_t, const Alloc& a, UTuple&&);-32- Preconditions:
-33- Effects: Equivalent to the preceding constructors except that each element is constructed with uses-allocator construction (20.2.8.2 [allocator.uses.construction]). -?- Remarks: These constructors are defined as deleted ifAlloc
meets the Cpp17Allocator requirements (16.4.4.6.1 [allocator.requirements.general]).is_reference_v<Ti>
istrue
for at least oneTi
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4