Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 3d4cb19f authored by Jack He's avatar Jack He
Browse files

Fix LeDevice, ClassicDevice, Device, AdapterConfig less than operators

If a class has two members A and B, and we want to order the class by A
first and then by B:
  obj1.A < obj2.A && obj1.B < obj2.B
is the wrong alrogithm. Instead, something like
  if (obj1.A != obj1.A) {
    return obj1.A < obj2.A;
  }
  return obj1.B < obj2.B;
should be used.

An incorrectly implemented less than operator will affect std::map's
functionality as std::map thinks that
  if (!(obj1 < obj2) && !(obj2 < obj1)) ==> obj1 == obj2

Bug: 242054540
Test: gd/cert/run
Tag: #refactor
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines

Merged-In: Ic9f55d5c776a935c49ca889c46e667bc7b961b4f
Change-Id: Ic9f55d5c776a935c49ca889c46e667bc7b961b4f
(cherry picked from commit b5044d0e493109cea7163a47a27f2bb28fe4df79)
parent a0e5e448
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment