Skip to content

Commit 6e44fdf

Browse files
committed
Use iter_swap instead of swap
1 parent fb1207f commit 6e44fdf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

chapters/algorithms/bubble_sort/code/c++/bubblesort.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void bubble_sort(Iter first, Iter last) {
1616
for (auto it2 = first; it2 + 1 != last; ++it2) {
1717
// these are unsorted! gotta swap 'em
1818
if (*(it2 + 1) < *it2) {
19-
std::swap(*it2, *(it2 + 1));
19+
std::iter_swap(it2, (it2 + 1));
2020
}
2121
}
2222
}

0 commit comments

Comments
 (0)