mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-25 02:38:59 +00:00
AK: Ensure dual_pivot_quick_sort does not copy the pivots
Also add a test that would fail to compile if quick_sort tries to copy anything :P
This commit is contained in:
parent
5b104eedaf
commit
ec4980e875
Notes:
sideshowbarker
2024-07-19 00:56:32 +09:00
Author: https://github.com/alimpfard
Commit: ec4980e875
Pull-request: https://github.com/SerenityOS/serenity/pull/4375
Reviewed-by: https://github.com/ccapitalK ✅
2 changed files with 60 additions and 2 deletions
|
@ -51,8 +51,8 @@ void dual_pivot_quick_sort(Collection& col, int start, int end, LessThan less_th
|
|||
int k = start + 1;
|
||||
int g = end - 1;
|
||||
|
||||
auto left_pivot = col[start];
|
||||
auto right_pivot = col[end];
|
||||
auto&& left_pivot = col[start];
|
||||
auto&& right_pivot = col[end];
|
||||
|
||||
while (k <= g) {
|
||||
if (less_than(col[k], left_pivot)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue