microsoft / microsoft/STL

`<flat_map>`, `<flat_set>`: Unify `_Emplace_hint()`

Open
#6,069 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement flat_meow
Dominant language
C++
Stars
11.1k
Forks
1.7k
Avg merge
4d 15h
Merged PRs (30d)
22

Description

<flat_map> and <flat_set> have very different implementations of _Emplace_hint(). They should be unified (not literally into the same function, but into very similar code patterns modulo the key/mapped difference).

There may be ways to further simplify them (I think there's too much special-casing of _IsUnique but I'm not certain).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the separate <flat_map> and <flat_set> implementations of _Emplace_hint(), focusing on their differing key/mapped handling and _IsUnique special cases. Determine whether their code patterns can be made similar without changing behavior; done means the implementations are unified as described and the relevant STL tests still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.