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.

4313. Uses-allocator construction of pair in tuple's allocator_arg_t constructors

Section: 22.4.4.2 [tuple.cnstr] Status: New Submitter: Jiang An Opened: 2025-08-07 Last modified: 2025-08-09

Priority: Not Prioritized

View other active issues in [tuple.cnstr].

View all other issues in [tuple.cnstr].

View all issues with New status.

Discussion:

P0591R4 updated the definition of uses-allocator construction to specially handle pair. Per 22.4.4.2 [tuple.cnstr]/33, it seems that the allocator_arg_t constructors should also be updated to handle pair. However, such a change doesn't seem intended in P0591R4, and it would significantly complicate tuple. Currently, implementations consistently don't update these constructors in C++20.

Perhaps we should explicitly say that the allocator_arg_t constructors don't specially handle pair.

Proposed resolution:

This wording is relative to this CD preview draft.

  1. 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, class U1, class U2>
      constexpr explicit(see below)
        tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&);
    template<class Alloc, class U1, class U2>
      constexpr explicit(see below)
        tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&);
    template<class Alloc, class U1, class U2>
      constexpr explicit(see below)
        tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&);
    template<class Alloc, class U1, class U2>
      constexpr explicit(see below)
        tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&&);
    template<class Alloc, tuple-like UTuple>
      constexpr explicit(see below)
      tuple(allocator_arg_t, const Alloc& a, UTuple&&);
    

    -32- Preconditions: Alloc meets the Cpp17Allocator requirements (16.4.4.6.1 [allocator.requirements.general]).

    -33- Effects: Equivalent to the preceding constructors except that each element is constructed with uses-allocator construction (20.2.8.2 [allocator.uses.construction]), except that the construction behaves as if there were only one uses_allocator_construction_args overload and the overload behaved the same as the first actual overload without Constraints.