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.

4291. explicit map(const Allocator&) should be constexpr

Section: 23.4.3.1 [map.overview] Status: New Submitter: Jonathan Wakely Opened: 2025-07-10 Last modified: 2025-07-10

Priority: Not Prioritized

View other active issues in [map.overview].

View all other issues in [map.overview].

View all issues with New status.

Discussion:

The intent of P3372R3 was for all container constructors to be constexpr, but during application of the paper to the working draft it was observed that one map constructor was missed.

Proposed resolution:

This wording is relative to N5008.

  1. Modify 20.2.5 [ptr.align] as indicated:

    
    // 23.4.3.2, construct/copy/destroy
    constexpr map() : map(Compare()) { }
    constexpr explicit map(const Compare& comp, const Allocator& = Allocator());
    template<class InputIterator>
      constexpr map(InputIterator first, InputIterator last,
                    const Compare& comp = Compare(), const Allocator& = Allocator());
    template<container-compatible-range <value_type> R>
      constexpr map(from_range_t, R&& rg, const Compare& comp = Compare(),
                    const Allocator& = Allocator());
    constexpr map(const map& x);
    constexpr map(map&& x);
    constexpr explicit map(const Allocator&);
    constexpr map(const map&, const type_identity_t<Allocator>&);
    constexpr map(map&&, const type_identity_t<Allocator>&);
    constexpr map(initializer_list<value_type>, const Compare& = Compare(),
                  const Allocator& = Allocator());