diff --git a/include/boost/move/adl_move_swap.hpp b/include/boost/move/adl_move_swap.hpp index 9303201..d6906a4 100644 --- a/include/boost/move/adl_move_swap.hpp +++ b/include/boost/move/adl_move_swap.hpp @@ -231,8 +231,8 @@ BOOST_MOVE_FORCEINLINE void adl_move_swap(T& x, T& y) //! using boost::adl_move_swap. //! //! Parameters: -//! first1, last1 - the first range of elements to swap -//! first2 - beginning of the second range of elements to swap +//! first1, last1 - the first range of elements to swap +//! first2 - beginning of the second range of elements to swap //! //! Type requirements: //! - ForwardIt1, ForwardIt2 must meet the requirements of ForwardIterator. diff --git a/include/boost/move/algo/adaptive_merge.hpp b/include/boost/move/algo/adaptive_merge.hpp index ef20651..0233b23 100644 --- a/include/boost/move/algo/adaptive_merge.hpp +++ b/include/boost/move/algo/adaptive_merge.hpp @@ -56,7 +56,7 @@ void adaptive_merge( RandIt first, RandIt middle, RandIt last, Compare comp typedef typename iterator_traits::value_type value_type; ::boost::movelib::detail_adaptive::adaptive_xbuf xbuf(uninitialized, uninitialized_len); - ::boost::movelib::detail_adaptive::adaptive_merge_impl(first, size_type(middle - first), size_type(last - middle), comp, xbuf); + ::boost::movelib::detail_adaptive::adaptive_merge_impl(first, size_type(middle - first), size_type(last - middle), comp, xbuf); } } //namespace movelib { diff --git a/include/boost/move/algo/detail/merge.hpp b/include/boost/move/algo/detail/merge.hpp index a0a5afa..59a04df 100644 --- a/include/boost/move/algo/detail/merge.hpp +++ b/include/boost/move/algo/detail/merge.hpp @@ -167,7 +167,7 @@ void op_merge_left( RandIt buf_first op(forward_t(), first2, last2, buf_first); return; } - else if(comp(*first2, *first1)){ + else if(comp(*first2, *first1)){ op(first2, buf_first); ++first2; } @@ -214,7 +214,7 @@ void op_merge_right { RandIt const first2 = last1; while(first1 != last1){ - if(last2 == first2){ + if(last2 == first2){ op(backward_t(), first1, last1, buf_last); return; } @@ -230,7 +230,7 @@ void op_merge_right ++last1; } } - if(last2 != buf_last){ //In case all remaining elements are in the same place + if(last2 != buf_last){ //In case all remaining elements are in the same place //(e.g. buffer is exactly the size of the first half //and all elements from the second half are less) op(backward_t(), first2, last2, buf_last); @@ -257,7 +257,7 @@ void swap_merge_right op_merge_right(first1, last1, last2, buf_last, comp, swap_op()); } -// cost: min(L1,L2)^2+max(L1,L2) +//Complexity: min(len1,len2)^2 + max(len1,len2) template void merge_bufferless(RandIt first, RandIt middle, RandIt last, Compare comp) { @@ -271,12 +271,12 @@ void merge_bufferless(RandIt first, RandIt middle, RandIt last, Compare comp) } do{ ++first; - } while(first != middle && !comp(*middle, *first)); + } while(first != middle && !comp(*middle, *first)); } } else{ while(middle != last){ - RandIt p = upper_bound(first, middle, last[-1], comp); + RandIt p = upper_bound(first, middle, last[-1], comp); last = rotate_gcd(p, middle, last); middle = p; if(middle == first){ diff --git a/include/boost/move/algo/move.hpp b/include/boost/move/algo/move.hpp index 943f286..d35f04a 100644 --- a/include/boost/move/algo/move.hpp +++ b/include/boost/move/algo/move.hpp @@ -125,10 +125,10 @@ F uninitialized_move(I f, I l, F r } } BOOST_CATCH(...){ - for (; back != r; ++back){ + for (; back != r; ++back){ back->~input_value_type(); } - BOOST_RETHROW; + BOOST_RETHROW; } BOOST_CATCH_END return r; diff --git a/include/boost/move/detail/type_traits.hpp b/include/boost/move/detail/type_traits.hpp index 816fdca..e9c804d 100644 --- a/include/boost/move/detail/type_traits.hpp +++ b/include/boost/move/detail/type_traits.hpp @@ -1005,7 +1005,7 @@ BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x1000) template union aligned_union -{ +{ T aligner; char dummy[Len]; }; @@ -1023,7 +1023,7 @@ struct aligned_next //End of search defaults to max_align_t template struct aligned_next -{ typedef aligned_union type; }; +{ typedef aligned_union type; }; //Now define a search list through types #define BOOST_MOVE_ALIGNED_NEXT_STEP(TYPE, NEXT_TYPE)\ diff --git a/test/adaptive_sort_test.cpp b/test/adaptive_sort_test.cpp index 4f44eeb..4c24a32 100644 --- a/test/adaptive_sort_test.cpp +++ b/test/adaptive_sort_test.cpp @@ -28,16 +28,8 @@ using boost::timer::nanosecond_type; #include #include - -template -void adaptive_sort_buffered(T *elements, std::size_t element_count, Compare comp, std::size_t BufLen) -{ - boost::movelib::unique_ptr mem(new char[sizeof(T)*BufLen]); - boost::movelib::adaptive_sort(elements, elements + element_count, comp, reinterpret_cast(mem.get()), BufLen); -} - template -bool test_all_permutations(std::size_t const element_count, std::size_t const num_keys, std::size_t const num_iter) +bool test_random_shuffled(std::size_t const element_count, std::size_t const num_keys, std::size_t const num_iter) { boost::movelib::unique_ptr elements(new T[element_count]); boost::movelib::unique_ptr key_reps(new std::size_t[num_keys ? num_keys : element_count]); @@ -49,7 +41,7 @@ bool test_all_permutations(std::size_t const element_count, std::size_t const nu elements[i].key=key; } - std::srand(255); + std::srand(0); for (std::size_t i = 0; i != num_iter; ++i) { @@ -81,11 +73,11 @@ int main() #else const std::size_t NIter = 10; #endif - test_all_permutations(10001, 65, NIter); - test_all_permutations(10001, 101, NIter); - test_all_permutations(10001, 1023, NIter); - test_all_permutations(10001, 4095, NIter); - test_all_permutations(10001, 0, NIter); + test_random_shuffled(10001, 65, NIter); + test_random_shuffled(10001, 101, NIter); + test_random_shuffled(10001, 1023, NIter); + test_random_shuffled(10001, 4095, NIter); + test_random_shuffled(10001, 0, NIter); return 0; } diff --git a/test/move_if_noexcept.cpp b/test/move_if_noexcept.cpp index 2c5afd3..a03a821 100644 --- a/test/move_if_noexcept.cpp +++ b/test/move_if_noexcept.cpp @@ -139,7 +139,7 @@ int main() movable m4(function(boost::move_if_noexcept(m3))); BOOST_CHECK(m3.moved()); BOOST_CHECK(!m4.moved()); - } + } { movable m; movable m2(boost::move_if_noexcept(m)); @@ -149,7 +149,7 @@ int main() movable m4(functionr(boost::move_if_noexcept(m3))); BOOST_CHECK(m3.moved()); BOOST_CHECK(!m4.moved()); - } + } { movable m; movable m2(boost::move_if_noexcept(m)); @@ -159,7 +159,7 @@ int main() movable m4(function2(boost::move_if_noexcept(m3))); BOOST_CHECK(m3.moved()); BOOST_CHECK(!m4.moved()); - } + } { movable m; movable m2(boost::move_if_noexcept(m)); @@ -169,7 +169,7 @@ int main() movable m4(function2r(boost::move_if_noexcept(m3))); BOOST_CHECK(m3.moved()); BOOST_CHECK(!m4.moved()); - } + } { movable m; movable m2(boost::move_if_noexcept(m)); @@ -177,7 +177,7 @@ int main() BOOST_CHECK(!m2.moved()); movable m3(move_return_function()); BOOST_CHECK(!m3.moved()); - } + } { movable m; movable m2(boost::move_if_noexcept(m)); @@ -185,7 +185,7 @@ int main() BOOST_CHECK(!m2.moved()); movable m3(move_return_function2()); BOOST_CHECK(!m3.moved()); - } + } // copy_movable may throw during move, so it must be copied { @@ -197,7 +197,7 @@ int main() copy_movable m4(function(boost::move_if_noexcept(m3))); BOOST_CHECK(!m3.moved()); BOOST_CHECK(!m4.moved()); - } + } // copy_movable_noexcept can not throw during move @@ -210,7 +210,7 @@ int main() copy_movable_noexcept m4(function(boost::move_if_noexcept(m3))); BOOST_CHECK(m3.moved()); BOOST_CHECK(!m4.moved()); - } + } // movable_throwable can not throw during move but it has no copy constructor { @@ -222,7 +222,7 @@ int main() movable_throwable m4(function(boost::move_if_noexcept(m3))); BOOST_CHECK(m3.moved()); BOOST_CHECK(!m4.moved()); - } + } return boost::report_errors(); } diff --git a/test/unique_ptr_functions.cpp b/test/unique_ptr_functions.cpp index 26f6b5b..d3b4d6d 100644 --- a/test/unique_ptr_functions.cpp +++ b/test/unique_ptr_functions.cpp @@ -63,11 +63,11 @@ int volatile_memcmp(const volatile void *p1, const volatile void *p2, std::size_ unsigned char u1, u2; for ( ; len-- ; s1++, s2++) { - u1 = *s1; - u2 = *s2; - if (u1 != u2) { - return (u1-u2); - } + u1 = *s1; + u2 = *s2; + if (u1 != u2) { + return (u1-u2); + } } return 0; }