Add Transparent Comparator Support
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start by locating the variables_map declaration and the std::map base it inherits from. Review the C++14 transparent-comparator requirements and the existing find usage shown in the issue, then inspect the module's tests for variables_map lookups. Done means lookups accept compatible string-like keys without unnecessary temporary std::string objects and existing behavior remains intact.
Written by the indexing model from the issue text.
Description
It would be great of boost::program_options::variables_map could have transparent comparator support (c++14 feature), to potentially avoid unnecessary object creation when accessing values in the map. Theoretically only a std::less<> needs to be added as the third template parameter of the std::map variables_map inherits from. Currently:
// 1
boost::program_options::variable_map vm;
vm.find("test"); // implicit std::string object created and destoryed
// 2
std::string_view sv("test");
vm.find(sv); // does not compile
// 3
vm.find(std::string(sv)); // only way to inspect with a std::string_view, explicit std::string object created and destroyed
With a transparent comparator 1 will not create a std::string object and just compare directly against the c-string literal. 2 will work as shown without any extra objects being created. 3 will be unnecessary
- Dominant language
- C++
- Stars
- 136
- Forks
- 117
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/program_options
-
Provide C++20 module Open
Difficulty 5/5 Over a week Newbie friendliness 45/100
boostorg/program_options#160 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
boostorg/program_options#159 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
boostorg/program_options#147 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
boostorg/program_options#146 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
boostorg/program_options#144 ·
All issues in boostorg/program_options
Similar issues
-
ai_reviewed
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ydb-platform/ydb#53869 · 3 comments ·
-
bug cert blocker needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
project-chip/connectedhomeip#74373 ·
-
upstream update
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
conan-io/conan-center-index#31035 ·
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 85/100
vllm-project/vllm-ascend#17329 ·