mirror of
https://github.com/boostorg/move.git
synced 2025-08-02 05:44:25 +02:00
Fixes #26 ("Invalid iterator increment/decrement in the last iteration of adaptive_sort_combine_blocks")
This commit is contained in:
@@ -802,6 +802,13 @@ Special thanks to:
|
|||||||
|
|
||||||
[section:release_notes Release Notes]
|
[section:release_notes Release Notes]
|
||||||
|
|
||||||
|
[section:release_notes_boost_1_71 Boost 1.71 Release]
|
||||||
|
|
||||||
|
* Fixed bugs:
|
||||||
|
* [@https://github.com/boostorg/move/issues/26 Git Issue #26: ['"Invalid iterator increment/decrement in the last iteration of adaptive_sort_combine_blocks"]].
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
[section:release_notes_boost_1_70 Boost 1.70 Release]
|
[section:release_notes_boost_1_70 Boost 1.70 Release]
|
||||||
|
|
||||||
* Removed support for deprecated GCC compilers.
|
* Removed support for deprecated GCC compilers.
|
||||||
|
@@ -180,7 +180,7 @@ void adaptive_sort_combine_blocks
|
|||||||
size_type const max_i = n_reg_combined + (l_irreg_combined != 0);
|
size_type const max_i = n_reg_combined + (l_irreg_combined != 0);
|
||||||
|
|
||||||
if(merge_left || !use_buf) {
|
if(merge_left || !use_buf) {
|
||||||
for( size_type combined_i = 0; combined_i != max_i; ++combined_i, combined_first += l_reg_combined) {
|
for( size_type combined_i = 0; combined_i != max_i; ) {
|
||||||
//Now merge blocks
|
//Now merge blocks
|
||||||
bool const is_last = combined_i==n_reg_combined;
|
bool const is_last = combined_i==n_reg_combined;
|
||||||
size_type const l_cur_combined = is_last ? l_irreg_combined : l_reg_combined;
|
size_type const l_cur_combined = is_last ? l_irreg_combined : l_reg_combined;
|
||||||
@@ -202,11 +202,15 @@ void adaptive_sort_combine_blocks
|
|||||||
(keys, key_comp, combined_first, l_block, 0u, n_block_a, n_block_b, l_irreg2, comp, xbuf_used);
|
(keys, key_comp, combined_first, l_block, 0u, n_block_a, n_block_b, l_irreg2, comp, xbuf_used);
|
||||||
}
|
}
|
||||||
BOOST_MOVE_ADAPTIVE_SORT_PRINT_L2(" After merge_blocks_L: ", len + l_block);
|
BOOST_MOVE_ADAPTIVE_SORT_PRINT_L2(" After merge_blocks_L: ", len + l_block);
|
||||||
|
++combined_i;
|
||||||
|
if(combined_i != max_i)
|
||||||
|
combined_first += l_reg_combined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
combined_first += l_reg_combined*(max_i-1);
|
combined_first += l_reg_combined*(max_i-1);
|
||||||
for( size_type combined_i = max_i; combined_i--; combined_first -= l_reg_combined) {
|
for( size_type combined_i = max_i; combined_i; ) {
|
||||||
|
--combined_i;
|
||||||
bool const is_last = combined_i==n_reg_combined;
|
bool const is_last = combined_i==n_reg_combined;
|
||||||
size_type const l_cur_combined = is_last ? l_irreg_combined : l_reg_combined;
|
size_type const l_cur_combined = is_last ? l_irreg_combined : l_reg_combined;
|
||||||
|
|
||||||
@@ -222,6 +226,8 @@ void adaptive_sort_combine_blocks
|
|||||||
merge_blocks_right
|
merge_blocks_right
|
||||||
(keys, key_comp, combined_first, l_block, n_block_a, n_block_b, l_irreg2, comp, xbuf_used);
|
(keys, key_comp, combined_first, l_block, n_block_a, n_block_b, l_irreg2, comp, xbuf_used);
|
||||||
BOOST_MOVE_ADAPTIVE_SORT_PRINT_L2(" After merge_blocks_R: ", len + l_block);
|
BOOST_MOVE_ADAPTIVE_SORT_PRINT_L2(" After merge_blocks_R: ", len + l_block);
|
||||||
|
if(combined_i)
|
||||||
|
combined_first -= l_reg_combined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -174,7 +174,7 @@ ForwardOutputIt1 inplace_set_unique_difference
|
|||||||
++first2;
|
++first2;
|
||||||
}
|
}
|
||||||
else if (comp(*first1, *first2)){
|
else if (comp(*first1, *first2)){
|
||||||
//skip any adjacent equivalent elementin range 1
|
//skip any adjacent equivalent element in range 1
|
||||||
ForwardOutputIt1 result = first1;
|
ForwardOutputIt1 result = first1;
|
||||||
if (++first1 != last1 && !comp(*result, *first1)) {
|
if (++first1 != last1 && !comp(*result, *first1)) {
|
||||||
//Some elements from range 1 must be skipped, no longer an inplace operation
|
//Some elements from range 1 must be skipped, no longer an inplace operation
|
||||||
|
Reference in New Issue
Block a user