boostorg / boostorg/hana

Consider allowing custom key comparators in associative data structures

Open
#25 1 comment 0 reactions 0 assignees View on GitHub
feature help wanted
Dominant language
C++
Stars
1.9k
Forks
225
PR merge metrics
No merged PRs in 30d

Description

Right now, a `Set` uses `equal` on its elements to determine their uniqueness. It might be useful to provide a custom key comparator for more complex behaviours. In the same vein, `Map` currently uses `equal` on its keys to determine the uniqueness of elements; it might be useful to allow for a custom comparator.

However, compile-time sets are super hairy to implement, and honestly I am unsure how this could be achieved without ruining the compile-time performance of the associative data structures (which is already super poor because the implementation is naive). Also note that I do not think a compile-time efficient associative data structure can be implemented unless we put stringent requirements on how the elements are compared. Specifically, the only compile-time efficient associative data structure I can think of is where all the keys are types, or all the keys are indices (in which case it's a tuple).

Contributor guide

Open the contributing guide

Research direction

Start by locating the Set and Map implementations and their use of equal. Review how compile-time associative structures compare keys and evaluate the performance concerns described in the issue; the issue does not define a comparator API, implementation location, tests, or a concrete completion criterion.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
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.