2
0
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:
Nigel Stewart
2023-08-26 16:48:00 +10:00
parent 457ab17ef3
commit df2e184e14
14 changed files with 230 additions and 230 deletions

View File

@@ -107,7 +107,7 @@ struct backbone
block_t get_block (size_t pos) const
{
return block_t (global_range.first + (pos * Block_size));
};
}
//-------------------------------------------------------------------------
// function : get_range
/// @brief obtain the range in the position pos
@@ -120,7 +120,7 @@ struct backbone
Iter_t it2 =
(pos == (nblock - 1)) ? global_range.last : it1 + Block_size;
return range_it (it1, it2);
};
}
//-------------------------------------------------------------------------
// function : get_range_buf
/// @brief obtain the auxiliary buffer of the thread
@@ -128,7 +128,7 @@ struct backbone
range_buf get_range_buf ( ) const
{
return range_buf (buf, buf + Block_size);
};
}
//-------------------------------------------------------------------------
// function : exec
@@ -144,7 +144,7 @@ struct backbone
{
buf = ptr_buf;
exec (counter);
};
}
void exec (atomic_t &counter);
@@ -192,7 +192,7 @@ backbone< Block_size, Iter_t, Compare >
range_tail.first =
(ntail == 0) ? last : (first + ((nblock - 1) * Block_size));
range_tail.last = last;
};
}
//
//-------------------------------------------------------------------------
// function : exec
@@ -208,12 +208,12 @@ void backbone< Block_size, Iter_t, Compare >::exec (atomic_t &counter)
{
if (works.pop_move_back (func_exec)) func_exec ( );
else std::this_thread::yield ( );
};
};
}
}
//
//****************************************************************************
}; // End namespace blk_detail
}; // End namespace sort
}; // End namespace boost
} // End namespace blk_detail
} // End namespace sort
} // End namespace boost
//****************************************************************************
#endif

View File

@@ -44,7 +44,7 @@ class block_pos
public:
//----------------------------- FUNCTIONS ------------------------------
block_pos (void) : num (0){};
block_pos (void) : num (0){}
//
//-------------------------------------------------------------------------
// function : block_pos
@@ -55,35 +55,35 @@ class block_pos
block_pos (size_t position, bool side = false)
{
num = (position << 1) + ((side) ? 1 : 0);
};
}
//
//-------------------------------------------------------------------------
// function : pos
/// @brief obtain the position stored inside the block_pos
/// @return position
//-------------------------------------------------------------------------
size_t pos (void) const { return (num >> 1); };
size_t pos (void) const { return (num >> 1); }
//
//-------------------------------------------------------------------------
// function : pos
/// @brief store a position inside the block_pos
/// @param position : value to store
//-------------------------------------------------------------------------
void set_pos (size_t position) { num = (position << 1) + (num & 1); };
void set_pos (size_t position) { num = (position << 1) + (num & 1); }
//
//-------------------------------------------------------------------------
// function : side
/// @brief obtain the side stored inside the block_pos
/// @return bool value
//-------------------------------------------------------------------------
bool side (void) const { return ((num & 1) != 0); };
bool side (void) const { return ((num & 1) != 0); }
//
//-------------------------------------------------------------------------
// function : side
/// @brief store a bool value the block_pos
/// @param sd : bool value to store
//-------------------------------------------------------------------------
void set_side (bool sd) { num = (num & ~1) + ((sd) ? 1 : 0); };
void set_side (bool sd) { num = (num & ~1) + ((sd) ? 1 : 0); }
}; // end struct block_pos
//
@@ -105,7 +105,7 @@ struct block
/// @brief constructor from an iterator to the first element of the block
/// @param it : iterator to the first element of the block
//-------------------------------------------------------------------------
block (Iter_t it) : first (it){};
block (Iter_t it) : first (it){}
//-------------------------------------------------------------------------
// function : get_range
@@ -115,7 +115,7 @@ struct block
range< Iter_t > get_range (void)
{
return range_it (first, first + Block_size);
};
}
}; // end struct block
@@ -133,7 +133,7 @@ bool compare_block (block< Block_size, Iter_t > block1,
Compare cmp = Compare ( ))
{
return cmp (*block1.first, *block2.first);
};
}
//
///---------------------------------------------------------------------------
/// @struct compare_block_pos
@@ -155,7 +155,7 @@ struct compare_block_pos
/// @param cmp : comparison operator
//-------------------------------------------------------------------------
compare_block_pos (Iter_t g_first, Compare cmp)
: global_first (g_first), comp (cmp){};
: global_first (g_first), comp (cmp){}
//
//-------------------------------------------------------------------------
// function : operator ()
@@ -168,14 +168,14 @@ struct compare_block_pos
{
return comp (*(global_first + (block_pos1.pos ( ) * Block_size)),
*(global_first + (block_pos2.pos ( ) * Block_size)));
};
}
}; // end struct compare_block_pos
//****************************************************************************
}; // End namespace blk_detail
}; // End namespace sort
}; // End namespace boost
} // End namespace blk_detail
} // End namespace sort
} // End namespace boost
//****************************************************************************
//
#endif

View File

@@ -108,7 +108,7 @@ struct merge_blocks
catch (std::bad_alloc &)
{
error = true;
};
}
}
bscu::atomic_sub (counter, 1);
};
@@ -143,7 +143,7 @@ struct merge_blocks
catch (std::bad_alloc &)
{
error = true;
};
}
}
bscu::atomic_sub (counter, 1);
};
@@ -195,12 +195,12 @@ merge_blocks<Block_size, Group_size, Iter_t, Compare>
for (size_t i = pos_index1; i < pos_index2; ++i)
{
vpos1.emplace_back(bk.index[i].pos(), true);
};
}
for (size_t i = pos_index2; i < pos_index3; ++i)
{
vpos2.emplace_back(bk.index[i].pos(), false);
};
}
//-------------------------------------------------------------------
// tail process
//-------------------------------------------------------------------
@@ -210,7 +210,7 @@ merge_blocks<Block_size, Group_size, Iter_t, Compare>
tail_process(vpos1, vpos2);
nblock1 = vpos1.size();
nblock2 = vpos2.size();
};
}
compare_block_pos_t cmp_blk(bk.global_range.first, bk.cmp);
if (bk.error) return;
@@ -256,9 +256,9 @@ void merge_blocks<Block_size, Group_size, Iter_t, Compare>
{
vblkpos2.emplace_back(posback1, false);
vblkpos1.pop_back();
};
};
};
}
}
}
}
//
@@ -278,7 +278,7 @@ void merge_blocks<Block_size, Group_size, Iter_t, Compare>
{
merge_range_pos(rng_input);
return;
};
}
atomic_t counter(0);
size_t npart = (rng_input.size() + Group_size - 1) / Group_size;
@@ -294,7 +294,7 @@ void merge_blocks<Block_size, Group_size, Iter_t, Compare>
and bk.index[pos - 1].side() == bk.index[pos].side())
{
++pos;
};
}
if (pos < pos_last)
{
merge_uncontiguous(bk.get_range(bk.index[pos - 1].pos()),
@@ -306,9 +306,9 @@ void merge_blocks<Block_size, Group_size, Iter_t, Compare>
{
range_pos rng_aux(pos_ini, pos);
function_merge_range_pos(rng_aux, counter, bk.error);
};
}
pos_ini = pos;
};
}
bk.exec(counter); // wait until finish all the ranges
}
@@ -337,7 +337,7 @@ void merge_blocks<Block_size, Group_size, Iter_t, Compare>
bsc::merge_flow(rng_prev, rbuf, rng_posx, bk.cmp);
rng_prev = rng_posx;
};
}
move_forward(rng_posx, rbuf);
}
//
@@ -384,7 +384,7 @@ void merge_blocks<Block_size, Group_size, Iter_t, Compare>
side_posx = bp_posx.side();
mergeable = (side_max != side_posx
and is_mergeable(rng_max, rng_posx, bk.cmp));
};
}
if (bk.error) return;
if (final or not mergeable)
{
@@ -398,14 +398,14 @@ void merge_blocks<Block_size, Group_size, Iter_t, Compare>
else
{
function_merge_range_pos(rp_final, counter, bk.error);
};
};
}
}
posx_ini = posx;
if (not final)
{
rng_max = rng_posx;
side_max = side_posx;
};
}
}
else
{
@@ -413,16 +413,16 @@ void merge_blocks<Block_size, Group_size, Iter_t, Compare>
{
rng_max = rng_posx;
side_max = side_posx;
};
};
};
}
}
}
bk.exec(counter);
}
//
//****************************************************************************
}; // End namespace blk_detail
}; // End namespace sort
}; // End namespace boost
} // End namespace blk_detail
} // End namespace sort
} // End namespace boost
//****************************************************************************
//
#endif

View File

@@ -95,7 +95,7 @@ struct move_blocks
catch (std::bad_alloc &)
{
error = true;
};
}
}
bscu::atomic_sub (counter, 1);
};
@@ -130,13 +130,13 @@ struct move_blocks
catch (std::bad_alloc &)
{
error = true;
};
}
}
bscu::atomic_sub (counter, 1);
};
bk.works.emplace_back(f1);
}
;
//---------------------------------------------------------------------------
}; // end of struct move_blocks
//---------------------------------------------------------------------------
@@ -172,7 +172,7 @@ move_blocks<Block_size, Group_size, Iter_t, Compare>
and bk.index[pos_index_ini].pos() == pos_index_ini)
{
++pos_index_ini;
};
}
if (pos_index_ini == bk.index.size()) break;
@@ -187,7 +187,7 @@ move_blocks<Block_size, Group_size, Iter_t, Compare>
bk.index[pos_index_dest].set_pos(pos_index_dest);
pos_index_dest = pos_index_src;
};
}
bk.index[pos_index_dest].set_pos(pos_index_dest);
vsequence.push_back(sequence);
@@ -199,8 +199,8 @@ move_blocks<Block_size, Group_size, Iter_t, Compare>
else
{
function_move_long_sequence(vsequence.back(), counter, bk.error);
};
};
}
}
bk.exec(counter);
}
;
@@ -228,9 +228,9 @@ void move_blocks<Block_size, Group_size, Iter_t, Compare>
range_it range1(range2);
range2 = bk.get_range(pos_range2);
move_forward(range1, range2);
};
}
move_forward(range2, rbuf);
};
}
//
//-------------------------------------------------------------------------
// function : move_long_sequence
@@ -264,7 +264,7 @@ void move_blocks<Block_size, Group_size, Iter_t, Compare>
sequence.assign(it_pos, it_pos + size_part);
index_seq.emplace_back(*(it_pos + size_part - 1));
function_move_sequence(sequence, son_counter, bk.error);
};
}
sequence.assign(it_pos, init_sequence.end());
index_seq.emplace_back(init_sequence.back());
@@ -277,9 +277,9 @@ void move_blocks<Block_size, Group_size, Iter_t, Compare>
//
//****************************************************************************
}; // End namespace blk_detail
}; // End namespace sort
}; // End namespace boost
} // End namespace blk_detail
} // End namespace sort
} // End namespace boost
//****************************************************************************
//
#endif

