mirror of
https://github.com/boostorg/sort.git
synced 2026-01-19 04:42:11 +00:00
Remove unnecessary semicolons for gcc --pedantic mode
This commit is contained in:
committed by
Nigel Stewart
parent
df2e184e14
commit
d2704d4660
@@ -203,7 +203,7 @@ move_blocks<Block_size, Group_size, Iter_t, Compare>
|
||||
}
|
||||
bk.exec(counter);
|
||||
}
|
||||
;
|
||||
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
// function : move_sequence
|
||||
|
||||
@@ -79,7 +79,8 @@ void create_index(Iter_t first, Iter_t last, std::vector<Iter_t> &index)
|
||||
index.clear();
|
||||
index.reserve(nelem);
|
||||
for (; first != last; ++first) index.push_back(first);
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : sort_index
|
||||
@@ -106,7 +107,7 @@ void sort_index(Iter_t global_first, std::vector<Iter_t> &index)
|
||||
(size_t(index[pos_in_vector] - global_first)) == pos_in_vector)
|
||||
{
|
||||
++pos_in_vector;
|
||||
};
|
||||
}
|
||||
|
||||
if (pos_in_vector == nelem) return;
|
||||
pos_dest = pos_src = pos_in_vector;
|
||||
@@ -121,13 +122,13 @@ void sort_index(Iter_t global_first, std::vector<Iter_t> &index)
|
||||
*it_dest = std::move(*it_src);
|
||||
it_dest = it_src;
|
||||
pos_dest = pos_src;
|
||||
};
|
||||
}
|
||||
|
||||
*it_dest = std::move(Aux);
|
||||
index[pos_dest] = it_dest;
|
||||
++pos_in_vector;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
template<class func, class Iter_t, class Compare = util::compare_iter<Iter_t> >
|
||||
void indirect_sort(func method, Iter_t first, Iter_t last, Compare comp)
|
||||
@@ -141,13 +142,13 @@ void indirect_sort(func method, Iter_t first, Iter_t last, Compare comp)
|
||||
less_ptr_no_null<Iter_t, Compare> index_comp(comp);
|
||||
method(index.begin(), index.end(), index_comp);
|
||||
sort_index(first, index);
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
//****************************************************************************
|
||||
};// End namespace common
|
||||
};// End namespace sort
|
||||
};// End namespace boost
|
||||
}// End namespace common
|
||||
}// End namespace sort
|
||||
}// End namespace boost
|
||||
//****************************************************************************
|
||||
//
|
||||
#endif
|
||||
|
||||
@@ -326,7 +326,7 @@ void merge_block<Iter_t, Compare, Power2>
|
||||
while (itxA != indexA.end())
|
||||
*(itx_out++) = *(itxA++);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// function : move_range_pos_backward
|
||||
@@ -365,7 +365,7 @@ void merge_block<Iter_t, Compare, Power2>
|
||||
util::move_backward(it_mid2, it_mid1, rng1.last);
|
||||
util::move_backward(rng1.last, rng1.first, it_mid1);
|
||||
};
|
||||
};
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
// function : rearrange_with_index
|
||||
/// @brief rearrange the blocks with the relative positions of the index
|
||||
@@ -408,11 +408,11 @@ void merge_block<Iter_t, Compare, Power2>
|
||||
index[pos_dest] = pos_dest;
|
||||
++pos_ini;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
//****************************************************************************
|
||||
};// End namespace common
|
||||
};// End namespace sort
|
||||
};// End namespace boost
|
||||
}// End namespace common
|
||||
}// End namespace sort
|
||||
}// End namespace boost
|
||||
//****************************************************************************
|
||||
#endif
|
||||
|
||||
@@ -57,7 +57,7 @@ inline bool less_range(Iter_t it1, uint32_t pos1, Iter_t it2, uint32_t pos2,
|
||||
{
|
||||
return (comp(*it1, *it2)) ? true :
|
||||
(pos2 < pos1) ? false : not (comp(*it2, *it1));
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : full_merge4
|
||||
@@ -96,17 +96,17 @@ range<Iter1_t> full_merge4(const range<Iter1_t> &rdest,
|
||||
for (uint32_t k = i + 1; k < nrange_input; ++k)
|
||||
{
|
||||
vrange_input[k - 1] = vrange_input[k];
|
||||
};
|
||||
}
|
||||
--nrange_input;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (nrange_input == 0) return range1_t(rdest.first, rdest.first);
|
||||
if (nrange_input == 1) return move_forward(rdest, vrange_input[0]);
|
||||
if (nrange_input == 2)
|
||||
{
|
||||
return merge(rdest, vrange_input[0], vrange_input[1], comp);
|
||||
};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Initial sort
|
||||
@@ -122,12 +122,12 @@ range<Iter1_t> full_merge4(const range<Iter1_t> &rdest,
|
||||
vrange_input[pos[0]].first, pos[0], comp))
|
||||
{
|
||||
swap(pos[0], pos[1]);
|
||||
};
|
||||
}
|
||||
if (npos == 4 and less_range(vrange_input[pos[3]].first, pos[3],
|
||||
vrange_input[pos[2]].first, pos[2], comp))
|
||||
{
|
||||
swap(pos[3], pos[2]);
|
||||
};
|
||||
}
|
||||
if (less_range (vrange_input[pos[2]].first, pos[2],
|
||||
vrange_input[pos[0]].first, pos[0], comp))
|
||||
{
|
||||
@@ -138,12 +138,12 @@ range<Iter1_t> full_merge4(const range<Iter1_t> &rdest,
|
||||
vrange_input[pos[1]].first, pos[1], comp))
|
||||
{
|
||||
swap(pos[1], pos[3]);
|
||||
};
|
||||
}
|
||||
if (less_range (vrange_input[pos[2]].first, pos[2],
|
||||
vrange_input[pos[1]].first, pos[1], comp))
|
||||
{
|
||||
swap(pos[1], pos[2]);
|
||||
};
|
||||
}
|
||||
|
||||
Iter1_t it_dest = rdest.first;
|
||||
while (npos > 2)
|
||||
@@ -173,11 +173,11 @@ range<Iter1_t> full_merge4(const range<Iter1_t> &rdest,
|
||||
pos[2], comp))
|
||||
{
|
||||
swap(pos[2], pos[3]);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
range1_t raux1(rdest.first, it_dest), raux2(it_dest, rdest.last);
|
||||
if (pos[0] < pos[1])
|
||||
@@ -189,8 +189,8 @@ range<Iter1_t> full_merge4(const range<Iter1_t> &rdest,
|
||||
{
|
||||
return concat(raux1, merge (raux2, vrange_input[pos[1]],
|
||||
vrange_input[pos[0]], comp));
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : uninit_full_merge4
|
||||
@@ -236,7 +236,7 @@ range<Value_t *> uninit_full_merge4(const range<Value_t *> &dest,
|
||||
if (nrange_input == 2)
|
||||
{
|
||||
return merge_construct(dest, vrange_input[0], vrange_input[1], comp);
|
||||
};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Initial sort
|
||||
@@ -319,13 +319,13 @@ range<Value_t *> uninit_full_merge4(const range<Value_t *> &dest,
|
||||
return concat(raux1,
|
||||
merge_construct(raux2, vrange_input[pos[1]],
|
||||
vrange_input[pos[0]], comp));
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
//****************************************************************************
|
||||
};// End namespace common
|
||||
};// End namespace sort
|
||||
};// End namespace boost
|
||||
}// End namespace common
|
||||
}// End namespace sort
|
||||
}// End namespace boost
|
||||
//****************************************************************************
|
||||
//
|
||||
#endif
|
||||
|
||||
@@ -67,7 +67,7 @@ void merge_level4(range<Iter1_t> dest, std::vector<range<Iter2_t> > &v_input,
|
||||
{
|
||||
v_output.emplace_back(move_forward(dest, v_input[0]));
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
uint32_t nrange = v_input.size();
|
||||
uint32_t pos_ini = 0;
|
||||
@@ -80,9 +80,9 @@ void merge_level4(range<Iter1_t> dest, std::vector<range<Iter2_t> > &v_input,
|
||||
dest.first = rz.last;
|
||||
pos_ini += nelem;
|
||||
nrange -= nelem;
|
||||
};
|
||||
}
|
||||
return;
|
||||
};
|
||||
}
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : uninit_merge_level4
|
||||
@@ -129,7 +129,7 @@ void uninit_merge_level4(range<Value_t *> dest,
|
||||
nrange -= nelem;
|
||||
};
|
||||
return;
|
||||
};
|
||||
}
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : merge_vector4
|
||||
@@ -187,12 +187,12 @@ range<Iter2_t> merge_vector4(range<Iter1_t> range_input,
|
||||
};
|
||||
};
|
||||
return (sw) ? v_output[0] : move_forward(range_output, v_input[0]);
|
||||
};
|
||||
}
|
||||
|
||||
//****************************************************************************
|
||||
};// End namespace common
|
||||
};// End namespace sort
|
||||
};// End namespace boost
|
||||
}// End namespace common
|
||||
}// End namespace sort
|
||||
}// End namespace boost
|
||||
//****************************************************************************
|
||||
//
|
||||
#endif
|
||||
|
||||
@@ -50,7 +50,7 @@ inline Iter_t mid3 (Iter_t iter_1, Iter_t iter_2, Iter_t iter_3, Compare comp)
|
||||
if (comp (*iter_2, *iter_1)) swap ( *iter_2, *iter_1);
|
||||
};
|
||||
return iter_2;
|
||||
};
|
||||
}
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : pivot3
|
||||
@@ -69,7 +69,7 @@ inline void pivot3 (Iter_t first, Iter_t last, Compare comp)
|
||||
auto N2 = (last - first) >> 1;
|
||||
Iter_t it_val = mid3 (first + 1, first + N2, last - 1, comp);
|
||||
swap (*first, *it_val);
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -96,7 +96,7 @@ inline Iter_t mid9 (Iter_t iter_1, Iter_t iter_2, Iter_t iter_3, Iter_t iter_4,
|
||||
return mid3 (mid3 (iter_1, iter_2, iter_3, comp),
|
||||
mid3 (iter_4, iter_5, iter_6, comp),
|
||||
mid3 (iter_7, iter_8, iter_9, comp), comp);
|
||||
};
|
||||
}
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : pivot9
|
||||
@@ -118,10 +118,10 @@ inline void pivot9 (Iter_t first, Iter_t last, Compare comp)
|
||||
first + 3 * cupo, first + 4 * cupo, first + 5 * cupo,
|
||||
first + 6 * cupo, first + 7 * cupo, last - 1, comp);
|
||||
swap (*first, *itaux);
|
||||
};
|
||||
}
|
||||
//****************************************************************************
|
||||
};// End namespace common
|
||||
};// End namespace sort
|
||||
};// End namespace boost
|
||||
}// End namespace common
|
||||
}// End namespace sort
|
||||
}// End namespace boost
|
||||
//****************************************************************************
|
||||
#endif
|
||||
|
||||
@@ -109,7 +109,7 @@ inline range<Iter_t> concat(const range<Iter_t> &it1, const range<Iter_t> &it2)
|
||||
{
|
||||
return range<Iter_t>(it1.first, it2.last);
|
||||
}
|
||||
;
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : move_forward
|
||||
@@ -125,7 +125,8 @@ inline range<Iter2_t> move_forward(const range<Iter2_t> &dest,
|
||||
assert(dest.size() >= src.size());
|
||||
Iter2_t it_aux = util::move_forward(dest.first, src.first, src.last);
|
||||
return range<Iter2_t>(dest.first, it_aux);
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : move_backward
|
||||
@@ -142,7 +143,7 @@ inline range<Iter2_t> move_backward(const range<Iter2_t> &dest,
|
||||
Iter2_t it_aux = util::move_backward(dest.first + src.size(), src.first,
|
||||
src.last);
|
||||
return range<Iter2_t>(dest.first, dest.src.size());
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : uninit_move
|
||||
@@ -158,7 +159,8 @@ inline range<Value_t*> move_construct(const range<Value_t*> &dest,
|
||||
{
|
||||
Value_t *ptr_aux = util::move_construct(dest.first, src.first, src.last);
|
||||
return range<Value_t*>(dest.first, ptr_aux);
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : destroy
|
||||
@@ -169,7 +171,8 @@ template<class Iter_t>
|
||||
inline void destroy(range<Iter_t> rng)
|
||||
{
|
||||
util::destroy(rng.first, rng.last);
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : initialize
|
||||
@@ -183,7 +186,8 @@ inline range<Iter_t> initialize(const range<Iter_t> &rng, Value_t &val)
|
||||
{
|
||||
util::initialize(rng.first, rng.last, val);
|
||||
return rng;
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : is_mergeable
|
||||
@@ -209,7 +213,8 @@ inline bool is_mergeable(const range<Iter1_t> &src1, const range<Iter2_t> &src2,
|
||||
// Code
|
||||
//------------------------------------------------------------------------
|
||||
return comp(*(src2.front()), *(src1.back()));
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : is_mergeable_stable
|
||||
@@ -235,7 +240,8 @@ inline bool is_mergeable_stable(const range<Iter1_t> &src1,
|
||||
// Code
|
||||
//------------------------------------------------------------------------
|
||||
return ! comp(*(src1.back()), *(src2.front()));
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : merge
|
||||
@@ -258,7 +264,7 @@ inline range<Iter3_t> merge(const range<Iter3_t> &dest,
|
||||
Iter3_t it_aux = util::merge(src1.first, src1.last, src2.first, src2.last,
|
||||
dest.first, comp);
|
||||
return range<Iter3_t>(dest.first, it_aux);
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : merge_construct
|
||||
@@ -283,7 +289,8 @@ inline range<Value_t *> merge_construct(const range<Value_t *> &dest,
|
||||
Value_t * ptr_aux = util::merge_construct(src1.first, src1.last, src2.first,
|
||||
src2.last, dest.first, comp);
|
||||
return range<Value_t*>(dest.first, ptr_aux);
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
// function : half_merge
|
||||
@@ -306,7 +313,8 @@ inline range<Iter2_t> merge_half(const range<Iter2_t> &dest,
|
||||
Iter2_t it_aux = util::merge_half(src1.first, src1.last, src2.first,
|
||||
src2.last, dest.first, comp);
|
||||
return range<Iter2_t>(dest.first, it_aux);
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : merge_uncontiguous
|
||||
@@ -326,7 +334,8 @@ inline bool merge_uncontiguous(const range<Iter1_t> &src1,
|
||||
{
|
||||
return util::merge_uncontiguous(src1.first, src1.last, src2.first,
|
||||
src2.last, aux.first, comp);
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : merge_contiguous
|
||||
@@ -345,7 +354,8 @@ inline range<Iter1_t> merge_contiguous(const range<Iter1_t> &src1,
|
||||
{
|
||||
util::merge_contiguous(src1.first, src1.last, src2.last, buf.first, comp);
|
||||
return concat(src1, src2);
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : merge_flow
|
||||
@@ -389,12 +399,12 @@ static void merge_flow(range<Iter1_t> rng1, range<Iter2_t> rbuf,
|
||||
if (rx2.first == rx2.last) return;
|
||||
if (rbx.first == rbx.last) move_forward(rbuf, rng2);
|
||||
else merge_half(rbuf, rx2, rbx, cmp);
|
||||
};
|
||||
}
|
||||
|
||||
//****************************************************************************
|
||||
};// End namespace common
|
||||
};// End namespace sort
|
||||
};// End namespace boost
|
||||
}// End namespace common
|
||||
}// End namespace sort
|
||||
}// End namespace boost
|
||||
//****************************************************************************
|
||||
//
|
||||
#endif
|
||||
|
||||
@@ -101,7 +101,7 @@ void rearrange(Iter_data global_first, Iter_index itx_first,
|
||||
index[pos_ini] = std::move(itx_src);
|
||||
++pos_ini;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
//
|
||||
@@ -161,9 +161,9 @@ void rearrange(Iter_data global_first, Iter_index itx_first,
|
||||
*/
|
||||
//
|
||||
//****************************************************************************
|
||||
};// End namespace common
|
||||
};// End namespace sort
|
||||
};// End namespace boost
|
||||
}// End namespace common
|
||||
}// End namespace sort
|
||||
}// End namespace boost
|
||||
//****************************************************************************
|
||||
//
|
||||
#endif
|
||||
|
||||
@@ -80,7 +80,7 @@ inline Iter_t is_reverse_stable_sorted_forward(Iter_t first, Iter_t last,
|
||||
Iter_t it2 = first + 1;
|
||||
for (Iter_t it1 = first; it2 != last && comp(*it2, *it1); it1 = it2++);
|
||||
return it2;
|
||||
};
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : number_stable_sorted_forward
|
||||
/// @brief examine the elements in the range first, last if they are stable
|
||||
@@ -117,7 +117,7 @@ size_t number_stable_sorted_forward (Iter_t first, Iter_t last,
|
||||
if ( nsorted < min_process) return 0 ;
|
||||
util::reverse ( first , it2);
|
||||
return nsorted;
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : is_stable_sorted_backward
|
||||
@@ -248,7 +248,7 @@ inline void internal_sort (const range<Iter1_t> &rng1,
|
||||
internal_sort(rng2_right, rng1_right, comp, level + 1, even);
|
||||
};
|
||||
merge(rng2, rng1_left, rng1_right, comp);
|
||||
};
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : range_sort_data
|
||||
/// @brief this sort elements using the range_sort function and receiving a
|
||||
@@ -285,7 +285,7 @@ static void range_sort_data (const range<Iter1_t> & rng_data,
|
||||
};
|
||||
|
||||
internal_sort(rng_aux, rng_data, comp, 0, true);
|
||||
};
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : range_sort_buffer
|
||||
/// @brief this sort elements using the range_sort function and receiving a
|
||||
@@ -323,11 +323,11 @@ static void range_sort_buffer(const range<Iter1_t> & rng_data,
|
||||
};
|
||||
|
||||
internal_sort(rng_data, rng_aux, comp, 0, false);
|
||||
};
|
||||
}
|
||||
//****************************************************************************
|
||||
};// End namespace common
|
||||
};// End namespace sort
|
||||
};// End namepspace boost
|
||||
}// End namespace common
|
||||
}// End namespace sort
|
||||
}// End namepspace boost
|
||||
//****************************************************************************
|
||||
//
|
||||
#endif
|
||||
|
||||
@@ -48,7 +48,7 @@ class spinlock_t
|
||||
/// @brief class constructor
|
||||
/// @param [in]
|
||||
//-------------------------------------------------------------------------
|
||||
explicit spinlock_t ( ) noexcept { af.clear ( ); };
|
||||
explicit spinlock_t ( ) noexcept { af.clear ( ); }
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
// function : lock
|
||||
@@ -59,8 +59,8 @@ class spinlock_t
|
||||
while (af.test_and_set (std::memory_order_acquire))
|
||||
{
|
||||
std::this_thread::yield ( );
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
// function : try_lock
|
||||
@@ -71,19 +71,19 @@ class spinlock_t
|
||||
bool try_lock ( ) noexcept
|
||||
{
|
||||
return !af.test_and_set (std::memory_order_acquire);
|
||||
};
|
||||
}
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
// function : unlock
|
||||
/// @brief unlock the spinlock_t
|
||||
//-------------------------------------------------------------------------
|
||||
void unlock ( ) noexcept { af.clear (std::memory_order_release); };
|
||||
void unlock ( ) noexcept { af.clear (std::memory_order_release); }
|
||||
|
||||
}; // E N D C L A S S S P I N L O C K
|
||||
//
|
||||
//***************************************************************************
|
||||
}; // end namespace common
|
||||
}; // end namespace sort
|
||||
}; // end namespace boost
|
||||
} // end namespace common
|
||||
} // end namespace sort
|
||||
} // end namespace boost
|
||||
//***************************************************************************
|
||||
#endif
|
||||
|
||||
@@ -128,7 +128,7 @@ static Iter3_t merge(Iter1_t buf1, const Iter1_t end_buf1, Iter2_t buf2,
|
||||
move_forward(buf_out, buf2, end_buf2) :
|
||||
move_forward(buf_out, buf1, end_buf1);
|
||||
}
|
||||
;
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : merge_construct
|
||||
|
||||
@@ -132,7 +132,7 @@ void flat_stable_sort <Iter_t, Compare, Power2>
|
||||
divide(itx_first, itx_first + nblock1);
|
||||
divide(itx_first + nblock1, itx_last);
|
||||
merge_range_pos(itx_first, itx_first + nblock1, itx_last);
|
||||
};
|
||||
}
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
// @fn sort_small
|
||||
@@ -168,7 +168,7 @@ void flat_stable_sort <Iter_t, Compare, Power2>
|
||||
range_sort_data(rng_data2, rng_aux2, cmp);
|
||||
range_sort_buffer(rng_data1, rng_aux1, cmp);
|
||||
merge_half(rng_data, rng_aux1, rng_data2, cmp);
|
||||
};
|
||||
}
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
// @fn is_sorted_forward
|
||||
@@ -209,7 +209,7 @@ bool flat_stable_sort <Iter_t, Compare, Power2>
|
||||
merge_range_pos(itx_first, itx_first + nblock1, itx_last);
|
||||
};
|
||||
return true;
|
||||
};
|
||||
}
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
// @fn is_sorted_backward
|
||||
@@ -250,9 +250,9 @@ bool flat_stable_sort <Iter_t, Compare, Power2>
|
||||
merge_range_pos(itx_first, itx_first + nblock1, itx_last);
|
||||
};
|
||||
return true;
|
||||
};
|
||||
}
|
||||
//****************************************************************************
|
||||
};// End namespace flat_internal
|
||||
}// End namespace flat_internal
|
||||
//****************************************************************************
|
||||
//
|
||||
namespace bscu = boost::sort::common::util;
|
||||
@@ -270,7 +270,7 @@ inline void flat_stable_sort (Iter_t first, Iter_t last,
|
||||
Compare cmp = Compare())
|
||||
{
|
||||
flat::flat_stable_sort<Iter_t, Compare, 6> (first, last, cmp);
|
||||
};
|
||||
}
|
||||
|
||||
template<size_t Size>
|
||||
struct block_size_fss
|
||||
@@ -297,7 +297,7 @@ inline void flat_stable_sort (Iter_t first, Iter_t last,
|
||||
flat::flat_stable_sort<Iter_t, Compare,
|
||||
block_size_fss<sizeof(value_iter<Iter_t> )>::data>
|
||||
(first, last, cmp);
|
||||
};
|
||||
}
|
||||
|
||||
template<class Iter_t, class Compare = compare_iter<Iter_t> >
|
||||
inline void indirect_flat_stable_sort (Iter_t first, Iter_t last,
|
||||
@@ -307,11 +307,11 @@ inline void indirect_flat_stable_sort (Iter_t first, Iter_t last,
|
||||
typedef common::less_ptr_no_null <Iter_t, Compare> itx_comp;
|
||||
common::indirect_sort ( flat_stable_sort<itx_iter, itx_comp>,
|
||||
first, last, comp);
|
||||
};
|
||||
}
|
||||
|
||||
//****************************************************************************
|
||||
};// End namespace sort
|
||||
};// End namepspace boost
|
||||
}// End namespace sort
|
||||
}// End namepspace boost
|
||||
//****************************************************************************
|
||||
//
|
||||
#endif
|
||||
|
||||
@@ -57,12 +57,12 @@ static void insert_sort (Iter_t first, Iter_t last,
|
||||
};
|
||||
*it_insertion = std::move (Aux);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
//****************************************************************************
|
||||
}; // End namespace sort
|
||||
}; // End namespace boost
|
||||
} // End namespace sort
|
||||
} // End namespace boost
|
||||
//****************************************************************************
|
||||
//
|
||||
#endif
|
||||
|
||||
@@ -200,11 +200,11 @@ parallel_stable_sort <Iter_t, Compare>
|
||||
|
||||
|
||||
|
||||
}; // end of constructor
|
||||
} // end of constructor
|
||||
|
||||
//
|
||||
//****************************************************************************
|
||||
};// End namespace stable_detail
|
||||
}// End namespace stable_detail
|
||||
//****************************************************************************
|
||||
//
|
||||
|
||||
@@ -237,7 +237,7 @@ void parallel_stable_sort(Iter_t first, Iter_t last)
|
||||
{
|
||||
typedef bscu::compare_iter<Iter_t> Compare;
|
||||
stable_detail::parallel_stable_sort<Iter_t, Compare>(first, last);
|
||||
};
|
||||
}
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : parallel_stable_sort
|
||||
@@ -254,7 +254,7 @@ void parallel_stable_sort(Iter_t first, Iter_t last, uint32_t nthread)
|
||||
{
|
||||
typedef bscu::compare_iter<Iter_t> Compare;
|
||||
stable_detail::parallel_stable_sort<Iter_t, Compare>(first, last, nthread);
|
||||
};
|
||||
}
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : parallel_stable_sort
|
||||
@@ -271,7 +271,7 @@ template <class Iter_t, class Compare,
|
||||
void parallel_stable_sort(Iter_t first, Iter_t last, Compare comp)
|
||||
{
|
||||
stable_detail::parallel_stable_sort<Iter_t, Compare>(first, last, comp);
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -294,8 +294,8 @@ void parallel_stable_sort (Iter_t first, Iter_t last, Compare comp,
|
||||
}
|
||||
//
|
||||
//****************************************************************************
|
||||
};// End namespace sort
|
||||
};// End namespace boost
|
||||
}// End namespace sort
|
||||
}// End namespace boost
|
||||
//****************************************************************************
|
||||
//
|
||||
#endif
|
||||
|
||||
@@ -124,22 +124,22 @@ struct sample_sort
|
||||
|
||||
sample_sort(Iter_t first, Iter_t last)
|
||||
: sample_sort (first, last, Compare(), std::thread::hardware_concurrency(),
|
||||
nullptr, 0) { };
|
||||
nullptr, 0) { }
|
||||
|
||||
sample_sort(Iter_t first, Iter_t last, Compare cmp)
|
||||
: sample_sort(first, last, cmp, std::thread::hardware_concurrency(),
|
||||
nullptr, 0) { };
|
||||
nullptr, 0) { }
|
||||
|
||||
sample_sort(Iter_t first, Iter_t last, uint32_t num_thread)
|
||||
: sample_sort(first, last, Compare(), num_thread, nullptr, 0) { };
|
||||
: sample_sort(first, last, Compare(), num_thread, nullptr, 0) { }
|
||||
|
||||
sample_sort(Iter_t first, Iter_t last, Compare cmp, uint32_t num_thread)
|
||||
: sample_sort(first, last, cmp, num_thread, nullptr, 0) { };
|
||||
: sample_sort(first, last, cmp, num_thread, nullptr, 0) { }
|
||||
|
||||
sample_sort(Iter_t first, Iter_t last, Compare cmp, uint32_t num_thread,
|
||||
range_buf range_buf_initial)
|
||||
: sample_sort(first, last, cmp, num_thread,
|
||||
range_buf_initial.first, range_buf_initial.size()) { };
|
||||
range_buf_initial.first, range_buf_initial.size()) { }
|
||||
|
||||
void destroy_all(void);
|
||||
//
|
||||
@@ -148,7 +148,7 @@ struct sample_sort
|
||||
/// @brief destructor of the class. The utility is to destroy the temporary
|
||||
/// buffer used in the sorting process
|
||||
//-----------------------------------------------------------------------------
|
||||
~sample_sort(void) { destroy_all(); };
|
||||
~sample_sort(void) { destroy_all(); }
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// function : execute first
|
||||
@@ -161,8 +161,8 @@ struct sample_sort
|
||||
{
|
||||
uninit_merge_level4(vrange_buf_ini[job], vv_range_it[job],
|
||||
vv_range_buf[job], comp);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// function : execute
|
||||
@@ -175,8 +175,8 @@ struct sample_sort
|
||||
{
|
||||
merge_vector4(vrange_buf_ini[job], vrange_it_ini[job],
|
||||
vv_range_buf[job], vv_range_it[job], comp);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// function : first merge
|
||||
@@ -193,7 +193,7 @@ struct sample_sort
|
||||
};
|
||||
for (uint32_t i = 0; i < nthread; ++i)
|
||||
vfuture[i].get();
|
||||
};
|
||||
}
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// function : final merge
|
||||
@@ -206,10 +206,10 @@ struct sample_sort
|
||||
for (uint32_t i = 0; i < nthread; ++i)
|
||||
{
|
||||
vfuture[i] = std::async(std::launch::async, &this_t::execute, this);
|
||||
};
|
||||
}
|
||||
for (uint32_t i = 0; i < nthread; ++i)
|
||||
vfuture[i].get();
|
||||
};
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
};
|
||||
// End class sample_sort
|
||||
@@ -259,7 +259,7 @@ sample_sort<Iter_t, Compare>
|
||||
{
|
||||
bss::spinsort<Iter_t, Compare>(first, last, comp);
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
//------------------- check if sort --------------------------------------
|
||||
bool sw = true;
|
||||
@@ -279,7 +279,7 @@ sample_sort<Iter_t, Compare>
|
||||
for (size_t i = 0; i < nelem2; ++i)
|
||||
swap(*(it1++), *(it2--));
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
if (paux != nullptr)
|
||||
{
|
||||
@@ -296,7 +296,7 @@ sample_sort<Iter_t, Compare>
|
||||
if (ptr == nullptr) throw std::bad_alloc();
|
||||
owner = true;
|
||||
global_buf = range_buf(ptr, ptr + nelem);
|
||||
};
|
||||
}
|
||||
//------------------------------------------------------------------------
|
||||
// PROCESS
|
||||
//------------------------------------------------------------------------
|
||||
@@ -306,20 +306,20 @@ sample_sort<Iter_t, Compare>
|
||||
} catch (std::bad_alloc &)
|
||||
{
|
||||
error = true;
|
||||
};
|
||||
}
|
||||
if (not error)
|
||||
{
|
||||
first_merge();
|
||||
construct = true;
|
||||
final_merge();
|
||||
};
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
destroy_all();
|
||||
throw std::bad_alloc();
|
||||
};
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : destroy_all
|
||||
@@ -464,22 +464,22 @@ void sample_sort<Iter_t, Compare>::initial_configuration(void)
|
||||
if (nelem_range != 0)
|
||||
{
|
||||
vv_range_it[k].push_back(vv_range_first[i][k]);
|
||||
};
|
||||
}
|
||||
nelem_interval += nelem_range;
|
||||
};
|
||||
}
|
||||
|
||||
vrange_it_ini.emplace_back(it, it + nelem_interval);
|
||||
vrange_buf_ini.emplace_back(it_buf, it_buf + nelem_interval);
|
||||
|
||||
it += nelem_interval;
|
||||
it_buf += nelem_interval;
|
||||
};
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
//
|
||||
//****************************************************************************
|
||||
}
|
||||
;
|
||||
|
||||
// End namespace sample_detail
|
||||
//****************************************************************************
|
||||
//
|
||||
@@ -505,7 +505,7 @@ void sample_sort(Iter_t first, Iter_t last)
|
||||
{
|
||||
typedef compare_iter<Iter_t> Compare;
|
||||
sample_detail::sample_sort<Iter_t, Compare>(first, last);
|
||||
};
|
||||
}
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : sample_sort
|
||||
@@ -521,7 +521,7 @@ void sample_sort(Iter_t first, Iter_t last, uint32_t nthread)
|
||||
{
|
||||
typedef compare_iter<Iter_t> Compare;
|
||||
sample_detail::sample_sort<Iter_t, Compare>(first, last, nthread);
|
||||
};
|
||||
}
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : sample_sort
|
||||
@@ -537,7 +537,7 @@ template<class Iter_t, class Compare, bscu::enable_if_not_integral<Compare> * =
|
||||
void sample_sort(Iter_t first, Iter_t last, Compare comp)
|
||||
{
|
||||
sample_detail::sample_sort<Iter_t, Compare>(first, last, comp);
|
||||
};
|
||||
}
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : sample_sort
|
||||
@@ -554,11 +554,11 @@ template<class Iter_t, class Compare>
|
||||
void sample_sort(Iter_t first, Iter_t last, Compare comp, uint32_t nthread)
|
||||
{
|
||||
sample_detail::sample_sort<Iter_t, Compare>(first, last, comp, nthread);
|
||||
};
|
||||
}
|
||||
//
|
||||
//****************************************************************************
|
||||
};// End namespace sort
|
||||
};// End namespace boost
|
||||
}// End namespace sort
|
||||
}// End namespace boost
|
||||
//****************************************************************************
|
||||
//
|
||||
#endif
|
||||
|
||||
@@ -134,7 +134,7 @@ static void insert_partial_sort (Iter1_t first, Iter1_t mid, Iter1_t last,
|
||||
*(viter[i - 1] + (i - 1)) = std::move(*(data + (i - 1)));
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : check_stable_sort
|
||||
/// @brief check if the elements between first and last are osted or reverse
|
||||
@@ -222,7 +222,7 @@ static bool check_stable_sort(const range<Iter1_t> &rng_data,
|
||||
};
|
||||
return true;
|
||||
}
|
||||
;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : range_sort
|
||||
/// @brief this function divide r_input in two parts, sort it,and merge moving
|
||||
@@ -297,7 +297,7 @@ static void range_sort(const range<Iter1_t> &range1,
|
||||
|
||||
merge(range2, range_input1, range_input2, comp);
|
||||
}
|
||||
;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : sort_range_sort
|
||||
/// @brief this sort elements using the range_sort function and receiving a
|
||||
@@ -349,7 +349,7 @@ static void sort_range_sort(const range<Iter1_t> &rng_data,
|
||||
move_forward(rng_data, rng_buffer);
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
//
|
||||
//############################################################################
|
||||
// ##
|
||||
@@ -423,6 +423,7 @@ public:
|
||||
if (owner and ptr != nullptr) std::free (ptr);
|
||||
};
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// End of class spinsort
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -532,10 +533,10 @@ spinsort <Iter_t, Compare>
|
||||
range_sort(range_1, range_2, comp, nlevel);
|
||||
merge_half(range_input, range_aux, range_2, comp);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
//****************************************************************************
|
||||
};// End namepspace spin_detail
|
||||
}// End namepspace spin_detail
|
||||
//****************************************************************************
|
||||
//
|
||||
namespace bsc = boost::sort::common;
|
||||
@@ -552,7 +553,7 @@ template <class Iter_t, class Compare = compare_iter<Iter_t>>
|
||||
inline void spinsort (Iter_t first, Iter_t last, Compare comp = Compare())
|
||||
{
|
||||
spin_detail::spinsort <Iter_t, Compare> (first, last, comp);
|
||||
};
|
||||
}
|
||||
|
||||
template <class Iter_t, class Compare = compare_iter<Iter_t>>
|
||||
inline void indirect_spinsort (Iter_t first, Iter_t last,
|
||||
@@ -561,11 +562,11 @@ inline void indirect_spinsort (Iter_t first, Iter_t last,
|
||||
typedef typename std::vector<Iter_t>::iterator itx_iter;
|
||||
typedef common::less_ptr_no_null <Iter_t, Compare> itx_comp;
|
||||
common::indirect_sort (spinsort<itx_iter, itx_comp>, first, last, comp);
|
||||
};
|
||||
}
|
||||
|
||||
//****************************************************************************
|
||||
};// End namespace sort
|
||||
};// End namepspace boost
|
||||
}// End namespace sort
|
||||
}// End namepspace boost
|
||||
//****************************************************************************
|
||||
//
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user