forked from boostorg/move
Removed tabs.
This commit is contained in:
1 parent
cae8d2dda3
commit
122916d820
8 files changed
+34
-42
No files matched your search
@@ -28,16 +28,8 @@ using boost::timer::nanosecond_type;
|
||||
#include <boost/move/algo/adaptive_sort.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>
|
||||
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<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;
|
||||
}
|
||||
|
||||
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<order_type>(10001, 65, NIter);
|
||||
test_all_permutations<order_type>(10001, 101, NIter);
|
||||
test_all_permutations<order_type>(10001, 1023, NIter);
|
||||
test_all_permutations<order_type>(10001, 4095, NIter);
|
||||
test_all_permutations<order_type>(10001, 0, NIter);
|
||||
test_random_shuffled<order_type>(10001, 65, NIter);
|
||||
test_random_shuffled<order_type>(10001, 101, NIter);
|
||||
test_random_shuffled<order_type>(10001, 1023, NIter);
|
||||
test_random_shuffled<order_type>(10001, 4095, NIter);
|
||||
test_random_shuffled<order_type>(10001, 0, NIter);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user