View File

@@ -103,12 +103,12 @@ struct parallel_sort
catch (std::bad_alloc &)
{
error = true;
};
};
}
}
bscu::atomic_sub (counter, 1);
};
bk.works.emplace_back(f1);
};
}
//--------------------------------------------------------------------------
};// end struct parallel_sort
@@ -156,7 +156,7 @@ parallel_sort<Block_size, Iter_t, Compare>
for (size_t i = 0; i < nelem2; ++i)
swap(*(it1++), *(it2--));
return;
};
}
//-------------------max_per_thread ---------------------------
uint32_t nbits_size = (nbits64(sizeof(value_t))) >> 1;
@@ -170,12 +170,12 @@ parallel_sort<Block_size, Iter_t, Compare>
{
pdqsort(first, last, bk.cmp);
return;
};
}
if (not bk.error) divide_sort(first, last, level);
// wait until all the parts are finished
bk.exec(counter);
};
}
//------------------------------------------------------------------------
// function : divide_sort
@@ -201,7 +201,7 @@ void parallel_sort<Block_size, Iter_t, Compare>
if (level == 0 or nelem < (max_per_thread))
{
return pdqsort(first, last, bk.cmp);
};
}
//-------------------- pivoting ----------------------------------
pivot9(first, last, bk.cmp);
@@ -218,7 +218,7 @@ void parallel_sort<Block_size, Iter_t, Compare>
++c_first;
while (bk.cmp(val, *c_last))
--c_last;
};
}
swap(*first, *c_last);
@@ -228,12 +228,12 @@ void parallel_sort<Block_size, Iter_t, Compare>
// The first half is done by the same thread
function_divide_sort(first, c_last, level - 1, counter, bk.error);
};
}
//
//****************************************************************************
};// End namespace blk_detail
};// End namespace sort
};// End namespace boost
} // End namespace blk_detail
} // End namespace sort
} // End namespace boost
//****************************************************************************
//
#endif

View File

@@ -144,10 +144,10 @@ struct block_indirect_sort
{
destroy(rglobal_buf);
construct = false;
};
}
std::free (ptr);
ptr = nullptr;
};
}
}
//
//------------------------------------------------------------------------
@@ -218,9 +218,9 @@ block_indirect_sort<Block_size, Group_size, Iter_t, Compare>
{
using std::swap;
swap(*(it1++), *(it2--));
};
}
return;
};
}
//---------------- check if only single thread -----------------------
size_t nthreadmax = nelem / (Block_size * Group_size) + 1;
@@ -235,7 +235,7 @@ block_indirect_sort<Block_size, Group_size, Iter_t, Compare>
//intro_sort (first, last, bk.cmp);
pdqsort(first, last, bk.cmp);
return;
};
}
//----------- creation of the temporary buffer --------------------
ptr = reinterpret_cast <value_t*>
@@ -244,7 +244,7 @@ block_indirect_sort<Block_size, Group_size, Iter_t, Compare>
{
bk.error = true;
throw std::bad_alloc();
};
}
rglobal_buf = range_buf(ptr, ptr + (Block_size * nthread));
initialize(rglobal_buf, *first);
@@ -255,7 +255,7 @@ block_indirect_sort<Block_size, Group_size, Iter_t, Compare>
for (uint32_t i = 0; i < nthread; ++i)
{
vbuf[i] = ptr + (i * Block_size);
};
}
// Insert the first work in the stack
bscu::atomic_write(counter, 1);
@@ -280,7 +280,7 @@ block_indirect_sort<Block_size, Group_size, Iter_t, Compare>
auto f1 = [&vbuf,i, this]( )
{ bk.exec (vbuf[i], this->counter);};
vfuture[i] = std::async(std::launch::async, f1);
};
}
for (uint32_t i = 0; i < nthread; ++i)
vfuture[i].get();
if (bk.error) throw std::bad_alloc();
@@ -290,7 +290,7 @@ block_indirect_sort<Block_size, Group_size, Iter_t, Compare>
destroy_all();
throw;
}
};
}
//
//-----------------------------------------------------------------------------
// function : split_rage
@@ -317,7 +317,7 @@ void block_indirect_sort<Block_size, Group_size, Iter_t, Compare>
{
pdqsort(first, last, bk.cmp);
return;
};
}
size_t pos_index_mid = pos_index1 + (nblock >> 1);
atomic_t son_counter(1);
@@ -349,11 +349,11 @@ void block_indirect_sort<Block_size, Group_size, Iter_t, Compare>
bk.works.emplace_back(f1);
if (bk.error) return;
parallel_sort_t(bk, first, mid);
};
}
bk.exec(son_counter);
if (bk.error) return;
merge_blocks_t(bk, pos_index1, pos_index_mid, pos_index2);
};
}
//
//-----------------------------------------------------------------------------
@@ -375,8 +375,8 @@ void block_indirect_sort<Block_size, Group_size, Iter_t, Compare>
split_range(0, bk.nblock, level_thread - 1);
if (bk.error) return;
move_blocks_t k(bk);
};
};
}
}
///---------------------------------------------------------------------------
// function block_indirect_sort_call
@@ -390,7 +390,7 @@ inline void block_indirect_sort_call(Iter_t first, Iter_t last, Compare cmp,
uint32_t nthr)
{
block_indirect_sort<128, 128, Iter_t, Compare>(first, last, cmp, nthr);
};
}
template<size_t Size>
struct block_size
@@ -415,11 +415,11 @@ inline void block_indirect_sort_call (Iter_t first, Iter_t last, Compare cmp,
{
block_indirect_sort<block_size<sizeof (value_iter<Iter_t> )>::data, 64,
Iter_t, Compare> (first, last, cmp, nthr);
};
}
//
//****************************************************************************
}; // End namespace blk_detail
} // End namespace blk_detail
//****************************************************************************
//
namespace bscu = boost::sort::common::util;
@@ -503,8 +503,8 @@ void block_indirect_sort (Iter_t first, Iter_t last, Compare comp,
}
//
//****************************************************************************
}; // End namespace sort
}; // End namespace boost
} // End namespace sort
} // End namespace boost
//****************************************************************************
//
#endif

View File

@@ -73,7 +73,7 @@ public:
// function : stack_cnc
/// @brief constructor
//-------------------------------------------------------------------------
explicit stack_cnc(void): v_t() { };
explicit stack_cnc(void): v_t() { }
//
//-------------------------------------------------------------------------
@@ -86,7 +86,7 @@ public:
// function : ~stack_cnc
/// @brief Destructor
//-------------------------------------------------------------------------
virtual ~stack_cnc(void) { v_t.clear(); };
virtual ~stack_cnc(void) { v_t.clear(); }
//-------------------------------------------------------------------------
// function : emplace_back
@@ -137,8 +137,8 @@ public:
// end class stack_cnc
//***************************************************************************
};// end namespace common
};// end namespace sort
};// end namespace boost
} // end namespace common
} // end namespace sort
} // end namespace boost
//***************************************************************************
#endif

View File

@@ -144,7 +144,7 @@ template <class Value_t, class ... Args>
inline void construct_object (Value_t *ptr, Args &&... args)
{
(::new (static_cast<void *>(ptr)) Value_t(std::forward< Args > (args)...));
};
}
//
//-----------------------------------------------------------------------------
// function : destroy_object
@@ -155,7 +155,7 @@ template<class Value_t>
inline void destroy_object(Value_t *ptr)
{
ptr->~Value_t();
};
}
//
//-----------------------------------------------------------------------------
// function : initialize
@@ -185,9 +185,9 @@ inline void initialize (Iter_t first, Iter_t last, Value_t & val)
while (it2 != last)
{
construct_object(&(*(it2++)), std::move(*(it1++)));
};
}
val = std::move(*(last - 1));
};
}
//
//-----------------------------------------------------------------------------
// function : move_forward
@@ -216,8 +216,8 @@ inline Iter2_t move_forward (Iter2_t it_dest, Iter1_t first, Iter1_t last)
{ *it_dest++ = std::move(*first++);
}
return it_dest;
}
};
//
//-----------------------------------------------------------------------------
// function : move_backard
@@ -244,7 +244,7 @@ inline Iter2_t move_backward(Iter2_t it_dest, Iter1_t first, Iter1_t last)
{ *(--it_dest) = std::move (*(--last));
}
return it_dest;
};
}
//
//-----------------------------------------------------------------------------
@@ -271,9 +271,9 @@ inline Value_t * move_construct(Value_t *ptr, Iter_t first, Iter_t last)
while (first != last)
{
::new (static_cast<void *>(ptr++)) Value_t(std::move(*(first++)));
};
}
return ptr;
};
}
//
//-----------------------------------------------------------------------------
// function : destroy
@@ -286,7 +286,7 @@ inline void destroy(Iter_t first, const Iter_t last)
{
while (first != last)
destroy_object(&(*(first++)));
};
}
//
//-----------------------------------------------------------------------------
// function : reverse
@@ -298,13 +298,13 @@ template<class Iter_t>
inline void reverse(Iter_t first, Iter_t last)
{
std::reverse ( first, last);
};
}
//
//****************************************************************************
};// End namespace util
};// End namespace common
};// End namespace sort
};// End namespace boost
} // End namespace util
} // End namespace common
} // End namespace sort
} // End namespace boost
//****************************************************************************
//
#endif

View File

@@ -35,7 +35,7 @@ template<typename T>
inline T atomic_read(std::atomic<T> &at_var)
{
return std::atomic_load_explicit < T > (&at_var, std::memory_order_acquire);
};
}
//
//-----------------------------------------------------------------------------
// function : atomic_add
@@ -50,7 +50,7 @@ inline T atomic_add(std::atomic<T> &at_var, T2 num)
static_assert (std::is_integral< T2 >::value, "Bad parameter");
return std::atomic_fetch_add_explicit <T>
(&at_var, (T) num, std::memory_order_acq_rel);
};
}
//
//-----------------------------------------------------------------------------
// function : atomic_sub
@@ -65,7 +65,7 @@ inline T atomic_sub(std::atomic<T> &at_var, T2 num)
static_assert (std::is_integral< T2 >::value, "Bad parameter");
return std::atomic_fetch_sub_explicit <T>
(&at_var, (T) num, std::memory_order_acq_rel);
};
}
//
//-----------------------------------------------------------------------------
// function : atomic_write
@@ -79,21 +79,21 @@ inline void atomic_write(std::atomic<T> &at_var, T2 num)
static_assert (std::is_integral< T2 >::value, "Bad parameter");
std::atomic_store_explicit <T>
(&at_var, (T) num, std::memory_order_release);
};
}
template<typename T>
struct counter_guard
{
typedef std::atomic<T> atomic_t;
atomic_t &count;
counter_guard(atomic_t & counter): count(counter) { };
~counter_guard() {atomic_sub(count, 1); };
counter_guard(atomic_t & counter): count(counter) { }
~counter_guard() {atomic_sub(count, 1); }
};
//
//****************************************************************************
};// End namespace util
};// End namespace common
};// End namespace sort
};// End namespace boost
} // End namespace util
} // End namespace common
} // End namespace sort
} // End namespace boost
//****************************************************************************
#endif

View File

@@ -73,7 +73,7 @@ struct circular_buffer
{
ptr = static_cast <Value_t*> (std::malloc (NMAX * sizeof(Value_t)));
if (ptr == nullptr) throw std::bad_alloc();
};
}
//
//------------------------------------------------------------------------
// function : ~circular_buffer
@@ -84,7 +84,7 @@ struct circular_buffer
if (initialized)
{ for (size_t i = 0; i < NMAX; ++i) (ptr + i)->~Value_t();
initialized = false;
};
}
std::free(static_cast <void*> (ptr));
}
;
@@ -103,61 +103,61 @@ struct circular_buffer
::new (static_cast<void*>(ptr + i)) Value_t(std::move(ptr[i - 1]));
val = std::move(ptr[NMAX - 1]);
initialized = true;
};
}
//
//------------------------------------------------------------------------
// function : destroy_all
/// @brief : destroy all the objects in the internal memory
//-----------------------------------------------------------------------
void destroy_all(void) { destroy(ptr, ptr + NMAX); };
void destroy_all(void) { destroy(ptr, ptr + NMAX); }
//
//------------------------------------------------------------------------
// function : get_buffer
/// @brief return the internal memory of the circular buffer
/// @return pointer to the internal memory of the buffer
//-----------------------------------------------------------------------
Value_t * get_buffer(void) { return ptr; };
Value_t * get_buffer(void) { return ptr; }
//
//------------------------------------------------------------------------
// function : empty
/// @brief return if the buffer is empty
/// @return true : empty
//-----------------------------------------------------------------------
bool empty(void) const {return (nelem == 0); };
bool empty(void) const {return (nelem == 0); }
//
//------------------------------------------------------------------------
// function : full
/// @brief return if the buffer is full
/// @return true : full
//-----------------------------------------------------------------------
bool full(void) const { return (nelem == NMAX); };
bool full(void) const { return (nelem == NMAX); }
//
//------------------------------------------------------------------------
// function : size
/// @brief return the number of elements stored in the buffer
/// @return number of elements stored
//-----------------------------------------------------------------------
size_t size(void) const { return nelem;};
size_t size(void) const { return nelem;}
//
//------------------------------------------------------------------------
// function : capacity
/// @brief : return the maximun capacity of the buffer
/// @return number of elements
//-----------------------------------------------------------------------
size_t capacity(void) const { return NMAX;};
size_t capacity(void) const { return NMAX;}
//
//------------------------------------------------------------------------
// function : free_size
/// @brief return the free positions in the buffer
/// @return number of elements
//-----------------------------------------------------------------------
size_t free_size(void) const { return (NMAX - nelem); };
size_t free_size(void) const { return (NMAX - nelem); }
//
//------------------------------------------------------------------------
// function : clear
/// @brief clear the buffer
//-----------------------------------------------------------------------
void clear(void) { nelem = first_pos = 0; };
void clear(void) { nelem = first_pos = 0; }
//
//------------------------------------------------------------------------
// function : front
@@ -170,7 +170,7 @@ struct circular_buffer
assert (nelem > 0);
#endif
return (ptr[first_pos]);
};
}
//
//------------------------------------------------------------------------
// function :front
@@ -183,7 +183,7 @@ struct circular_buffer
assert ( nelem > 0 );
#endif
return (ptr[first_pos]);
};
}
//
//------------------------------------------------------------------------
// function : back
@@ -196,7 +196,7 @@ struct circular_buffer
assert ( nelem > 0 );
#endif
return (ptr[(first_pos + nelem - 1) & MASK]);
};
}
//
//------------------------------------------------------------------------
// function : back
@@ -209,7 +209,7 @@ struct circular_buffer
assert ( nelem > 0 );
#endif
return (ptr[(first_pos + nelem - 1) & MASK]);
};
}
//
//------------------------------------------------------------------------
// function : operator []
@@ -223,7 +223,7 @@ struct circular_buffer
assert ( nelem > 0 );
#endif
return ptr[(first_pos + pos) & MASK];
};
}
//
//------------------------------------------------------------------------
// function : operator []
@@ -238,7 +238,7 @@ struct circular_buffer
assert ( nelem > 0 );
#endif
return ptr[(first_pos + pos) & MASK];
};
}
//
//------------------------------------------------------------------------
// function : push_front
@@ -254,7 +254,7 @@ struct circular_buffer
first_pos = ((first_pos + MASK) & MASK);
ptr[first_pos] = val;
};
}
//
//------------------------------------------------------------------------
// function : push_front
@@ -269,7 +269,7 @@ struct circular_buffer
++nelem;
first_pos = ((first_pos + MASK) & MASK);
ptr[first_pos] = val;
};
}
//
//------------------------------------------------------------------------
// function : push_back
@@ -282,7 +282,7 @@ struct circular_buffer
assert ( nelem != NMAX);
#endif
ptr[(first_pos + (nelem++)) & MASK] = val;
};
}
//
//------------------------------------------------------------------------
// function : push_back
@@ -295,7 +295,7 @@ struct circular_buffer
assert ( nelem != NMAX);
#endif
ptr[(first_pos + (nelem++)) & MASK] = std::move(val);
};
}
//
//------------------------------------------------------------------------
// function : pop_front
@@ -308,7 +308,7 @@ struct circular_buffer
#endif
--nelem;
(++first_pos) &= MASK;
};
}
//
//------------------------------------------------------------------------
// function : pop_back
@@ -320,7 +320,7 @@ struct circular_buffer
assert ( nelem > 0 );
#endif
--nelem;
};
}
template<class iter_t>
void pop_copy_front(iter_t it_dest, size_t num);
@@ -380,9 +380,9 @@ void circular_buffer<Value_t, Power2>
for (size_t i = 0; i < num; ++i)
{
*(it_dest++) = ptr[pos++ & MASK];
};
}
first_pos &= MASK;
};
}
//
//------------------------------------------------------------------------
// function : pop_move_front
@@ -408,9 +408,9 @@ void circular_buffer<Value_t, Power2>
for (size_t i = 0; i < num; ++i)
{
*(it_dest++) = std::move(ptr[pos++ & MASK]);
};
}
first_pos &= MASK;
};
}
//
//------------------------------------------------------------------------
// function : pop_copy_back
@@ -434,8 +434,8 @@ void circular_buffer<Value_t, Power2>
for (size_t i = 0; i < num; ++i)
{
*(it_dest++) = ptr[pos++ & MASK];
};
};
}
}
//
//------------------------------------------------------------------------
// function : pop_move_back
@@ -459,8 +459,8 @@ void circular_buffer<Value_t, Power2>
for (size_t i = 0; i < num; ++i)
{
*(it_dest++) = std::move(ptr[pos++ & MASK]);
};
};
}
}
//
//------------------------------------------------------------------------
// function : push_copy_front
@@ -486,8 +486,8 @@ void circular_buffer<Value_t, Power2>
for (size_t i = 0; i < num; ++i)
{
ptr[(pos++) & MASK] = *(it_src++);
};
};
}
}
//
//------------------------------------------------------------------------
// function : push_move_front
@@ -511,8 +511,8 @@ void circular_buffer<Value_t, Power2>
for (size_t i = 0; i < num; ++i)
{
ptr[(pos++) & MASK] = std::move(*(it_src++));
};
};
}
}
//
//------------------------------------------------------------------------
// function : push_copy_back
@@ -536,8 +536,8 @@ void circular_buffer<Value_t, Power2>
for (size_t i = 0; i < num; ++i)
{
ptr[(pos++) & MASK] = *(it_src++);
};
};
}
}
//
//------------------------------------------------------------------------
// function : push_move_back
@@ -561,13 +561,13 @@ void circular_buffer<Value_t, Power2>
for (size_t i = 0; i < num; ++i)
{
ptr[(pos++) & MASK] = std::move(*(it_src++));
};
};
}
}
//****************************************************************************
};// End namespace util
};// End namespace common
};// End namespace sort
};// End namespace boost
} // End namespace util
} // End namespace common
} // End namespace sort
} // End namespace boost
//****************************************************************************
#endif

View File

@@ -91,8 +91,8 @@ static void insert_sorted(Iter1_t first, Iter1_t mid, Iter1_t last,
mv_first = std::upper_bound(first, mv_last, it_aux[i - 1], comp);
Iter1_t it1 = here::move_backward(mv_last + i, mv_first, mv_last);
*(it1 - 1) = std::move(it_aux[i - 1]);
};
};
}
}
template<class Iter1_t, class Iter2_t, typename Compare>
static void insert_sorted_backward(Iter1_t first, Iter1_t mid, Iter1_t last,
@@ -128,15 +128,15 @@ static void insert_sorted_backward(Iter1_t first, Iter1_t mid, Iter1_t last,
mv_last = std::lower_bound(mv_first, last, it_aux[i], comp);
Iter1_t it1 = move_forward(mv_first - (ndata - i), mv_first, mv_last);
*(it1) = std::move(it_aux[i]);
};
}
};
}
//
//****************************************************************************
};// End namespace util
};// End namepspace common
};// End namespace sort
};// End namepspace boost
} // End namespace util
} // End namepspace common
} // End namespace sort
} // End namepspace boost
//****************************************************************************
//
#endif

View File

@@ -110,19 +110,19 @@ static Iter3_t merge(Iter1_t buf1, const Iter1_t end_buf1, Iter2_t buf2,
{
Iter3_t mid = move_forward(buf_out, buf1, end_buf1);
return move_forward(mid, buf2, end_buf2);
};
}
if (comp(*(end_buf2 - 1), *buf1))
{
Iter3_t mid = move_forward(buf_out, buf2, end_buf2);
return move_forward(mid, buf1, end_buf1);
};
};
}
}
while ((buf1 != end_buf1) && (buf2 != end_buf2))
{
*(buf_out++) = (! comp(*buf2, *buf1)) ?
std::move(*(buf1++)) : std::move(*(buf2++));
};
}
return (buf1 == end_buf1) ?
move_forward(buf_out, buf2, end_buf2) :
@@ -171,25 +171,25 @@ static Value_t *merge_construct(Iter1_t first1, const Iter1_t last1,
{
Value_t* mid = move_construct(it_out, first1, last1);
return move_construct(mid, first2, last2);
};
}
if (comp(*(last2 - 1), *first1))
{
Value_t* mid = move_construct(it_out, first2, last2);
return move_construct(mid, first1, last1);
};
};
}
}
while (first1 != last1 && first2 != last2)
{
construct_object((it_out++),
(! comp(*first2, *first1)) ?
std::move(*(first1++)) :
std::move(*(first2++)));
};
}
return (first1 == last1) ?
move_construct(it_out, first2, last2) :
move_construct(it_out, first1, last1);
};
}
//
//---------------------------------------------------------------------------
// function : merge_half
@@ -235,21 +235,21 @@ static Iter2_t merge_half(Iter1_t buf1, const Iter1_t end_buf1, Iter2_t buf2,
{
move_forward(buf_out, buf1, end_buf1);
return end_buf2;
};
}
if (comp(*(end_buf2 - 1), *buf1))
{
Iter2_t mid = move_forward(buf_out, buf2, end_buf2);
return move_forward(mid, buf1, end_buf1);
};
};
}
}
while ((buf1 != end_buf1) && (buf2 != end_buf2))
{
*(buf_out++) = (! comp(*buf2, *buf1)) ?
std::move(*(buf1++)) : std::move(*(buf2++));
};
}
return (buf2 == end_buf2)? move_forward(buf_out, buf1, end_buf1) : end_buf2;
};
}
//
//---------------------------------------------------------------------------
@@ -298,24 +298,24 @@ static Iter2_t merge_half_backward(Iter1_t buf1, Iter1_t end_buf1, Iter2_t buf2,
{
here::move_backward(end_buf_out, buf2, end_buf2);
return buf1;
};
}
if (comp(*(end_buf2 - 1), *buf1))
{
Iter1_t mid = here::move_backward(end_buf_out, buf1, end_buf1);
return here::move_backward(mid, buf2, end_buf2);
};
};
}
}
while ((buf1 != end_buf1) && (buf2 != end_buf2))
{
*(--end_buf_out) =
(! comp(*(end_buf2 - 1), *(end_buf1 - 1))) ?
std::move(*(--end_buf2)):
std::move(*(--end_buf1));
};
}
return (buf1 == end_buf1) ?
here::move_backward(end_buf_out, buf2, end_buf2) : buf1;
};
}
//
//-----------------------------------------------------------------------------
@@ -375,9 +375,9 @@ static bool merge_uncontiguous(Iter1_t src1, const Iter1_t end_src1,
else
{
merge_half(aux, end_aux, src2, end_src2, src2_first, comp);
};
}
return false;
};
}
//
//-----------------------------------------------------------------------------
@@ -421,7 +421,7 @@ static bool merge_contiguous(Iter1_t src1, Iter1_t src2, Iter1_t end_src2,
move_forward(buf, src1, end_src1);
merge_half(buf, buf + nx, src2, end_src2, src1, comp);
return false;
};
}
//
//-----------------------------------------------------------------------------
// function : merge_circular
@@ -465,7 +465,7 @@ static bool merge_circular(Iter1_t buf1, Iter1_t end_buf1, Iter2_t buf2,
it1_out = end_buf1;
it2_out = buf2;
return true;
};
}
if (comp(*(end_buf2 - 1), *buf1))
{
circ.push_move_back(buf2, (end_buf2 - buf2));
@@ -477,18 +477,18 @@ static bool merge_circular(Iter1_t buf1, Iter1_t end_buf1, Iter2_t buf2,
{
circ.push_back(comp(*buf2, *buf1) ? std::move(*(buf2++))
: std::move(*(buf1++)));
};
}
it2_out = buf2;
it1_out = buf1;
bool ret = (buf1 == end_buf1);
return ret;
};
}
//
//****************************************************************************
};// End namespace util
};// End namespace common
};// End namespace sort
};// End namespace boost
} // End namespace util
} // End namespace common
} // End namespace sort
} // End namespace boost
//****************************************************************************
//
#endif

View File

@@ -30,7 +30,7 @@ struct filter_pass
const key & operator()(const T & val) const
{
return val;
};
}
};
//
@@ -79,9 +79,9 @@ inline Iter_t internal_find_first(Iter_t first, Iter_t last,
if (comp(flt(*it_out), val))
LI = it_out + 1;
else LS = it_out;
};
}
return LS;
};
}
//
//-----------------------------------------------------------------------------
// function : internal_find_last
@@ -112,9 +112,9 @@ inline Iter_t internal_find_last(Iter_t first, Iter_t last,
it_out = LI + ((LS - LI + 1) >> 1);
if (comp(val, flt(*it_out))) LS = it_out - 1;
else LI = it_out;
};
}
return LS;
};
}
//
//###########################################################################
@@ -149,7 +149,7 @@ inline Iter_t find_first(Iter_t first, Iter_t last,
if (first == last) return last;
Iter_t LS = internal_find_first(first, last, val, comp, flt);
return (comp(flt(*LS), val) or comp(val, flt(*LS))) ? last : LS;
};
}
//
//-----------------------------------------------------------------------------
// function : find_last
@@ -174,7 +174,7 @@ inline Iter_t find_last(Iter_t first, Iter_t last,
if (last == first) return last;
Iter_t LS = internal_find_last(first, last, val, comp, flt);
return (comp(flt(*LS), val) or comp(val, flt(*LS))) ? last : LS;
};
}
//----------------------------------------------------------------------------
// function : lower_bound
@@ -196,7 +196,7 @@ inline Iter_t lower_bound(Iter_t first, Iter_t last,
if (last == first) return last;
Iter_t itaux = internal_find_first(first, last, val, comp, flt);
return (itaux == (last - 1) and comp(flt(*itaux), val)) ? last : itaux;
};
}
//----------------------------------------------------------------------------
// function :upper_bound
/// @brief return the first element greather than val.If don't exist
@@ -242,7 +242,7 @@ inline std::pair<Iter_t, Iter_t> equal_range(Iter_t first, Iter_t last,
{
return std::make_pair(lower_bound(first, last, val, comp, flt),
upper_bound(first, last, val, comp, flt));
};
}
//
//-----------------------------------------------------------------------------
// function : insert_first
@@ -263,7 +263,7 @@ inline Iter_t insert_first(Iter_t first, Iter_t last,
Filter())
{
return lower_bound(first, last, val, comp, flt);
};
}
//
//-----------------------------------------------------------------------------
// function : insert_last
@@ -285,7 +285,7 @@ inline Iter_t insert_last(Iter_t first, Iter_t last,
Filter())
{
return upper_bound(first, last, val, comp, flt);
};
}
/*
@@ -330,9 +330,9 @@ inline Iter_t insert_last(Iter_t first, Iter_t last,
while ( LI != LS)
{ it_out = LI + ( (LS - LI) >> 1);
if ( comp ( *it_out, val)) LI = it_out + 1 ; else LS = it_out ;
};
}
return LS ;
};
}
//
//-----------------------------------------------------------------------------
// function : internal_find_last
@@ -359,9 +359,9 @@ inline Iter_t insert_last(Iter_t first, Iter_t last,
while ( LI != LS)
{ it_out = LI + ( (LS - LI + 1) >> 1);
if ( comp (val, *it_out)) LS = it_out - 1 ; else LI = it_out ;
};
}
return LS ;
};
}
//
//###########################################################################
@@ -394,7 +394,7 @@ inline Iter_t insert_last(Iter_t first, Iter_t last,
if ( first == last) return last ;
Iter_t LS = internal_find_first ( first, last, val, comp);
return (comp (*LS, val) or comp (val, *LS))?last:LS;
};
}
//
//-----------------------------------------------------------------------------
// function : find_last
@@ -417,7 +417,7 @@ inline Iter_t insert_last(Iter_t first, Iter_t last,
if ( last == first ) return last ;
Iter_t LS = internal_find_last (first, last, val, comp);
return (comp (*LS, val) or comp (val, *LS))?last:LS ;
};
}
//----------------------------------------------------------------------------
// function : lower_bound
@@ -437,7 +437,7 @@ inline Iter_t insert_last(Iter_t first, Iter_t last,
if ( last == first ) return last ;
Iter_t itaux = internal_find_first( first, last, val,comp);
return (itaux == (last - 1) and comp (*itaux, val))?last: itaux;
};
}
//----------------------------------------------------------------------------
// function :upper_bound
/// @brief return the first element greather than val.If don't exist
@@ -459,7 +459,7 @@ inline Iter_t insert_last(Iter_t first, Iter_t last,
if ( last == first ) return last ;
Iter_t itaux = internal_find_last( first, last, val,comp);
return ( itaux == first and comp (val,*itaux))? itaux: itaux + 1;
};
}
//----------------------------------------------------------------------------
// function :equal_range
/// @brief return a pair of lower_bound and upper_bound with the value val.If
@@ -478,7 +478,7 @@ inline Iter_t insert_last(Iter_t first, Iter_t last,
{
return std::make_pair(lower_bound(first, last, val,comp),
upper_bound(first, last, val,comp));
};
}
//
//-----------------------------------------------------------------------------
// function : insert_first
@@ -497,7 +497,7 @@ inline Iter_t insert_last(Iter_t first, Iter_t last,
Compare comp = Compare() )
{
return lower_bound (first, last, val, comp);
};
}
//
//-----------------------------------------------------------------------------
// function : insert_last
@@ -517,15 +517,15 @@ inline Iter_t insert_last(Iter_t first, Iter_t last,
Compare comp = Compare())
{
return upper_bound (first, last, val, comp);
};
}
*/
//
//****************************************************************************
};// End namespace util
};// End namespace common
};// End namespace sort
};// End namespace boost
} // End namespace util
} // End namespace common
} // End namespace sort
} // End namespace boost
//****************************************************************************
//
#endif

View File

@@ -116,9 +116,9 @@ struct constructor
};
//
//****************************************************************************
};// End namespace util
};// End namespace common
};// End namespace sort
};// End namespace boost
} // End namespace util
} // End namespace common
} // End namespace sort
} // End namespace boost
//****************************************************************************
#endif