mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:37:34 +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
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