facebook / facebook/folly

sorted_vector_map::insert_or_assign() returns the wrong type

Open
#2,059 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
30.5k
Forks
5.9k
PR merge metrics
No merged PRs in 30d

Description

A recent commit bea73e236ce14e36bca7cc28e644ff928856adb3 added the `insert_or_assign()` method to `folly::sorted_vector_map` in `folly/sorted_vector_types.h`.

But it is returning an `iterator` instead of `std::pair` as [`std::map` would](https://en.cppreference.com/w/cpp/container/map/insert_or_assign).

Only the overload with a `hint` is supposed to return a plain `iterator`, but that overload wasn't added to `sorted_vector_map` anyway.

Contributor guide

Open the contributing guide

Research direction

Start in folly/sorted_vector_types.h at sorted_vector_map::insert_or_assign(). Compare its return type with the std::map insert_or_assign behavior described in the issue, including the distinction for the hint overload. Done means the existing overload returns the expected pair type and the API matches std::map semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.