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.

### 3803. `flat_foo` constructors taking `KeyContainer` lack `KeyCompare` parameter

Section: 24.6.9 [flat.map], 24.6.10 [flat.multimap], 24.6.11 [flat.set], 24.6.12 [flat.multiset] Status: New Submitter: Arthur O'Dwyer Opened: 2022-10-25 Last modified: 2022-11-04

Priority: 1

View other active issues in [flat.map].

View all other issues in [flat.map].

View all issues with New status.

Discussion:

`flat_set`'s current constructor overload set has these two overloads:

>     explicit flat_set(container_type cont);
>     template<class Allocator>
>       flat_set(const container_type& cont, const Allocator& a);

I believe it should have these two in addition:

>     flat_set(const key_compare& comp, container_type cont);
>     template<class Allocator>
>       flat_set(const key_compare& comp, const container_type& cont, const Allocator& a);

with corresponding deduction guides. Similar wording changes would have to be made to all the `flat_foo` containers.

Tony Table:

>     struct LessWhenDividedBy {
>       int divisor_;
>       bool operator()(int x, int y) const { return x/divisor_ < y/divisor_; }
>     };
>     std::flat_set<int, LessWhenDividedBy> s(data.begin(), data.end(), LessWhenDividedBy(10));
>     // BEFORE AND AFTER: okay, but cumbersome
>     std::flat_set<int, LessWhenDividedBy> s(data);
>     // BEFORE AND AFTER: oops, this default-constructs the comparator

>     std::flat_set<int, LessWhenDividedBy> s(LessWhenDividedBy(10), data);
>     // BEFORE: fails to compile
>     // AFTER: compiles successfully

[2022-11-04; Reflector poll]

Set priority to 1 after reflector poll.

Proposed resolution: