mirror of
https://github.com/boostorg/sort.git
synced 2026-01-19 04:42:11 +00:00
adding ciso646
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -14,15 +14,15 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_BACKBONE_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_BACKBONE_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <atomic>
|
||||
#include <future>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <boost/sort/pdqsort/pdqsort.hpp>
|
||||
#include <boost/sort/common/util/atomic.hpp>
|
||||
#include <boost/sort/common/util/algorithm.hpp>
|
||||
#include <boost/sort/common/stack_cnc.hpp>
|
||||
#include <future>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/sort/block_indirect_sort/blk_detail/block.hpp>
|
||||
|
||||
namespace boost
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_BLOCK_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_BLOCK_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <boost/sort/common/range.hpp>
|
||||
|
||||
namespace boost
|
||||
|
||||
@@ -14,12 +14,14 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_MERGE_BLOCKS_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_MERGE_BLOCKS_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <atomic>
|
||||
#include <boost/sort/block_indirect_sort/blk_detail/backbone.hpp>
|
||||
#include <boost/sort/common/range.hpp>
|
||||
#include <future>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <boost/sort/block_indirect_sort/blk_detail/backbone.hpp>
|
||||
#include <boost/sort/common/range.hpp>
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -103,7 +105,7 @@ struct merge_blocks
|
||||
{
|
||||
this->merge_range_pos (rng_input);
|
||||
}
|
||||
catch (std::bad_alloc &ba)
|
||||
catch (std::bad_alloc )
|
||||
{
|
||||
error = true;
|
||||
};
|
||||
|
||||
@@ -15,10 +15,11 @@
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_MOVE_BLOCKS_HPP
|
||||
|
||||
#include <atomic>
|
||||
#include <boost/sort/block_indirect_sort/blk_detail/backbone.hpp>
|
||||
#include <ciso646>
|
||||
#include <future>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <boost/sort/block_indirect_sort/blk_detail/backbone.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_PARALLEL_SORT_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_PARALLEL_SORT_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <boost/sort/block_indirect_sort/blk_detail/backbone.hpp>
|
||||
#include <boost/sort/pdqsort/pdqsort.hpp>
|
||||
#include <boost/sort/common/pivot.hpp>
|
||||
@@ -159,7 +160,7 @@ parallel_sort<Block_size, Iter_t, Compare>
|
||||
//-------------------max_per_thread ---------------------------
|
||||
uint32_t nbits_size = (nbits64(sizeof(value_t))) >> 1;
|
||||
if (nbits_size > 5) nbits_size = 5;
|
||||
max_per_thread = 1 << (18 - nbits_size);
|
||||
max_per_thread = (size_t) 1 << (18 - nbits_size);
|
||||
|
||||
uint32_t level = ((nbits64(nelem / max_per_thread)) * 3) / 2;
|
||||
|
||||
|
||||
@@ -13,15 +13,19 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_BLOCK_INDIRECT_SORT_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_BLOCK_INDIRECT_SORT_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <atomic>
|
||||
#include <cstdlib>
|
||||
#include <future>
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/sort/block_indirect_sort/blk_detail/merge_blocks.hpp>
|
||||
#include <boost/sort/block_indirect_sort/blk_detail/move_blocks.hpp>
|
||||
#include <boost/sort/block_indirect_sort/blk_detail/parallel_sort.hpp>
|
||||
#include <boost/sort/pdqsort/pdqsort.hpp>
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
#include <boost/sort/common/util/algorithm.hpp>
|
||||
#include <future>
|
||||
#include <iterator>
|
||||
|
||||
|
||||
// This value is the minimal number of threads for to use the
|
||||
// block_indirect_sort algorithm
|
||||
@@ -141,7 +145,7 @@ struct block_indirect_sort
|
||||
destroy(rglobal_buf);
|
||||
construct = false;
|
||||
};
|
||||
std::return_temporary_buffer(ptr);
|
||||
std::free (ptr);
|
||||
ptr = nullptr;
|
||||
};
|
||||
}
|
||||
@@ -223,7 +227,7 @@ block_indirect_sort<Block_size, Group_size, Iter_t, Compare>
|
||||
|
||||
uint32_t nbits_size = (nbits64(sizeof(value_t)) >> 1);
|
||||
if (nbits_size > 5) nbits_size = 5;
|
||||
size_t max_per_thread = 1 << (18 - nbits_size);
|
||||
size_t max_per_thread = (size_t) 1 << (18 - nbits_size);
|
||||
|
||||
if (nelem < (max_per_thread) or nthread < 2)
|
||||
{
|
||||
@@ -233,8 +237,9 @@ block_indirect_sort<Block_size, Group_size, Iter_t, Compare>
|
||||
};
|
||||
|
||||
//----------- creation of the temporary buffer --------------------
|
||||
ptr = std::get_temporary_buffer<value_t>(Block_size * nthread).first;
|
||||
if (ptr == nullptr)
|
||||
ptr = reinterpret_cast <value_t*>
|
||||
(std::malloc (Block_size * nthread * sizeof(value_t)));
|
||||
if (ptr == nullptr)
|
||||
{
|
||||
bk.error = true;
|
||||
throw std::bad_alloc();
|
||||
@@ -271,7 +276,7 @@ block_indirect_sort<Block_size, Group_size, Iter_t, Compare>
|
||||
// thread local buffer
|
||||
for (uint32_t i = 0; i < nthread; ++i)
|
||||
{
|
||||
auto f1 = [=, &vbuf]( )
|
||||
auto f1 = [=, &vbuf, this]( )
|
||||
{ bk.exec (vbuf[i], this->counter);};
|
||||
vfuture[i] = std::async(std::launch::async, f1);
|
||||
};
|
||||
@@ -322,7 +327,7 @@ void block_indirect_sort<Block_size, Group_size, Iter_t, Compare>
|
||||
//-------------------------------------------------------------------------
|
||||
if (level_thread != 0)
|
||||
{
|
||||
auto f1 = [=, &son_counter]( )
|
||||
auto f1 = [=, &son_counter, this]( )
|
||||
{
|
||||
split_range (pos_index_mid, pos_index2, level_thread - 1);
|
||||
bscu::atomic_sub (son_counter, 1);
|
||||
@@ -334,7 +339,7 @@ void block_indirect_sort<Block_size, Group_size, Iter_t, Compare>
|
||||
else
|
||||
{
|
||||
Iter_t mid = first + ((nblock >> 1) * Block_size);
|
||||
auto f1 = [=, &son_counter]( )
|
||||
auto f1 = [=, &son_counter, this]( )
|
||||
{
|
||||
parallel_sort_t (bk, mid, last);
|
||||
bscu::atomic_sub (son_counter, 1);
|
||||
@@ -364,7 +369,7 @@ void block_indirect_sort<Block_size, Group_size, Iter_t, Compare>
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t level_thread = nbits64(nthread - 1) - 1;
|
||||
uint32_t level_thread = nbits64 (nthread - 1) - 1;
|
||||
split_range(0, bk.nblock, level_thread - 1);
|
||||
if (bk.error) return;
|
||||
move_blocks_t k(bk);
|
||||
@@ -443,7 +448,7 @@ void block_indirect_sort(Iter_t first, Iter_t last)
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : block_indirect_sort
|
||||
/// @brief invocation of block_indirtect_sort with 3 parameters. The third is
|
||||
/// @brief invocation of block_indirtect_sort with 3 parameters. The third is
|
||||
/// the number of threads
|
||||
///
|
||||
/// @param first : iterator to the first element of the range to sort
|
||||
@@ -460,7 +465,7 @@ void block_indirect_sort(Iter_t first, Iter_t last, uint32_t nthread)
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : block_indirect_sort
|
||||
/// @brief invocation of block_indirtect_sort with 3 parameters. The third is
|
||||
/// @brief invocation of block_indirtect_sort with 3 parameters. The third is
|
||||
/// the comparison object
|
||||
///
|
||||
/// @param first : iterator to the first element of the range to sort
|
||||
@@ -479,7 +484,7 @@ void block_indirect_sort(Iter_t first, Iter_t last, Compare comp)
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : block_indirect_sort
|
||||
/// @brief invocation of block_indirtect_sort with 4 parameters.
|
||||
/// @brief invocation of block_indirtect_sort with 4 parameters.
|
||||
///
|
||||
/// @param first : iterator to the first element of the range to sort
|
||||
/// @param last : iterator after the last element to the range to sort
|
||||
|
||||
@@ -14,13 +14,16 @@
|
||||
#ifndef __TOOLS_DEQUE_CNC_HPP
|
||||
#define __TOOLS_DEQUE_CNC_HPP
|
||||
|
||||
#include <sort/tools/spinlock.hpp>
|
||||
#include <ciso646>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <boost/sort/common/spinlock.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace sort
|
||||
{
|
||||
namespace tools
|
||||
namespace common
|
||||
{
|
||||
|
||||
//###########################################################################
|
||||
@@ -61,7 +64,7 @@ protected:
|
||||
// VARIABLES
|
||||
//------------------------------------------------------------------------
|
||||
deque_t dq;
|
||||
mutable spinlock spl;
|
||||
mutable spinlock_t spl;
|
||||
|
||||
public:
|
||||
//
|
||||
@@ -94,7 +97,7 @@ public:
|
||||
//----------------------------------------------------------------------
|
||||
void clear(void)
|
||||
{
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
dq.clear();
|
||||
};
|
||||
//
|
||||
@@ -107,7 +110,7 @@ public:
|
||||
void swap(deque_cnc & A) noexcept
|
||||
{
|
||||
if (this == &A) return;
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
dq.swap(A.dq);
|
||||
};
|
||||
//
|
||||
@@ -123,7 +126,7 @@ public:
|
||||
//------------------------------------------------------------------------
|
||||
size_type size(void) const noexcept
|
||||
{
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
return dq.size();
|
||||
};
|
||||
//
|
||||
@@ -134,7 +137,7 @@ public:
|
||||
//------------------------------------------------------------------------
|
||||
size_type max_size(void) const noexcept
|
||||
{
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
return (dq.max_size());
|
||||
};
|
||||
//
|
||||
@@ -150,7 +153,7 @@ public:
|
||||
//------------------------------------------------------------------------
|
||||
void shrink_to_fit()
|
||||
{
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
dq.shrink_to_fit();
|
||||
};
|
||||
//
|
||||
@@ -161,7 +164,7 @@ public:
|
||||
//------------------------------------------------------------------------
|
||||
bool empty(void) const noexcept
|
||||
{
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
return (dq.empty());
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -172,7 +175,7 @@ public:
|
||||
//---------------------------------------------------------------------------
|
||||
void push_back(const value_type & D)
|
||||
{
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
dq.push_back(D);
|
||||
};
|
||||
|
||||
@@ -184,7 +187,7 @@ public:
|
||||
template<class ... Args>
|
||||
void emplace_back(Args && ... args)
|
||||
{
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
dq.emplace_back(std::forward <Args>(args) ...);
|
||||
};
|
||||
//------------------------------------------------------------------------
|
||||
@@ -197,7 +200,7 @@ public:
|
||||
template<class Allocator2>
|
||||
deque_cnc & push_back(const std::deque<value_type, Allocator2> & D)
|
||||
{
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
for (size_type i = 0; i < D.size(); ++i)
|
||||
dq.push_back(D[i]);
|
||||
return *this;
|
||||
@@ -211,7 +214,7 @@ public:
|
||||
//------------------------------------------------------------------------
|
||||
deque_cnc & push_back(std::deque<value_type, Allocator> && D)
|
||||
{
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
for (size_type i = 0; i < D.size(); ++i)
|
||||
dq.emplace_back(std::move(D[i]));
|
||||
return *this;
|
||||
@@ -223,7 +226,7 @@ public:
|
||||
//-----------------------------------------------------------------------
|
||||
void pop_back(void)
|
||||
{
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
dq.pop_back();
|
||||
};
|
||||
//
|
||||
@@ -237,7 +240,7 @@ public:
|
||||
//------------------------------------------------------------------------
|
||||
bool pop_copy_back(value_type & P)
|
||||
{ //-------------------------- begin -----------------------------
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
if (dq.size() == 0) return false;
|
||||
P = dq.back();
|
||||
dq.pop_back();
|
||||
@@ -254,7 +257,7 @@ public:
|
||||
//------------------------------------------------------------------------
|
||||
bool pop_move_back(value_type & P)
|
||||
{ //-------------------------- begin -----------------------------
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
if (dq.size() == 0) return false;
|
||||
P = std::move(dq.back());
|
||||
dq.pop_back();
|
||||
@@ -268,7 +271,7 @@ public:
|
||||
//------------------------------------------------------------------------
|
||||
void push_front(const value_type & D)
|
||||
{
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
dq.push_front(D);
|
||||
};
|
||||
|
||||
@@ -280,7 +283,7 @@ public:
|
||||
template<class ... Args>
|
||||
void emplace_front(Args && ... args)
|
||||
{
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
dq.emplace_front(std::forward <Args>(args) ...);
|
||||
};
|
||||
//------------------------------------------------------------------------
|
||||
@@ -293,7 +296,7 @@ public:
|
||||
template<class Allocator2>
|
||||
deque_cnc & push_front(const std::deque<value_type, Allocator2> & V1)
|
||||
{
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
for (size_type i = 0; i < V1.size(); ++i)
|
||||
dq.push_front(V1[i]);
|
||||
return *this;
|
||||
@@ -307,7 +310,7 @@ public:
|
||||
//-----------------------------------------------------------------------
|
||||
deque_cnc & push_front(std::deque<value_type, Allocator> && V1)
|
||||
{
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
for (size_type i = 0; i < V1.size(); ++i)
|
||||
dq.emplace_front(std::move(V1[i]));
|
||||
return *this;
|
||||
@@ -319,7 +322,7 @@ public:
|
||||
//-----------------------------------------------------------------------
|
||||
void pop_front(void)
|
||||
{
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
dq.pop_front();
|
||||
};
|
||||
//
|
||||
@@ -333,7 +336,7 @@ public:
|
||||
//-----------------------------------------------------------------------
|
||||
bool pop_copy_front(value_type & P)
|
||||
{ //-------------------------- begin -----------------------------
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
if (dq.size() == 0) return false;
|
||||
P = dq.front();
|
||||
dq.pop_front();
|
||||
@@ -350,7 +353,7 @@ public:
|
||||
//------------------------------------------------------------------------
|
||||
bool pop_move_front(value_type & P)
|
||||
{ //-------------------------- begin -----------------------------
|
||||
std::lock_guard < spinlock > S(spl);
|
||||
std::lock_guard < spinlock_t > S(spl);
|
||||
if (dq.size() == 0) return false;
|
||||
P = std::move(dq.front());
|
||||
dq.pop_front();
|
||||
@@ -360,7 +363,8 @@ public:
|
||||
// end class deque_cnc
|
||||
|
||||
//***************************************************************************
|
||||
};// end namespace tools
|
||||
};// end namespace common
|
||||
};// end namespace sort
|
||||
};// end namespace boost
|
||||
//***************************************************************************
|
||||
#endif
|
||||
|
||||
@@ -129,7 +129,7 @@ static void sort_index(Iter_t global_first, std::vector<Iter_t> &index)
|
||||
};
|
||||
};
|
||||
|
||||
template<class func, class Iter_t, class Compare = compare_iter<Iter_t> >
|
||||
template<class func, class Iter_t, class Compare = util::compare_iter<Iter_t> >
|
||||
static void indirect_sort(func method, Iter_t first, Iter_t last, Compare comp)
|
||||
{
|
||||
auto nelem = (last - first);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#ifndef __BOOST_SORT_COMMON_INT_ARRAY_HPP
|
||||
#define __BOOST_SORT_COMMON_INT_ARRAY_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#ifndef __BOOST_SORT_COMMON_MERGE_BLOCK_HPP
|
||||
#define __BOOST_SORT_COMMON_MERGE_BLOCK_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <boost/sort/common/range.hpp>
|
||||
#include <boost/sort/common/rearrange.hpp>
|
||||
#include <boost/sort/common/util/merge.hpp>
|
||||
|
||||
@@ -13,12 +13,14 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_UTIL_MERGE_FOUR_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_UTIL_MERGE_FOUR_HPP
|
||||
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
#include <boost/sort/common/range.hpp>
|
||||
#include <ciso646>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
#include <boost/sort/common/range.hpp>
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
@@ -14,12 +14,14 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_UTIL_MERGE_VECTOR_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_UTIL_MERGE_VECTOR_HPP
|
||||
|
||||
#include <boost/sort/common/merge_four.hpp>
|
||||
|
||||
#include <ciso646>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
#include <boost/sort/common/merge_four.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -99,7 +101,7 @@ void merge_level4(range<Iter1_t> dest, std::vector<range<Iter2_t> > &v_input,
|
||||
template<class Value_t, class Iter_t, class Compare>
|
||||
void uninit_merge_level4(range<Value_t *> dest,
|
||||
std::vector<range<Iter_t> > &v_input,
|
||||
std::vector<range<Value_t *> > &v_output, Compare comp)
|
||||
std::vector <range<Value_t *> > &v_output, Compare comp)
|
||||
{
|
||||
typedef range<Value_t *> range1_t;
|
||||
typedef util::value_iter<Iter_t> type1;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#ifndef __BOOST_SORT_COMMON_PIVOT_HPP
|
||||
#define __BOOST_SORT_COMMON_PIVOT_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <cstdint>
|
||||
|
||||
namespace boost
|
||||
|
||||
@@ -13,13 +13,15 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_UTIL_RANGE_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_UTIL_RANGE_HPP
|
||||
|
||||
#include <boost/sort/common/util/algorithm.hpp>
|
||||
#include <boost/sort/common/util/merge.hpp>
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
#include <ciso646>
|
||||
#include <cassert>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <boost/sort/common/util/algorithm.hpp>
|
||||
#include <boost/sort/common/util/merge.hpp>
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
@@ -13,13 +13,14 @@
|
||||
#ifndef __BOOST_SORT_COMMON_REARRANGE_HPP
|
||||
#define __BOOST_SORT_COMMON_REARRANGE_HPP
|
||||
|
||||
//#include <boost/sort/common/atomic.hpp>
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
#include <ciso646>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
@@ -14,15 +14,16 @@
|
||||
#ifndef __BOOST_SORT_COMMON_SCHEDULER_HPP
|
||||
#define __BOOST_SORT_COMMON_SCHEDULER_HPP
|
||||
|
||||
#include <boost/sort/common/spinlock.hpp>
|
||||
#include <boost/sort/common/search.hpp>
|
||||
#include <boost/sort/common/compare_traits.hpp>
|
||||
#include <ciso646>
|
||||
#include <scoped_allocator>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <iostream>
|
||||
#include <unordered_map>
|
||||
#include <boost/sort/common/spinlock.hpp>
|
||||
#include <boost/sort/common/util/search.hpp>
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -55,14 +56,21 @@ struct scheduler
|
||||
// D E F I N I T I O N S
|
||||
//-----------------------------------------------------------------------
|
||||
typedef std::scoped_allocator_adaptor <Allocator> scoped_alloc;
|
||||
template <class T>
|
||||
using alloc_t = typename std::allocator_traits<Allocator>::
|
||||
template rebind_alloc<T>;
|
||||
|
||||
|
||||
typedef std::deque <Func_t, scoped_alloc> deque_t;
|
||||
typedef typename deque_t::iterator it_deque;
|
||||
typedef std::thread::id key_t;
|
||||
typedef std::hash <key_t> hash_t;
|
||||
typedef std::equal_to <key_t> equal_t;
|
||||
typedef std::unique_lock <spinlock_t> lock_t;
|
||||
typedef std::unordered_map <key_t, deque_t, hash_t,
|
||||
equal_t, scoped_alloc> map_t;
|
||||
typedef std::pair<const key_t, deque_t> pair_t;
|
||||
|
||||
typedef std::unordered_map <key_t, deque_t, hash_t,
|
||||
equal_t, alloc_t <pair_t> > map_t;
|
||||
typedef typename map_t::iterator it_map;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@@ -184,7 +192,7 @@ struct scheduler
|
||||
//--------------------------------------------------------------------
|
||||
// Metaprogramming
|
||||
//--------------------------------------------------------------------
|
||||
typedef value_iter<it_func> value2_t;
|
||||
typedef util::value_iter<it_func> value2_t;
|
||||
static_assert (std::is_same< Func_t, value2_t >::value,
|
||||
"Incompatible iterators\n");
|
||||
|
||||
|
||||
@@ -13,10 +13,7 @@
|
||||
#ifndef __BOOST_SORT_COMMON_SORT_BASIC_HPP
|
||||
#define __BOOST_SORT_COMMON_SORT_BASIC_HPP
|
||||
|
||||
//#include <boost/sort/spinsort/util/indirect.hpp>
|
||||
#include <boost/sort/insert_sort/insert_sort.hpp>
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
#include <boost/sort/common/range.hpp>
|
||||
#include <ciso646>
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
@@ -24,6 +21,9 @@
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
#include <cstddef>
|
||||
#include <boost/sort/insert_sort/insert_sort.hpp>
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
#include <boost/sort/common/range.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_UTIL_SPINLOCK_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_UTIL_SPINLOCK_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <atomic>
|
||||
#include <ctime>
|
||||
#include <functional>
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_UTIL_STACK_CNC_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_UTIL_STACK_CNC_HPP
|
||||
|
||||
#include <boost/sort/common/spinlock.hpp>
|
||||
#include <ciso646>
|
||||
#include <vector>
|
||||
#include <boost/sort/common/spinlock.hpp>
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_TOOLS_TIME_MEASURE_HPP
|
||||
#define __BOOST_SORT_PARALLEL_TOOLS_TIME_MEASURE_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <chrono>
|
||||
|
||||
namespace boost
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#ifndef __BOOST_SORT_COMMON_UTIL_ALGORITHM_HPP
|
||||
#define __BOOST_SORT_COMMON_UTIL_ALGORITHM_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_UTIL_ATOMIC_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_UTIL_ATOMIC_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#ifndef __BOOST_SORT_COMMON_UTIL_CIRCULAR_BUFFER_HPP
|
||||
#define __BOOST_SORT_COMMON_UTIL_CIRCULAR_BUFFER_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <memory>
|
||||
#include <cassert>
|
||||
#include <exception>
|
||||
@@ -70,7 +71,7 @@ struct circular_buffer
|
||||
circular_buffer(void)
|
||||
: ptr(nullptr), nelem(0), first_pos(0), initialized(false)
|
||||
{
|
||||
ptr = std::get_temporary_buffer < Value_t > (NMAX).first;
|
||||
ptr = static_cast <Value_t*> (std::malloc (NMAX * sizeof(Value_t)));
|
||||
if (ptr == nullptr) throw std::bad_alloc();
|
||||
};
|
||||
//
|
||||
@@ -84,7 +85,7 @@ struct circular_buffer
|
||||
{ for (size_t i = 0; i < NMAX; ++i) (ptr + i)->~Value_t();
|
||||
initialized = false;
|
||||
};
|
||||
std::return_temporary_buffer(ptr);
|
||||
std::free(static_cast <void*> (ptr));
|
||||
}
|
||||
;
|
||||
//
|
||||
|
||||
@@ -13,10 +13,8 @@
|
||||
#ifndef __BOOST_SORT_COMMON_UTIL_INSERT_HPP
|
||||
#define __BOOST_SORT_COMMON_UTIL_INSERT_HPP
|
||||
|
||||
//#include <boost/sort/spinsort/util/indirect.hpp>
|
||||
#include <boost/sort/common/util/insert.hpp>
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
#include <boost/sort/common/util/algorithm.hpp>
|
||||
|
||||
#include <ciso646>
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
@@ -24,6 +22,9 @@
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
#include <cstddef>
|
||||
#include <boost/sort/common/util/insert.hpp>
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
#include <boost/sort/common/util/algorithm.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#ifndef __BOOST_SORT_COMMON_UTIL_MERGE_HPP
|
||||
#define __BOOST_SORT_COMMON_UTIL_MERGE_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
#ifndef __BOOST_SORT_COMMON_SEARCH_HPP
|
||||
#define __BOOST_SORT_COMMON_SEARCH_HPP
|
||||
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
#include <ciso646>
|
||||
#include <cassert>
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#ifndef __BOOST_SORT_COMMON_UTIL_TRAITS_HPP
|
||||
#define __BOOST_SORT_COMMON_UTIL_TRAITS_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -13,6 +13,14 @@
|
||||
#ifndef __BOOST_SORT_FLAT_STABLE_SORT_HPP
|
||||
#define __BOOST_SORT_FLAT_STABLE_SORT_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/sort/insert_sort/insert_sort.hpp>
|
||||
#include <boost/sort/common/util/insert.hpp>
|
||||
#include <boost/sort/common/merge_block.hpp>
|
||||
@@ -21,12 +29,7 @@
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
#include <boost/sort/common/indirect.hpp>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -299,7 +302,7 @@ inline void indirect_flat_stable_sort (Iter_t first, Iter_t last,
|
||||
Compare comp = Compare())
|
||||
{
|
||||
typedef typename std::vector<Iter_t>::iterator itx_iter;
|
||||
typedef common::less_ptr_no_null<Iter_t, Compare> itx_comp;
|
||||
typedef common::less_ptr_no_null <Iter_t, Compare> itx_comp;
|
||||
common::indirect_sort ( flat_stable_sort<itx_iter, itx_comp>,
|
||||
first, last, comp);
|
||||
};
|
||||
|
||||
@@ -1,215 +0,0 @@
|
||||
//----------------------------------------------------------------------------
|
||||
/// @file heap_sort.hpp
|
||||
/// @brief Insertion Sort algorithm
|
||||
///
|
||||
/// @author Copyright (c) 2016 Francisco Jose Tapia (fjtapia@gmail.com )\n
|
||||
/// Distributed under the Boost Software License, Version 1.0.\n
|
||||
/// ( See accompanying file LICENSE_1_0.txt or copy at
|
||||
/// http://www.boost.org/LICENSE_1_0.txt )
|
||||
/// @version 0.1
|
||||
///
|
||||
/// @remarks
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef __BOOST_SORT_INTROSORT_DETAIL_HEAP_SORT_HPP
|
||||
#define __BOOST_SORT_INTROSORT_DETAIL_HEAP_SORT_HPP
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
#include <stdexcept>
|
||||
#include <utility> // for std::swap
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace sort
|
||||
{
|
||||
namespace heap_detail
|
||||
{
|
||||
namespace bscu = boost::sort::common::util;
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
// struct : heap_sort
|
||||
/// @brief : Heap sort algorithm
|
||||
/// @remarks This algorithm is O(NLogN)
|
||||
//---------------------------------------------------------------------------
|
||||
template < class Iter_t, class Compare >
|
||||
struct heap_sort
|
||||
{
|
||||
typedef bscu::value_iter<Iter_t> value_t;
|
||||
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
// function : sort3
|
||||
/// @brief Sort and signal the changes of three values
|
||||
/// @param val_0 : first value to compare
|
||||
/// @param val_1 : second value to compare
|
||||
/// @param val_2 : third value to compare
|
||||
/// @param [out] bool_0 : if true indicates val_0 had been changed
|
||||
/// @param [out] bool_1 : if true indicates val_1 had been changed
|
||||
/// @param [out] bool_2 : if true indicates val_2 had been changed
|
||||
/// @return if true , some value had changed
|
||||
/// @remarks
|
||||
//------------------------------------------------------------------------
|
||||
bool sort3 (value_t &val_0, value_t &val_1, value_t &val_2, bool &bool_0,
|
||||
bool &bool_1, bool &bool_2)
|
||||
{
|
||||
bool_0 = bool_1 = bool_2 = false;
|
||||
int value = 0;
|
||||
if (val_0 < val_1) value += 4;
|
||||
if (val_1 < val_2) value += 2;
|
||||
if (val_0 < val_2) value += 1;
|
||||
|
||||
switch (value)
|
||||
{
|
||||
case 0: break;
|
||||
|
||||
case 2:
|
||||
std::swap (val_1, val_2);
|
||||
bool_1 = bool_2 = true;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (not(val_0 > val_1)) {
|
||||
std::swap (val_0, val_2);
|
||||
bool_0 = bool_2 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto aux = std::move (val_2);
|
||||
val_2 = std::move (val_1);
|
||||
val_1 = std::move (val_0);
|
||||
val_0 = std::move (aux);
|
||||
bool_0 = bool_1 = bool_2 = true;
|
||||
};
|
||||
break;
|
||||
|
||||
case 4:
|
||||
std::swap (val_0, val_1);
|
||||
bool_0 = bool_1 = true;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if (val_1 > val_2) {
|
||||
auto aux = std::move (val_0);
|
||||
val_0 = std::move (val_1);
|
||||
val_1 = std::move (val_2);
|
||||
val_2 = std::move (aux);
|
||||
bool_0 = bool_1 = bool_2 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::swap (val_0, val_2);
|
||||
bool_0 = bool_2 = true;
|
||||
};
|
||||
break;
|
||||
|
||||
case 7:
|
||||
std::swap (val_0, val_2);
|
||||
bool_0 = bool_2 = true;
|
||||
break;
|
||||
|
||||
default: abort ( );
|
||||
};
|
||||
return (bool_0 or bool_1 or bool_2);
|
||||
};
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// function : make_heap
|
||||
/// @brief Make the heap for to extract the sorted elements
|
||||
/// @param first : iterator to the first element of the range
|
||||
/// @param nelem : number of lements of the range
|
||||
/// @param comp : object for to compare two elements
|
||||
/// @remarks This algorithm is O(NLogN)
|
||||
//------------------------------------------------------------------------
|
||||
void make_heap (Iter_t first, size_t nelem, Compare comp)
|
||||
{
|
||||
size_t pos_father, pos_son;
|
||||
Iter_t iter_father = first, iter_son = first;
|
||||
bool sw = false;
|
||||
|
||||
for (size_t i = 1; i < nelem; ++i)
|
||||
{
|
||||
pos_father = i;
|
||||
iter_father = first + i;
|
||||
sw = false;
|
||||
do
|
||||
{
|
||||
iter_son = iter_father;
|
||||
pos_son = pos_father;
|
||||
pos_father = (pos_son - 1) >> 1;
|
||||
iter_father = first + pos_father;
|
||||
if ((sw = comp (*iter_father, *iter_son)))
|
||||
std::swap (*iter_father, *iter_son);
|
||||
} while (sw and pos_father != 0);
|
||||
};
|
||||
};
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
// function : heap_sort
|
||||
/// @brief : Heap sort algorithm
|
||||
/// @param first: iterator to the first element of the range
|
||||
/// @param last : iterator to the next element of the last in the range
|
||||
/// @param comp : object for to do the comparison between the elements
|
||||
/// @remarks This algorithm is O(NLogN)
|
||||
//------------------------------------------------------------------------
|
||||
heap_sort (Iter_t first, Iter_t last, Compare comp)
|
||||
{
|
||||
assert ((last - first) >= 0);
|
||||
size_t nelem = last - first;
|
||||
if (nelem < 2) return;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Creating the initial heap
|
||||
//--------------------------------------------------------------------
|
||||
make_heap (first, nelem, comp);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Sort the heap
|
||||
//--------------------------------------------------------------------
|
||||
size_t pos_father, pos_son;
|
||||
Iter_t iter_father = first, iter_son = first;
|
||||
|
||||
bool sw = false;
|
||||
for (size_t i = 1; i < nelem; ++i)
|
||||
{
|
||||
std::swap (*first, *(first + (nelem - i)));
|
||||
pos_father = 0;
|
||||
pos_son = 1;
|
||||
iter_father = first;
|
||||
sw = true;
|
||||
while (sw and pos_son < (nelem - i))
|
||||
{
|
||||
// if the father have two sons must select the bigger
|
||||
iter_son = first + pos_son;
|
||||
if ((pos_son + 1) < (nelem - i) and
|
||||
comp (*iter_son, *(iter_son + 1)))
|
||||
{
|
||||
++pos_son;
|
||||
++iter_son;
|
||||
};
|
||||
if ((sw = comp (*iter_father, *iter_son)))
|
||||
std::swap (*iter_father, *iter_son);
|
||||
pos_father = pos_son;
|
||||
iter_father = iter_son;
|
||||
pos_son = (pos_father << 1) + 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
}; // End class heap_sort
|
||||
}; // end namespace heap_sort
|
||||
|
||||
namespace bscu = boost::sort::common::util;
|
||||
|
||||
template < class Iter_t, typename Compare = bscu::compare_iter < Iter_t > >
|
||||
void heap_sort (Iter_t first, Iter_t last, Compare comp = Compare())
|
||||
{
|
||||
heap_detail::heap_sort<Iter_t, Compare> ( first, last, comp);
|
||||
}
|
||||
//
|
||||
//****************************************************************************
|
||||
}; // End namespace sort
|
||||
}; // End namespace boost
|
||||
//****************************************************************************
|
||||
//
|
||||
#endif
|
||||
@@ -13,6 +13,7 @@
|
||||
#ifndef __BOOST_SORT_INTROSORT_DETAIL_INSERT_SORT_HPP
|
||||
#define __BOOST_SORT_INTROSORT_DETAIL_INSERT_SORT_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -88,7 +88,7 @@ struct parallel_stable_sort
|
||||
//-----------------------------------------------------------------------------
|
||||
void destroy_all()
|
||||
{
|
||||
if (ptr != nullptr) std::return_temporary_buffer(ptr);
|
||||
if (ptr != nullptr) std::free (ptr);
|
||||
};
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -157,7 +157,9 @@ parallel_stable_sort <Iter_t, Compare>
|
||||
return;
|
||||
};
|
||||
|
||||
ptr = std::get_temporary_buffer<value_t>(nptr).first;
|
||||
ptr = reinterpret_cast <value_t*>
|
||||
(std::malloc (nptr * sizeof(value_t)));
|
||||
|
||||
if (ptr == nullptr) throw std::bad_alloc();
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_SAMPLE_SORT_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_SAMPLE_SORT_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <functional>
|
||||
#include <future>
|
||||
#include <iterator>
|
||||
@@ -288,7 +289,9 @@ sample_sort<Iter_t, Compare>
|
||||
}
|
||||
else
|
||||
{
|
||||
value_t *ptr = std::get_temporary_buffer<value_t>(nelem).first;
|
||||
value_t * ptr = reinterpret_cast <value_t*>
|
||||
(std::malloc (nelem * sizeof(value_t)));
|
||||
|
||||
if (ptr == nullptr) throw std::bad_alloc();
|
||||
owner = true;
|
||||
global_buf = range_buf(ptr, ptr + nelem);
|
||||
@@ -331,7 +334,7 @@ void sample_sort<Iter_t, Compare>::destroy_all(void)
|
||||
construct = false;
|
||||
}
|
||||
if (global_buf.first != nullptr and owner)
|
||||
std::return_temporary_buffer(global_buf.first);
|
||||
std::free(global_buf.first);
|
||||
}
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -370,7 +373,7 @@ void sample_sort<Iter_t, Compare>::initial_configuration(void)
|
||||
|
||||
for (uint32_t i = 0; i < nthread; ++i)
|
||||
{
|
||||
auto func = [=]()
|
||||
auto func = [=, this]()
|
||||
{
|
||||
bss::spinsort<Iter_t, Compare> (vmem_thread[i].first,
|
||||
vmem_thread[i].last, comp,
|
||||
|
||||
@@ -13,12 +13,8 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_ALGORITHM_SPIN_SORT_HPP
|
||||
#define __BOOST_SORT_PARALLEL_ALGORITHM_SPIN_SORT_HPP
|
||||
|
||||
//#include <boost/sort/spinsort/util/indirect.hpp>
|
||||
#include <boost/sort/insert_sort/insert_sort.hpp>
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
#include <boost/sort/common/util/algorithm.hpp>
|
||||
#include <boost/sort/common/range.hpp>
|
||||
#include <boost/sort/common/indirect.hpp>
|
||||
|
||||
#include <ciso646>
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
@@ -26,6 +22,12 @@
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
#include <cstddef>
|
||||
#include <boost/sort/insert_sort/insert_sort.hpp>
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
#include <boost/sort/common/util/algorithm.hpp>
|
||||
#include <boost/sort/common/range.hpp>
|
||||
#include <boost/sort/common/indirect.hpp>
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -82,7 +84,7 @@ static void sort_range_sort (const range<Iter1_t> &rng_data,
|
||||
//-----------------------------------------------------------------------------
|
||||
template<class Iter1_t, class Iter2_t, typename Compare>
|
||||
static void insert_partial_sort (Iter1_t first, Iter1_t mid, Iter1_t last,
|
||||
Compare comp, const range<Iter2_t> &rng_aux)
|
||||
Compare comp, const range <Iter2_t> &rng_aux)
|
||||
{
|
||||
//------------------------------------------------------------------------
|
||||
// metaprogram
|
||||
@@ -416,7 +418,7 @@ public:
|
||||
destroy(range<value_t *>(ptr, ptr + nptr));
|
||||
construct = false;
|
||||
};
|
||||
if (owner and ptr != nullptr) std::return_temporary_buffer(ptr);
|
||||
if (owner and ptr != nullptr) std::free (ptr);
|
||||
};
|
||||
};
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -477,7 +479,9 @@ spinsort <Iter_t, Compare>
|
||||
|
||||
if (ptr == nullptr)
|
||||
{
|
||||
ptr = std::get_temporary_buffer<value_t>(nptr).first;
|
||||
ptr = reinterpret_cast <value_t*>
|
||||
(std::malloc (nptr * sizeof(value_t)));
|
||||
|
||||
if (ptr == nullptr) throw std::bad_alloc();
|
||||
owner = true;
|
||||
};
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
CMakeLists.txt
|
||||
float_sort_test.cpp
|
||||
integer_sort_test.cpp
|
||||
Jamfile.v2
|
||||
list.txt
|
||||
sort_detail_test.cpp
|
||||
string_sort_test.cpp
|
||||
test_block_indirect_sort.cpp
|
||||
test_flat_stable_sort.cpp
|
||||
test_insert_sort.cpp
|
||||
test.log
|
||||
test_parallel_stable_sort.cpp
|
||||
test_pdqsort.cpp
|
||||
test_sample_sort.cpp
|
||||
test_spinsort.cpp
|
||||
@@ -1,37 +0,0 @@
|
||||
|
||||
Performing configuration checks
|
||||
|
||||
- symlinks supported : yes (cached)
|
||||
...patience...
|
||||
...patience...
|
||||
...found 2544 targets...
|
||||
...updating 20 targets...
|
||||
compile-c-c++ ..\..\..\bin.v2\libs\sort\test\integer_sort.test\msvc-12.0\debug\threading-multi\integer_sort_test.obj
|
||||
integer_sort_test.cpp
|
||||
msvc.link ..\..\..\bin.v2\libs\sort\test\integer_sort.test\msvc-12.0\debug\threading-multi\integer_sort.exe
|
||||
msvc.manifest ..\..\..\bin.v2\libs\sort\test\integer_sort.test\msvc-12.0\debug\threading-multi\integer_sort.exe
|
||||
testing.capture-output ..\..\..\bin.v2\libs\sort\test\integer_sort.test\msvc-12.0\debug\threading-multi\integer_sort.run
|
||||
1 file(s) copied.
|
||||
**passed** ..\..\..\bin.v2\libs\sort\test\integer_sort.test\msvc-12.0\debug\threading-multi\integer_sort.test
|
||||
compile-c-c++ ..\..\..\bin.v2\libs\sort\test\float_sort.test\msvc-12.0\debug\threading-multi\float_sort_test.obj
|
||||
float_sort_test.cpp
|
||||
msvc.link ..\..\..\bin.v2\libs\sort\test\float_sort.test\msvc-12.0\debug\threading-multi\float_sort.exe
|
||||
msvc.manifest ..\..\..\bin.v2\libs\sort\test\float_sort.test\msvc-12.0\debug\threading-multi\float_sort.exe
|
||||
testing.capture-output ..\..\..\bin.v2\libs\sort\test\float_sort.test\msvc-12.0\debug\threading-multi\float_sort.run
|
||||
1 file(s) copied.
|
||||
**passed** ..\..\..\bin.v2\libs\sort\test\float_sort.test\msvc-12.0\debug\threading-multi\float_sort.test
|
||||
compile-c-c++ ..\..\..\bin.v2\libs\sort\test\string_sort.test\msvc-12.0\debug\threading-multi\string_sort_test.obj
|
||||
string_sort_test.cpp
|
||||
msvc.link ..\..\..\bin.v2\libs\sort\test\string_sort.test\msvc-12.0\debug\threading-multi\string_sort.exe
|
||||
msvc.manifest ..\..\..\bin.v2\libs\sort\test\string_sort.test\msvc-12.0\debug\threading-multi\string_sort.exe
|
||||
testing.capture-output ..\..\..\bin.v2\libs\sort\test\string_sort.test\msvc-12.0\debug\threading-multi\string_sort.run
|
||||
1 file(s) copied.
|
||||
**passed** ..\..\..\bin.v2\libs\sort\test\string_sort.test\msvc-12.0\debug\threading-multi\string_sort.test
|
||||
compile-c-c++ ..\..\..\bin.v2\libs\sort\test\sort_detail.test\msvc-12.0\debug\threading-multi\sort_detail_test.obj
|
||||
sort_detail_test.cpp
|
||||
msvc.link ..\..\..\bin.v2\libs\sort\test\sort_detail.test\msvc-12.0\debug\threading-multi\sort_detail.exe
|
||||
msvc.manifest ..\..\..\bin.v2\libs\sort\test\sort_detail.test\msvc-12.0\debug\threading-multi\sort_detail.exe
|
||||
testing.capture-output ..\..\..\bin.v2\libs\sort\test\sort_detail.test\msvc-12.0\debug\threading-multi\sort_detail.run
|
||||
1 file(s) copied.
|
||||
**passed** ..\..\..\bin.v2\libs\sort\test\sort_detail.test\msvc-12.0\debug\threading-multi\sort_detail.test
|
||||
...updated 20 targets...
|
||||
Reference in New Issue
Block a user