Skip to content

Commit

Permalink
[flat_map] Add std::from_range ctors; remove container ctors
Browse files Browse the repository at this point in the history
This implements https://wg21.link/D2767R2#wording-monolith
by removing the container constructors. The way to "move a vector
into the container" (performantly) is to default-construct and
then use `fm.replace(std::move(ks), std::move(vs))`. The way to
"initialize the set from a range of pairs" (conveniently) is to
use the C++20 `from_range` constructor
`flat_map(std::from_range, kvs | std::views::as_rvalue)`.

Also implement flat_map::insert_range.
  • Loading branch information
Quuxplusone committed Nov 6, 2023
1 parent ff61cb5 commit 1e5b162
Show file tree
Hide file tree
Showing 3 changed files with 212 additions and 438 deletions.
Loading

0 comments on commit 1e5b162

Please sign in to comment.