mirror of
https://github.com/boostorg/move.git
synced 2025-08-02 05:44:25 +02:00
Removed tabs.
This commit is contained in:
@@ -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)
|
||||||
{
|
{
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user