MCPcopy Create free account
hub / github.com/FastLED/FastLED / KeyCompareWithId

Class KeyCompareWithId

src/fl/stl/multi_set.h:53–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51
52 // Comparator that compares only keys
53 struct KeyCompareWithId {
54 Compare mComp;
55
56 KeyCompareWithId(const Compare& comp = Compare()) : mComp(comp) {}
57
58 bool operator()(const ValueWithId& a, const ValueWithId& b) const {
59 // Compare keys; if keys are equal, compare IDs to maintain stable order
60 if (mComp(a.value, b.value)) {
61 return true;
62 }
63 if (mComp(b.value, a.value)) {
64 return false;
65 }
66 // Keys are equal - use ID for ordering
67 return a.unique_id < b.unique_id;
68 }
69 };
70
71 using TreeType = RedBlackTree<ValueWithId, KeyCompareWithId, Allocator>;
72 TreeType mTree;

Callers 1

MultiSetTreeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected