google / google/leveldb

Why do we have to pass a pointer to a `std::string` to `Get()` ?

Open
#1,115 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
39.4k
Forks
8.2k
PR merge metrics
No merged PRs in 30d

Description

This requires us to first default construct a `std::string`, and then pass its address to the `Get()` function. But what if i'm only interested in if the key is in the database? In this case, isn't the construction of the std::string is entirely useless? The copying of the lookup result will also be a significant overhead. What am I missing here? Thanks in advance.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the Get() API and its documented lookup behavior. Determine whether existence-only checks are already supported; if not, the work would need a clearly defined API proposal and acceptance criteria for avoiding unnecessary value construction and copying.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.