mirror of
https://github.com/boostorg/move.git
synced 2025-08-02 13:44:28 +02:00
Removed tabs.
This commit is contained in:
@@ -231,8 +231,8 @@ BOOST_MOVE_FORCEINLINE void adl_move_swap(T& x, T& y)
|
|||||||
//! using boost::adl_move_swap.
|
//! using boost::adl_move_swap.
|
||||||
//!
|
//!
|
||||||
//! Parameters:
|
//! Parameters:
|
||||||
//! first1, last1 - the first range of elements to swap
|
//! first1, last1 - the first range of elements to swap
|
||||||
//! first2 - beginning of the second range of elements to swap
|
//! first2 - beginning of the second range of elements to swap
|
||||||
//!
|
//!
|
||||||
//! Type requirements:
|
//! Type requirements:
|
||||||
//! - ForwardIt1, ForwardIt2 must meet the requirements of ForwardIterator.
|
//! - ForwardIt1, ForwardIt2 must meet the requirements of ForwardIterator.
|
||||||
|
@@ -56,7 +56,7 @@ void adaptive_merge( RandIt first, RandIt middle, RandIt last, Compare comp
|
|||||||
typedef typename iterator_traits<RandIt>::value_type value_type;
|
typedef typename iterator_traits<RandIt>::value_type value_type;
|
||||||
|
|
||||||
::boost::movelib::detail_adaptive::adaptive_xbuf<value_type> xbuf(uninitialized, uninitialized_len);
|
::boost::movelib::detail_adaptive::adaptive_xbuf<value_type> 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 {
|
} //namespace movelib {
|
||||||
|
@@ -167,7 +167,7 @@ void op_merge_left( RandIt buf_first
|
|||||||
op(forward_t(), first2, last2, buf_first);
|
op(forward_t(), first2, last2, buf_first);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(comp(*first2, *first1)){
|
else if(comp(*first2, *first1)){
|
||||||
op(first2, buf_first);
|
op(first2, buf_first);
|
||||||
++first2;
|
++first2;
|
||||||
}
|
}
|
||||||
@@ -214,7 +214,7 @@ void op_merge_right
|
|||||||
{
|
{
|
||||||
RandIt const first2 = last1;
|
RandIt const first2 = last1;
|
||||||
while(first1 != last1){
|
while(first1 != last1){
|
||||||
if(last2 == first2){
|
if(last2 == first2){
|
||||||
op(backward_t(), first1, last1, buf_last);
|
op(backward_t(), first1, last1, buf_last);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -230,7 +230,7 @@ void op_merge_right
|
|||||||
++last1;
|
++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
|
//(e.g. buffer is exactly the size of the first half
|
||||||
//and all elements from the second half are less)
|
//and all elements from the second half are less)
|
||||||
op(backward_t(), first2, last2, buf_last);
|
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());
|
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<class RandIt, class Compare>
|
template<class RandIt, class Compare>
|
||||||
void merge_bufferless(RandIt first, RandIt middle, RandIt last, Compare comp)
|
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{
|
do{
|
||||||
++first;
|
++first;
|
||||||
} while(first != middle && !comp(*middle, *first));
|
} while(first != middle && !comp(*middle, *first));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
while(middle != last){
|
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);
|
last = rotate_gcd(p, middle, last);
|
||||||
middle = p;
|
middle = p;
|
||||||
if(middle == first){
|
if(middle == first){
|
||||||
|
@@ -125,10 +125,10 @@ F uninitialized_move(I f, I l, F r
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
BOOST_CATCH(...){
|
BOOST_CATCH(...){
|
||||||
for (; back != r; ++back){
|
for (; back != r; ++back){
|
||||||
back->~input_value_type();
|
back->~input_value_type();
|
||||||
}
|
}
|
||||||
BOOST_RETHROW;
|
BOOST_RETHROW;
|
||||||
}
|
}
|
||||||
BOOST_CATCH_END
|
BOOST_CATCH_END
|
||||||
return r;
|
return r;
|
||||||
|
@@ -1023,7 +1023,7 @@ struct aligned_next<Len, Align, T, true>
|
|||||||
//End of search defaults to max_align_t
|
//End of search defaults to max_align_t
|
||||||
template<std::size_t Len, std::size_t Align>
|
template<std::size_t Len, std::size_t Align>
|
||||||
struct aligned_next<Len, Align, max_align_t, false>
|
struct aligned_next<Len, Align, max_align_t, false>
|
||||||
{ typedef aligned_union<max_align_t, Len> type; };
|
{ typedef aligned_union<max_align_t, Len> type; };
|
||||||
|
|
||||||
//Now define a search list through types
|
//Now define a search list through types
|
||||||
#define BOOST_MOVE_ALIGNED_NEXT_STEP(TYPE, NEXT_TYPE)\
|
#define BOOST_MOVE_ALIGNED_NEXT_STEP(TYPE, NEXT_TYPE)\
|
||||||
|
@@ -28,16 +28,8 @@ using boost::timer::nanosecond_type;
|
|||||||
#include <boost/move/algo/adaptive_sort.hpp>
|
#include <boost/move/algo/adaptive_sort.hpp>
|
||||||
#include <boost/move/core.hpp>
|
#include <boost/move/core.hpp>
|
||||||
|
|
||||||
|
|
||||||
template<class T, class Compare>
|
|
||||||
void adaptive_sort_buffered(T *elements, std::size_t element_count, Compare comp, std::size_t BufLen)
|
|
||||||
{
|
|
||||||
boost::movelib::unique_ptr<char[]> mem(new char[sizeof(T)*BufLen]);
|
|
||||||
boost::movelib::adaptive_sort(elements, elements + element_count, comp, reinterpret_cast<T*>(mem.get()), BufLen);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
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<T[]> elements(new T[element_count]);
|
boost::movelib::unique_ptr<T[]> elements(new T[element_count]);
|
||||||
boost::movelib::unique_ptr<std::size_t[]> key_reps(new std::size_t[num_keys ? num_keys : element_count]);
|
boost::movelib::unique_ptr<std::size_t[]> 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;
|
elements[i].key=key;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::srand(255);
|
std::srand(0);
|
||||||
|
|
||||||
for (std::size_t i = 0; i != num_iter; ++i)
|
for (std::size_t i = 0; i != num_iter; ++i)
|
||||||
{
|
{
|
||||||
@@ -81,11 +73,11 @@ int main()
|
|||||||
#else
|
#else
|
||||||
const std::size_t NIter = 10;
|
const std::size_t NIter = 10;
|
||||||
#endif
|
#endif
|
||||||
test_all_permutations<order_type>(10001, 65, NIter);
|
test_random_shuffled<order_type>(10001, 65, NIter);
|
||||||
test_all_permutations<order_type>(10001, 101, NIter);
|
test_random_shuffled<order_type>(10001, 101, NIter);
|
||||||
test_all_permutations<order_type>(10001, 1023, NIter);
|
test_random_shuffled<order_type>(10001, 1023, NIter);
|
||||||
test_all_permutations<order_type>(10001, 4095, NIter);
|
test_random_shuffled<order_type>(10001, 4095, NIter);
|
||||||
test_all_permutations<order_type>(10001, 0, NIter);
|
test_random_shuffled<order_type>(10001, 0, NIter);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -139,7 +139,7 @@ int main()
|
|||||||
movable m4(function(boost::move_if_noexcept(m3)));
|
movable m4(function(boost::move_if_noexcept(m3)));
|
||||||
BOOST_CHECK(m3.moved());
|
BOOST_CHECK(m3.moved());
|
||||||
BOOST_CHECK(!m4.moved());
|
BOOST_CHECK(!m4.moved());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
movable m;
|
movable m;
|
||||||
movable m2(boost::move_if_noexcept(m));
|
movable m2(boost::move_if_noexcept(m));
|
||||||
@@ -149,7 +149,7 @@ int main()
|
|||||||
movable m4(functionr(boost::move_if_noexcept(m3)));
|
movable m4(functionr(boost::move_if_noexcept(m3)));
|
||||||
BOOST_CHECK(m3.moved());
|
BOOST_CHECK(m3.moved());
|
||||||
BOOST_CHECK(!m4.moved());
|
BOOST_CHECK(!m4.moved());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
movable m;
|
movable m;
|
||||||
movable m2(boost::move_if_noexcept(m));
|
movable m2(boost::move_if_noexcept(m));
|
||||||
@@ -159,7 +159,7 @@ int main()
|
|||||||
movable m4(function2(boost::move_if_noexcept(m3)));
|
movable m4(function2(boost::move_if_noexcept(m3)));
|
||||||
BOOST_CHECK(m3.moved());
|
BOOST_CHECK(m3.moved());
|
||||||
BOOST_CHECK(!m4.moved());
|
BOOST_CHECK(!m4.moved());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
movable m;
|
movable m;
|
||||||
movable m2(boost::move_if_noexcept(m));
|
movable m2(boost::move_if_noexcept(m));
|
||||||
@@ -169,7 +169,7 @@ int main()
|
|||||||
movable m4(function2r(boost::move_if_noexcept(m3)));
|
movable m4(function2r(boost::move_if_noexcept(m3)));
|
||||||
BOOST_CHECK(m3.moved());
|
BOOST_CHECK(m3.moved());
|
||||||
BOOST_CHECK(!m4.moved());
|
BOOST_CHECK(!m4.moved());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
movable m;
|
movable m;
|
||||||
movable m2(boost::move_if_noexcept(m));
|
movable m2(boost::move_if_noexcept(m));
|
||||||
@@ -177,7 +177,7 @@ int main()
|
|||||||
BOOST_CHECK(!m2.moved());
|
BOOST_CHECK(!m2.moved());
|
||||||
movable m3(move_return_function());
|
movable m3(move_return_function());
|
||||||
BOOST_CHECK(!m3.moved());
|
BOOST_CHECK(!m3.moved());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
movable m;
|
movable m;
|
||||||
movable m2(boost::move_if_noexcept(m));
|
movable m2(boost::move_if_noexcept(m));
|
||||||
@@ -185,7 +185,7 @@ int main()
|
|||||||
BOOST_CHECK(!m2.moved());
|
BOOST_CHECK(!m2.moved());
|
||||||
movable m3(move_return_function2());
|
movable m3(move_return_function2());
|
||||||
BOOST_CHECK(!m3.moved());
|
BOOST_CHECK(!m3.moved());
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy_movable may throw during move, so it must be copied
|
// 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)));
|
copy_movable m4(function(boost::move_if_noexcept(m3)));
|
||||||
BOOST_CHECK(!m3.moved());
|
BOOST_CHECK(!m3.moved());
|
||||||
BOOST_CHECK(!m4.moved());
|
BOOST_CHECK(!m4.moved());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// copy_movable_noexcept can not throw during move
|
// copy_movable_noexcept can not throw during move
|
||||||
@@ -210,7 +210,7 @@ int main()
|
|||||||
copy_movable_noexcept m4(function(boost::move_if_noexcept(m3)));
|
copy_movable_noexcept m4(function(boost::move_if_noexcept(m3)));
|
||||||
BOOST_CHECK(m3.moved());
|
BOOST_CHECK(m3.moved());
|
||||||
BOOST_CHECK(!m4.moved());
|
BOOST_CHECK(!m4.moved());
|
||||||
}
|
}
|
||||||
|
|
||||||
// movable_throwable can not throw during move but it has no copy constructor
|
// 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)));
|
movable_throwable m4(function(boost::move_if_noexcept(m3)));
|
||||||
BOOST_CHECK(m3.moved());
|
BOOST_CHECK(m3.moved());
|
||||||
BOOST_CHECK(!m4.moved());
|
BOOST_CHECK(!m4.moved());
|
||||||
}
|
}
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
@@ -63,11 +63,11 @@ int volatile_memcmp(const volatile void *p1, const volatile void *p2, std::size_
|
|||||||
unsigned char u1, u2;
|
unsigned char u1, u2;
|
||||||
|
|
||||||
for ( ; len-- ; s1++, s2++) {
|
for ( ; len-- ; s1++, s2++) {
|
||||||
u1 = *s1;
|
u1 = *s1;
|
||||||
u2 = *s2;
|
u2 = *s2;
|
||||||
if (u1 != u2) {
|
if (u1 != u2) {
|
||||||
return (u1-u2);
|
return (u1-u2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user