mirror of
https://github.com/boostorg/move.git
synced 2025-07-31 04:47:14 +02:00
Reduce Boost.Move dependencies to only Boost.Config
This commit is contained in:
@ -14,6 +14,7 @@
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <boost/move/algo/detail/adaptive_sort_merge.hpp>
|
||||
#include <cassert>
|
||||
|
||||
#if defined(BOOST_CLANG) || (defined(BOOST_GCC) && (BOOST_GCC >= 40600))
|
||||
#pragma GCC diagnostic push
|
||||
@ -53,7 +54,7 @@ inline void adaptive_merge_combine_blocks( RandIt first
|
||||
if(xbuf.size() < l_block){
|
||||
xbuf.initialize_until(l_block, *first);
|
||||
}
|
||||
BOOST_ASSERT(xbuf.size() >= l_block);
|
||||
assert(xbuf.size() >= l_block);
|
||||
size_type n_block_a, n_block_b, l_irreg1, l_irreg2;
|
||||
combine_params( keys, comp, l_combine
|
||||
, l_combine1, l_block, xbuf
|
||||
@ -91,7 +92,7 @@ inline void adaptive_merge_combine_blocks( RandIt first
|
||||
, l_combine1, l_block, xbuf
|
||||
, n_block_a, n_block_b, l_irreg1, l_irreg2, true); //Outputs
|
||||
BOOST_MOVE_ADAPTIVE_SORT_PRINT_L2(" A combine: ", len);
|
||||
BOOST_ASSERT(xbuf.size() >= l_block);
|
||||
assert(xbuf.size() >= l_block);
|
||||
op_merge_blocks_with_buf
|
||||
(uint_keys, less(), first, l_block, l_irreg1, n_block_a, n_block_b, l_irreg2, comp, move_op(), xbuf.data());
|
||||
xbuf.clear();
|
||||
@ -163,7 +164,7 @@ inline SizeType adaptive_merge_n_keys_intbuf(SizeType &rl_block, SizeType len1,
|
||||
|
||||
//This is the minimum number of keys to implement the ideal algorithm
|
||||
size_type n_keys = adaptive_merge_n_keys_without_external_keys(l_block, len1, len2, l_intbuf);
|
||||
BOOST_ASSERT(n_keys >= ((len1-l_intbuf-n_keys)/l_block + len2/l_block));
|
||||
assert(n_keys >= ((len1-l_intbuf-n_keys)/l_block + len2/l_block));
|
||||
|
||||
if(xbuf.template supports_aligned_trailing<size_type>
|
||||
( l_block
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
#include <boost/move/algo/detail/adaptive_sort_merge.hpp>
|
||||
#include <cassert>
|
||||
|
||||
#if defined(BOOST_CLANG) || (defined(BOOST_GCC) && (BOOST_GCC >= 40600))
|
||||
#pragma GCC diagnostic push
|
||||
@ -92,8 +93,8 @@ typename iter_size<RandIt>::type
|
||||
, Compare comp)
|
||||
{
|
||||
typedef typename iter_size<RandIt>::type size_type;
|
||||
BOOST_ASSERT(l_build_buf <= len);
|
||||
BOOST_ASSERT(0 == ((l_build_buf / l_base)&(l_build_buf/l_base-1)));
|
||||
assert(l_build_buf <= len);
|
||||
assert(0 == ((l_build_buf / l_base)&(l_build_buf/l_base-1)));
|
||||
|
||||
//Place the start pointer after the buffer
|
||||
RandIt first_block = first + l_build_buf;
|
||||
@ -104,7 +105,7 @@ typename iter_size<RandIt>::type
|
||||
//////////////////////////////////
|
||||
size_type l_merged = 0u;
|
||||
|
||||
BOOST_ASSERT(l_build_buf);
|
||||
assert(l_build_buf);
|
||||
//If there is no enough buffer for the insertion sort step, just avoid the external buffer
|
||||
size_type kbuf = min_value<size_type>(l_build_buf, size_type(xbuf.capacity()));
|
||||
kbuf = kbuf < l_base ? 0 : kbuf;
|
||||
@ -135,7 +136,7 @@ typename iter_size<RandIt>::type
|
||||
l_merged = op_merge_left_step_multiple
|
||||
(first_block-l_merged, elements_in_blocks, l_merged, l_build_buf, size_type(l_build_buf - l_merged), comp, swap_op());
|
||||
|
||||
BOOST_ASSERT(l_merged == l_build_buf);
|
||||
assert(l_merged == l_build_buf);
|
||||
|
||||
//////////////////////////////////
|
||||
// Start of merge to right step
|
||||
@ -181,7 +182,7 @@ void adaptive_sort_combine_blocks
|
||||
RandIt combined_first = first;
|
||||
|
||||
boost::movelib::ignore(l_total_combined);
|
||||
BOOST_ASSERT(l_total_combined <= len);
|
||||
assert(l_total_combined <= len);
|
||||
|
||||
size_type const max_i = size_type(n_reg_combined + (l_irreg_combined != 0));
|
||||
|
||||
@ -277,9 +278,9 @@ bool adaptive_sort_combine_all_blocks
|
||||
//Otherwise, just give up and and use all keys to merge using rotations (use_internal_buf = false)
|
||||
bool use_internal_buf = false;
|
||||
size_type const l_block = lblock_for_combine(l_intbuf, n_keys, size_type(2*l_merged), use_internal_buf);
|
||||
BOOST_ASSERT(!l_intbuf || (l_block == l_intbuf));
|
||||
BOOST_ASSERT(n == 0 || (!use_internal_buf || prev_use_internal_buf) );
|
||||
BOOST_ASSERT(n == 0 || (!use_internal_buf || l_prev_block == l_block) );
|
||||
assert(!l_intbuf || (l_block == l_intbuf));
|
||||
assert(n == 0 || (!use_internal_buf || prev_use_internal_buf) );
|
||||
assert(n == 0 || (!use_internal_buf || l_prev_block == l_block) );
|
||||
|
||||
bool const is_merge_left = (n&1) == 0;
|
||||
size_type const l_total_combined = calculate_total_combined(l_data, l_merged);
|
||||
@ -331,7 +332,7 @@ bool adaptive_sort_combine_all_blocks
|
||||
l_prev_block = l_block;
|
||||
prev_use_internal_buf = use_internal_buf;
|
||||
}
|
||||
BOOST_ASSERT(l_prev_total_combined == l_data);
|
||||
assert(l_prev_total_combined == l_data);
|
||||
bool const buffer_right = prev_use_internal_buf && prev_merge_left;
|
||||
|
||||
l_intbuf = prev_use_internal_buf ? l_prev_block : 0u;
|
||||
@ -358,7 +359,7 @@ void adaptive_sort_final_merge( bool buffer_right
|
||||
, XBuf & xbuf
|
||||
, Compare comp)
|
||||
{
|
||||
//BOOST_ASSERT(n_keys || xbuf.size() == l_intbuf);
|
||||
//assert(n_keys || xbuf.size() == l_intbuf);
|
||||
xbuf.clear();
|
||||
|
||||
typedef typename iter_size<RandIt>::type size_type;
|
||||
@ -422,7 +423,7 @@ bool adaptive_sort_build_params
|
||||
--n_min_ideal_keys;
|
||||
}
|
||||
++n_min_ideal_keys;
|
||||
BOOST_ASSERT(n_min_ideal_keys <= l_intbuf);
|
||||
assert(n_min_ideal_keys <= l_intbuf);
|
||||
|
||||
if(xbuf.template supports_aligned_trailing<size_type>
|
||||
(l_intbuf, size_type((size_type(len-l_intbuf)-1u)/l_intbuf+1u))){
|
||||
@ -459,7 +460,7 @@ bool adaptive_sort_build_params
|
||||
//If collected keys are not enough, try to fix n_keys and l_intbuf. If no fix
|
||||
//is possible (due to very low unique keys), then go to a slow sort based on rotations.
|
||||
else{
|
||||
BOOST_ASSERT(collected < (n_min_ideal_keys+l_intbuf));
|
||||
assert(collected < (n_min_ideal_keys+l_intbuf));
|
||||
if(collected < 4){ //No combination possible with less that 4 keys
|
||||
return false;
|
||||
}
|
||||
@ -475,7 +476,7 @@ bool adaptive_sort_build_params
|
||||
l_intbuf = 0;
|
||||
l_build_buf = n_keys;
|
||||
}
|
||||
BOOST_ASSERT((n_keys+l_intbuf) >= l_build_buf);
|
||||
assert((n_keys+l_intbuf) >= l_build_buf);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -556,7 +557,7 @@ void adaptive_sort_impl
|
||||
}
|
||||
else{
|
||||
//Make sure it is at least four
|
||||
BOOST_STATIC_ASSERT(AdaptiveSortInsertionSortThreshold >= 4);
|
||||
BOOST_MOVE_STATIC_ASSERT(AdaptiveSortInsertionSortThreshold >= 4);
|
||||
|
||||
size_type l_base = 0;
|
||||
size_type l_intbuf = 0;
|
||||
@ -569,12 +570,12 @@ void adaptive_sort_impl
|
||||
stable_sort(first, first+len, comp, xbuf);
|
||||
}
|
||||
else{
|
||||
BOOST_ASSERT(l_build_buf);
|
||||
assert(l_build_buf);
|
||||
//Otherwise, continue the adaptive_sort
|
||||
BOOST_MOVE_ADAPTIVE_SORT_PRINT_L1("\n After collect_unique: ", len);
|
||||
size_type const n_key_plus_buf = size_type(l_intbuf+n_keys);
|
||||
//l_build_buf is always power of two if l_intbuf is zero
|
||||
BOOST_ASSERT(l_intbuf || (0 == (l_build_buf & (l_build_buf-1))));
|
||||
assert(l_intbuf || (0 == (l_build_buf & (l_build_buf-1))));
|
||||
|
||||
//Classic merge sort until internal buffer and xbuf are exhausted
|
||||
size_type const l_merged = adaptive_sort_build_blocks
|
||||
|
@ -53,7 +53,7 @@
|
||||
#include <boost/move/algo/detail/heap_sort.hpp>
|
||||
#include <boost/move/algo/detail/merge.hpp>
|
||||
#include <boost/move/algo/detail/is_sorted.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cassert>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <limits.h>
|
||||
|
||||
@ -88,7 +88,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MOVE_ADAPTIVE_SORT_INVARIANTS
|
||||
#define BOOST_MOVE_ADAPTIVE_SORT_INVARIANT BOOST_ASSERT
|
||||
#define BOOST_MOVE_ADAPTIVE_SORT_INVARIANT assert
|
||||
#else
|
||||
#define BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(L)
|
||||
#endif
|
||||
@ -117,7 +117,7 @@ namespace detail_adaptive {
|
||||
|
||||
static const std::size_t AdaptiveSortInsertionSortThreshold = 16;
|
||||
//static const std::size_t AdaptiveSortInsertionSortThreshold = 4;
|
||||
BOOST_STATIC_ASSERT((AdaptiveSortInsertionSortThreshold&(AdaptiveSortInsertionSortThreshold-1)) == 0);
|
||||
BOOST_MOVE_STATIC_ASSERT((AdaptiveSortInsertionSortThreshold&(AdaptiveSortInsertionSortThreshold-1)) == 0);
|
||||
|
||||
#if defined BOOST_HAS_INTPTR_T
|
||||
typedef ::boost::uintptr_t uintptr_t;
|
||||
@ -290,7 +290,7 @@ typename iter_size<RandIt>::type
|
||||
typedef typename iter_size<RandIt>::type size_type;
|
||||
typedef typename iterator_traits<RandIt>::value_type value_type;
|
||||
typedef typename iterator_traits<RandItKeys>::value_type key_type;
|
||||
BOOST_ASSERT(ix_first_block <= ix_last_block);
|
||||
assert(ix_first_block <= ix_last_block);
|
||||
size_type ix_min_block = 0u;
|
||||
for (size_type szt_i = ix_first_block; szt_i < ix_last_block; ++szt_i) {
|
||||
const value_type &min_val = first[size_type(ix_min_block*l_block)];
|
||||
@ -323,7 +323,7 @@ void merge_blocks_bufferless
|
||||
typedef typename iter_size<RandIt>::type size_type;
|
||||
size_type const key_count = needed_keys_count(n_block_a, n_block_b);
|
||||
::boost::movelib::ignore(key_count);
|
||||
//BOOST_ASSERT(n_block_a || n_block_b);
|
||||
//assert(n_block_a || n_block_b);
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted_and_unique(key_first, key_first + key_count, key_comp));
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(!n_block_b || n_block_a == count_if_with(key_first, key_first + key_count, key_comp, key_first[n_block_a]));
|
||||
|
||||
@ -575,7 +575,7 @@ template<class Unsigned>
|
||||
Unsigned lblock_for_combine
|
||||
(Unsigned const l_block, Unsigned const n_keys, Unsigned const l_data, bool &use_buf)
|
||||
{
|
||||
BOOST_ASSERT(l_data > 1);
|
||||
assert(l_data > 1);
|
||||
|
||||
//We need to guarantee lblock >= l_merged/(n_keys/2) keys for the combination.
|
||||
//We have at least 4 keys guaranteed (which are the minimum to merge 2 ranges)
|
||||
@ -586,8 +586,8 @@ Unsigned lblock_for_combine
|
||||
if(!l_block){
|
||||
//If l_block == 0 then n_keys is power of two
|
||||
//(guaranteed by build_params(...))
|
||||
BOOST_ASSERT(n_keys >= 4);
|
||||
//BOOST_ASSERT(0 == (n_keys &(n_keys-1)));
|
||||
assert(n_keys >= 4);
|
||||
//assert(0 == (n_keys &(n_keys-1)));
|
||||
|
||||
//See if half keys are at least 4 and if half keys fulfill
|
||||
Unsigned const new_buf = n_keys/2;
|
||||
@ -635,7 +635,7 @@ void stable_merge
|
||||
, Compare comp
|
||||
, XBuf &xbuf)
|
||||
{
|
||||
BOOST_ASSERT(xbuf.empty());
|
||||
assert(xbuf.empty());
|
||||
typedef typename iter_size<RandIt>::type size_type;
|
||||
size_type const len1 = size_type(middle-first);
|
||||
size_type const len2 = size_type(last-middle);
|
||||
@ -657,7 +657,7 @@ void initialize_keys( RandIt first, RandIt last
|
||||
, XBuf & xbuf)
|
||||
{
|
||||
unstable_sort(first, last, comp, xbuf);
|
||||
BOOST_ASSERT(boost::movelib::is_sorted_and_unique(first, last, comp));
|
||||
assert(boost::movelib::is_sorted_and_unique(first, last, comp));
|
||||
}
|
||||
|
||||
template<class RandIt, class U>
|
||||
@ -711,11 +711,11 @@ void combine_params
|
||||
//Initial parameters for selection sort blocks
|
||||
l_irreg1 = size_type(l_prev_merged%l_block);
|
||||
l_irreg2 = size_type((l_combined-l_irreg1)%l_block);
|
||||
BOOST_ASSERT(((l_combined-l_irreg1-l_irreg2)%l_block) == 0);
|
||||
assert(((l_combined-l_irreg1-l_irreg2)%l_block) == 0);
|
||||
size_type const n_reg_block = size_type((l_combined-l_irreg1-l_irreg2)/l_block);
|
||||
n_block_a = l_prev_merged/l_block;
|
||||
n_block_b = size_type(n_reg_block - n_block_a);
|
||||
BOOST_ASSERT(n_reg_block>=n_block_a);
|
||||
assert(n_reg_block>=n_block_a);
|
||||
|
||||
//Key initialization
|
||||
if (do_initialize_keys) {
|
||||
@ -906,7 +906,7 @@ RandIt op_partial_merge_and_save_impl
|
||||
first1 = last1;
|
||||
}
|
||||
else{
|
||||
BOOST_ASSERT((last1-first1) == (buf_last1 - buf_first1));
|
||||
assert((last1-first1) == (buf_last1 - buf_first1));
|
||||
}
|
||||
|
||||
//Now merge from buffer
|
||||
@ -1028,7 +1028,7 @@ void op_merge_blocks_left
|
||||
size_type const key_count = needed_keys_count(n_block_a, n_block_b);
|
||||
boost::movelib::ignore(key_count);
|
||||
|
||||
// BOOST_ASSERT(n_block_a || n_block_b);
|
||||
// assert(n_block_a || n_block_b);
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted_and_unique(key_first, key_first + key_count, key_comp));
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(!n_block_b || n_block_a == count_if_with(key_first, key_first + key_count, key_comp, key_first[n_block_a]));
|
||||
|
||||
@ -1079,7 +1079,7 @@ void op_merge_blocks_left
|
||||
(!is_buffer_middle && size_type(first1-buffer) == l_block && first2 == last1));
|
||||
|
||||
if(is_range1_A == is_range2_A){
|
||||
BOOST_ASSERT((first1 == last1) || !comp(*first_min, last1[typename iterator_traits<RandIt>::difference_type(-1)]));
|
||||
assert((first1 == last1) || !comp(*first_min, last1[typename iterator_traits<RandIt>::difference_type(-1)]));
|
||||
if(!is_buffer_middle){
|
||||
buffer = op(forward_t(), first1, last1, buffer);
|
||||
}
|
||||
@ -1132,7 +1132,7 @@ void op_merge_blocks_left
|
||||
}
|
||||
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(!n_block_b || n_block_a == count_if_with(key_first, key_range2 + n_block_left, key_comp, *key_mid));
|
||||
BOOST_ASSERT(!n_block_b_left);
|
||||
assert(!n_block_b_left);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//Process remaining range 1 left before the irregular B block
|
||||
@ -1259,7 +1259,7 @@ void op_merge_blocks_with_buf
|
||||
typedef typename iter_size<RandIt>::type size_type;
|
||||
size_type const key_count = needed_keys_count(n_block_a, n_block_b);
|
||||
boost::movelib::ignore(key_count);
|
||||
//BOOST_ASSERT(n_block_a || n_block_b);
|
||||
//assert(n_block_a || n_block_b);
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted_and_unique(key_first, key_first + key_count, key_comp));
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(!n_block_b || n_block_a == count_if_with(key_first, key_first + key_count, key_comp, key_first[n_block_a]));
|
||||
|
||||
@ -1315,7 +1315,7 @@ void op_merge_blocks_with_buf
|
||||
RandIt res = op(forward_t(), buffer, buffer_end, first1);
|
||||
BOOST_MOVE_ADAPTIVE_SORT_PRINT_L2(" merge_blocks_w_fwd: ", len);
|
||||
buffer = buffer_end = buf_first;
|
||||
BOOST_ASSERT(buffer_empty || res == last1);
|
||||
assert(buffer_empty || res == last1);
|
||||
boost::movelib::ignore(res);
|
||||
//swap_and_update_key(key_next, key_range2, key_mid, first2, last2, first_min);
|
||||
buffer_end = buffer_and_update_key(key_next, key_range2, key_mid, first2, last2, first_min, buffer = buf_first, op);
|
||||
@ -1329,7 +1329,7 @@ void op_merge_blocks_with_buf
|
||||
RandIt const unmerged = op_partial_merge_and_save(first1, last1, first2, last2, first_min, buffer, buffer_end, comp, op, is_range1_A);
|
||||
BOOST_MOVE_ADAPTIVE_SORT_PRINT_L2(" merge_blocks_w_mrs: ", len);
|
||||
bool const is_range_1_empty = buffer == buffer_end;
|
||||
BOOST_ASSERT(is_range_1_empty || (buffer_end-buffer) == (last1+l_block-unmerged));
|
||||
assert(is_range_1_empty || (buffer_end-buffer) == (last1+l_block-unmerged));
|
||||
if(is_range_1_empty){
|
||||
buffer = buffer_end = buf_first;
|
||||
first_min = last_min - (last2 - first2);
|
||||
@ -1348,7 +1348,7 @@ void op_merge_blocks_with_buf
|
||||
first1 = unmerged;
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted(first, unmerged, comp));
|
||||
}
|
||||
BOOST_ASSERT( (is_range2_A && n_block_a_left) || (!is_range2_A && n_block_b_left));
|
||||
assert( (is_range2_A && n_block_a_left) || (!is_range2_A && n_block_b_left));
|
||||
is_range2_A ? --n_block_a_left : --n_block_b_left;
|
||||
last1 += l_block;
|
||||
first2 = last2;
|
||||
@ -1381,7 +1381,7 @@ void op_merge_blocks_with_buf
|
||||
BOOST_MOVE_ADAPTIVE_SORT_PRINT_L2(" merge_blocks_w_irg: ", len);
|
||||
|
||||
buffer_end = rbuf_beg.base();
|
||||
BOOST_ASSERT((dest-last1) == (buffer_end-buffer));
|
||||
assert((dest-last1) == (buffer_end-buffer));
|
||||
op_merge_with_left_placed(is_range1_A ? first1 : last1, last1, dest, buffer, buffer_end, comp, op);
|
||||
BOOST_MOVE_ADAPTIVE_SORT_PRINT_L2(" merge_with_left_plc:", len);
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted(first, last_irr2, comp));
|
||||
@ -1429,7 +1429,7 @@ void op_merge_right_step_once
|
||||
typedef typename iter_size<RandIt>::type size_type;
|
||||
size_type restk = size_type(elements_in_blocks%(2*l_build_buf));
|
||||
size_type p = size_type(elements_in_blocks - restk);
|
||||
BOOST_ASSERT(0 == (p%(2*l_build_buf)));
|
||||
assert(0 == (p%(2*l_build_buf)));
|
||||
|
||||
if(restk <= l_build_buf){
|
||||
op(backward_t(),first_block+p, first_block+p+restk, first_block+p+restk+l_build_buf);
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/adl_move_swap.hpp>
|
||||
#include <boost/move/detail/iterator_traits.hpp>
|
||||
#include <boost/move/algo/move.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace movelib {
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <boost/move/detail/iterator_traits.hpp>
|
||||
#include <boost/move/algo/detail/is_sorted.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <cassert>
|
||||
|
||||
#if defined(BOOST_CLANG) || (defined(BOOST_GCC) && (BOOST_GCC >= 40600))
|
||||
#pragma GCC diagnostic push
|
||||
@ -100,7 +101,7 @@ class heap_sort_helper
|
||||
{
|
||||
make_heap(first, last, comp);
|
||||
sort_heap(first, last, comp);
|
||||
BOOST_ASSERT(boost::movelib::is_sorted(first, last, comp));
|
||||
assert(boost::movelib::is_sorted(first, last, comp));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <boost/move/algo/predicate.hpp>
|
||||
#include <boost/move/algo/detail/search.hpp>
|
||||
#include <boost/move/detail/iterator_to_raw_pointer.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
|
||||
#if defined(BOOST_CLANG) || (defined(BOOST_GCC) && (BOOST_GCC >= 40600))
|
||||
@ -73,7 +73,7 @@ class adaptive_xbuf
|
||||
template<class RandIt>
|
||||
void push_back(RandIt first, size_type n)
|
||||
{
|
||||
BOOST_ASSERT(m_capacity - m_size >= n);
|
||||
assert(m_capacity - m_size >= n);
|
||||
boost::uninitialized_move(first, first+n, m_ptr+m_size);
|
||||
m_size += n;
|
||||
}
|
||||
@ -81,7 +81,7 @@ class adaptive_xbuf
|
||||
template<class RandIt>
|
||||
iterator add(RandIt it)
|
||||
{
|
||||
BOOST_ASSERT(m_size < m_capacity);
|
||||
assert(m_size < m_capacity);
|
||||
RandRawIt p_ret = m_ptr + m_size;
|
||||
::new(&*p_ret) T(::boost::move(*it));
|
||||
++m_size;
|
||||
@ -119,7 +119,7 @@ class adaptive_xbuf
|
||||
|
||||
void initialize_until(size_type const sz, T &t)
|
||||
{
|
||||
BOOST_ASSERT(m_size < m_capacity);
|
||||
assert(m_size < m_capacity);
|
||||
if(m_size < sz){
|
||||
BOOST_MOVE_TRY
|
||||
{
|
||||
@ -232,7 +232,7 @@ class range_xbuf
|
||||
template<class RandIt>
|
||||
void move_assign(RandIt first, size_type n)
|
||||
{
|
||||
BOOST_ASSERT(size_type(n) <= size_type(m_cap-m_first));
|
||||
assert(size_type(n) <= size_type(m_cap-m_first));
|
||||
typedef typename iter_difference<RandIt>::type d_type;
|
||||
m_last = Op()(forward_t(), first, first+d_type(n), m_first);
|
||||
}
|
||||
@ -634,11 +634,11 @@ void op_merge_with_right_placed
|
||||
, InputOutIterator dest_first, InputOutIterator r_first, InputOutIterator r_last
|
||||
, Compare comp, Op op)
|
||||
{
|
||||
BOOST_ASSERT((last - first) == (r_first - dest_first));
|
||||
assert((last - first) == (r_first - dest_first));
|
||||
while ( first != last ) {
|
||||
if (r_first == r_last) {
|
||||
InputOutIterator end = op(forward_t(), first, last, dest_first);
|
||||
BOOST_ASSERT(end == r_last);
|
||||
assert(end == r_last);
|
||||
boost::movelib::ignore(end);
|
||||
return;
|
||||
}
|
||||
@ -671,11 +671,11 @@ void op_merge_with_left_placed
|
||||
, BidirIterator const r_first, BidirIterator r_last
|
||||
, Compare comp, Op op)
|
||||
{
|
||||
BOOST_ASSERT((dest_last - last) == (r_last - r_first));
|
||||
assert((dest_last - last) == (r_last - r_first));
|
||||
while( r_first != r_last ) {
|
||||
if(first == last) {
|
||||
BidirOutIterator res = op(backward_t(), r_first, r_last, dest_last);
|
||||
BOOST_ASSERT(last == res);
|
||||
assert(last == res);
|
||||
boost::movelib::ignore(res);
|
||||
return;
|
||||
}
|
||||
@ -725,7 +725,7 @@ void uninitialized_merge_with_right_placed
|
||||
, InputOutIterator dest_first, InputOutIterator r_first, InputOutIterator r_last
|
||||
, Compare comp)
|
||||
{
|
||||
BOOST_ASSERT((last - first) == (r_first - dest_first));
|
||||
assert((last - first) == (r_first - dest_first));
|
||||
typedef typename iterator_traits<InputOutIterator>::value_type value_type;
|
||||
InputOutIterator const original_r_first = r_first;
|
||||
|
||||
@ -739,7 +739,7 @@ void uninitialized_merge_with_right_placed
|
||||
}
|
||||
d.release();
|
||||
InputOutIterator end = ::boost::move(first, last, original_r_first);
|
||||
BOOST_ASSERT(end == r_last);
|
||||
assert(end == r_last);
|
||||
boost::movelib::ignore(end);
|
||||
return;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <boost/move/algo/detail/basic_op.hpp>
|
||||
#include <boost/move/detail/iterator_traits.hpp>
|
||||
#include <boost/move/detail/destruct_n.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cassert>
|
||||
|
||||
namespace boost {
|
||||
namespace movelib {
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <boost/move/detail/workaround.hpp>
|
||||
#include <boost/move/detail/unique_ptr_meta_utils.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <cstddef> //For std::size_t,std::nullptr_t
|
||||
|
||||
@ -190,7 +189,7 @@ struct default_delete
|
||||
{
|
||||
//If T is not an array type, U derives from T
|
||||
//and T has no virtual destructor, then you have a problem
|
||||
BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor<default_delete, U>::value ));
|
||||
BOOST_MOVE_STATIC_ASSERT(( !bmupd::missing_virtual_destructor<default_delete, U>::value ));
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs a default_delete object from another <tt>default_delete<U></tt> object.
|
||||
@ -205,7 +204,7 @@ struct default_delete
|
||||
{
|
||||
//If T is not an array type, U derives from T
|
||||
//and T has no virtual destructor, then you have a problem
|
||||
BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor<default_delete, U>::value ));
|
||||
BOOST_MOVE_STATIC_ASSERT(( !bmupd::missing_virtual_destructor<default_delete, U>::value ));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -222,10 +221,10 @@ struct default_delete
|
||||
operator()(U* ptr) const BOOST_NOEXCEPT
|
||||
{
|
||||
//U must be a complete type
|
||||
BOOST_STATIC_ASSERT(sizeof(U) > 0);
|
||||
BOOST_MOVE_STATIC_ASSERT(sizeof(U) > 0);
|
||||
//If T is not an array type, U derives from T
|
||||
//and T has no virtual destructor, then you have a problem
|
||||
BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor<default_delete, U>::value ));
|
||||
BOOST_MOVE_STATIC_ASSERT(( !bmupd::missing_virtual_destructor<default_delete, U>::value ));
|
||||
element_type * const p = static_cast<element_type*>(ptr);
|
||||
move_upd::call_delete(p, move_upd::is_array_del<bmupmu::is_array<T>::value>());
|
||||
}
|
||||
@ -233,7 +232,7 @@ struct default_delete
|
||||
//! <b>Effects</b>: Same as <tt>(*this)(static_cast<element_type*>(nullptr))</tt>.
|
||||
//!
|
||||
void operator()(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) const BOOST_NOEXCEPT
|
||||
{ BOOST_STATIC_ASSERT(sizeof(element_type) > 0); }
|
||||
{ BOOST_MOVE_STATIC_ASSERT(sizeof(element_type) > 0); }
|
||||
};
|
||||
|
||||
} //namespace movelib {
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/move/detail/workaround.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
@ -39,25 +40,74 @@
|
||||
|
||||
#if defined(BOOST_MOVE_DETAIL_WINDOWS_API)
|
||||
|
||||
#include <boost/winapi/time.hpp>
|
||||
#include <boost/winapi/timers.hpp>
|
||||
#include <boost/winapi/get_last_error.hpp>
|
||||
#include <boost/winapi/error_codes.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cassert>
|
||||
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
#include <Windows.h>
|
||||
#else
|
||||
|
||||
#if defined (WIN32_PLATFORM_PSPC)
|
||||
#define BOOST_MOVE_WINAPI_IMPORT BOOST_SYMBOL_IMPORT
|
||||
#define BOOST_MOVE_WINAPI_IMPORT_EXCEPT_WM
|
||||
#elif defined (_WIN32_WCE)
|
||||
#define BOOST_MOVE_WINAPI_IMPORT
|
||||
#define BOOST_MOVE_WINAPI_IMPORT_EXCEPT_WM
|
||||
#else
|
||||
#define BOOST_MOVE_WINAPI_IMPORT BOOST_SYMBOL_IMPORT
|
||||
#define BOOST_MOVE_WINAPI_IMPORT_EXCEPT_WM BOOST_SYMBOL_IMPORT
|
||||
#endif
|
||||
|
||||
#if defined(WINAPI)
|
||||
#define BOOST_MOVE_WINAPI_CC WINAPI
|
||||
#else
|
||||
#if defined(_M_IX86) || defined(__i386__)
|
||||
#define BOOST_MOVE_WINAPI_CC __stdcall
|
||||
#else
|
||||
// On architectures other than 32-bit x86 __stdcall is ignored. Clang also issues a warning.
|
||||
#define BOOST_MOVE_WINAPI_CC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
union _LARGE_INTEGER;
|
||||
typedef long long QuadPart;
|
||||
|
||||
BOOST_MOVE_WINAPI_IMPORT_EXCEPT_WM int BOOST_MOVE_WINAPI_CC
|
||||
QueryPerformanceCounter(::_LARGE_INTEGER* lpPerformanceCount);
|
||||
|
||||
BOOST_MOVE_WINAPI_IMPORT_EXCEPT_WM int BOOST_MOVE_WINAPI_CC
|
||||
QueryPerformanceFrequency(::_LARGE_INTEGER* lpFrequency);
|
||||
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost { namespace move_detail {
|
||||
|
||||
BOOST_FORCEINLINE int QueryPerformanceCounter(long long* lpPerformanceCount)
|
||||
{
|
||||
return ::QueryPerformanceCounter(reinterpret_cast< ::_LARGE_INTEGER* >(lpPerformanceCount));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE int QueryPerformanceFrequency(long long* lpFrequency)
|
||||
{
|
||||
return ::QueryPerformanceFrequency(reinterpret_cast< ::_LARGE_INTEGER* >(lpFrequency));
|
||||
}
|
||||
|
||||
|
||||
template<int Dummy>
|
||||
struct QPFHolder
|
||||
{
|
||||
static inline double get_nsec_per_tic()
|
||||
{
|
||||
boost::winapi::LARGE_INTEGER_ freq;
|
||||
boost::winapi::BOOL_ r = boost::winapi::QueryPerformanceFrequency( &freq );
|
||||
long long freq;
|
||||
int r = boost::move_detail::QueryPerformanceFrequency( &freq );
|
||||
boost::movelib::ignore(r);
|
||||
BOOST_ASSERT(r != 0 && "Boost::Move - get_nanosecs_per_tic Internal Error");
|
||||
assert(r != 0 && "Boost::Move - get_nanosecs_per_tic Internal Error");
|
||||
|
||||
return double(1000000000.0L / freq.QuadPart);
|
||||
return double(1000000000.0L / double(freq));
|
||||
}
|
||||
|
||||
static const double nanosecs_per_tic;
|
||||
@ -70,18 +120,18 @@ inline boost::uint64_t nsec_clock() BOOST_NOEXCEPT
|
||||
{
|
||||
double nanosecs_per_tic = QPFHolder<0>::nanosecs_per_tic;
|
||||
|
||||
boost::winapi::LARGE_INTEGER_ pcount;
|
||||
long long pcount;
|
||||
unsigned times=0;
|
||||
while ( !boost::winapi::QueryPerformanceCounter( &pcount ) )
|
||||
while ( !boost::move_detail::QueryPerformanceCounter( &pcount ) )
|
||||
{
|
||||
if ( ++times > 3 )
|
||||
{
|
||||
BOOST_ASSERT("Boost::Move - QueryPerformanceCounter Internal Error");
|
||||
assert("Boost::Move - QueryPerformanceCounter Internal Error");
|
||||
return 0u;
|
||||
}
|
||||
}
|
||||
|
||||
return static_cast<boost::uint64_t>(nanosecs_per_tic * double(pcount.QuadPart));
|
||||
return static_cast<boost::uint64_t>(nanosecs_per_tic * double(pcount));
|
||||
}
|
||||
|
||||
}} //namespace boost { namespace move_detail {
|
||||
|
@ -30,8 +30,7 @@
|
||||
// move/detail
|
||||
#include <boost/move/detail/meta_utils.hpp>
|
||||
// other
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <cassert>
|
||||
// std
|
||||
#include <cstddef>
|
||||
|
||||
@ -1238,7 +1237,7 @@ struct aligned_next;
|
||||
template<std::size_t Len, std::size_t Align, class T>
|
||||
struct aligned_next<Len, Align, T, true>
|
||||
{
|
||||
BOOST_STATIC_ASSERT((alignment_of<T>::value == Align));
|
||||
BOOST_MOVE_STATIC_ASSERT((alignment_of<T>::value == Align));
|
||||
typedef aligned_union<T, Len> type;
|
||||
};
|
||||
|
||||
@ -1278,13 +1277,13 @@ template<std::size_t Len, std::size_t Align = alignment_of<max_align_t>::value>
|
||||
struct aligned_storage
|
||||
{
|
||||
//Sanity checks for input parameters
|
||||
BOOST_STATIC_ASSERT(Align > 0);
|
||||
BOOST_MOVE_STATIC_ASSERT(Align > 0);
|
||||
|
||||
//Sanity checks for output type
|
||||
typedef typename aligned_storage_impl<Len ? Len : 1, Align>::type type;
|
||||
static const std::size_t value = alignment_of<type>::value;
|
||||
BOOST_STATIC_ASSERT(value >= Align);
|
||||
BOOST_STATIC_ASSERT((value % Align) == 0);
|
||||
BOOST_MOVE_STATIC_ASSERT(value >= Align);
|
||||
BOOST_MOVE_STATIC_ASSERT((value % Align) == 0);
|
||||
|
||||
//Just in case someone instantiates aligned_storage
|
||||
//instead of aligned_storage::type (typical error).
|
||||
|
@ -103,5 +103,32 @@ BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore(T1 const&)
|
||||
# define BOOST_MOVE_CATCH_END }
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CXX11_STATIC_ASSERT
|
||||
# ifndef BOOST_NO_CXX11_VARIADIC_MACROS
|
||||
# define BOOST_MOVE_STATIC_ASSERT( ... ) static_assert(__VA_ARGS__, #__VA_ARGS__)
|
||||
# else
|
||||
# define BOOST_MOVE_STATIC_ASSERT( B ) static_assert(B, #B)
|
||||
# endif
|
||||
#else
|
||||
namespace boost {
|
||||
namespace move_detail {
|
||||
|
||||
template<bool B>
|
||||
struct STATIC_ASSERTION_FAILURE;
|
||||
|
||||
template<>
|
||||
struct STATIC_ASSERTION_FAILURE<true>{};
|
||||
|
||||
template<std::size_t> struct static_assert_test {};
|
||||
|
||||
}}
|
||||
|
||||
#define BOOST_MOVE_STATIC_ASSERT(B) \
|
||||
typedef ::boost::move_detail::static_assert_test<\
|
||||
sizeof(::boost::move_detail::STATIC_ASSERTION_FAILURE<bool(B)>)>\
|
||||
BOOST_JOIN(boost_static_assert_typedef_, __LINE__) BOOST_ATTRIBUTE_UNUSED
|
||||
|
||||
#endif
|
||||
|
||||
#endif //#ifndef BOOST_MOVE_DETAIL_WORKAROUND_HPP
|
||||
|
||||
|
@ -25,8 +25,7 @@
|
||||
#include <boost/move/default_delete.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/adl_move_swap.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cassert>
|
||||
|
||||
#include <cstddef> //For std::nullptr_t and std::size_t
|
||||
|
||||
@ -394,8 +393,8 @@ class unique_ptr
|
||||
{
|
||||
//If this constructor is instantiated with a pointer type or reference type
|
||||
//for the template argument D, the program is ill-formed.
|
||||
BOOST_STATIC_ASSERT(!bmupmu::is_pointer<D>::value);
|
||||
BOOST_STATIC_ASSERT(!bmupmu::is_reference<D>::value);
|
||||
BOOST_MOVE_STATIC_ASSERT(!bmupmu::is_pointer<D>::value);
|
||||
BOOST_MOVE_STATIC_ASSERT(!bmupmu::is_reference<D>::value);
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Same as <tt>unique_ptr()</tt> (default constructor).
|
||||
@ -405,8 +404,8 @@ class unique_ptr
|
||||
{
|
||||
//If this constructor is instantiated with a pointer type or reference type
|
||||
//for the template argument D, the program is ill-formed.
|
||||
BOOST_STATIC_ASSERT(!bmupmu::is_pointer<D>::value);
|
||||
BOOST_STATIC_ASSERT(!bmupmu::is_reference<D>::value);
|
||||
BOOST_MOVE_STATIC_ASSERT(!bmupmu::is_pointer<D>::value);
|
||||
BOOST_MOVE_STATIC_ASSERT(!bmupmu::is_reference<D>::value);
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: D shall satisfy the requirements of DefaultConstructible, and
|
||||
@ -430,12 +429,12 @@ class unique_ptr
|
||||
{
|
||||
//If T is not an array type, element_type_t<Pointer> derives from T
|
||||
//it uses the default deleter and T has no virtual destructor, then you have a problem
|
||||
BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor
|
||||
BOOST_MOVE_STATIC_ASSERT(( !bmupd::missing_virtual_destructor
|
||||
<D, typename bmupd::get_element_type<Pointer>::type>::value ));
|
||||
//If this constructor is instantiated with a pointer type or reference type
|
||||
//for the template argument D, the program is ill-formed.
|
||||
BOOST_STATIC_ASSERT(!bmupmu::is_pointer<D>::value);
|
||||
BOOST_STATIC_ASSERT(!bmupmu::is_reference<D>::value);
|
||||
BOOST_MOVE_STATIC_ASSERT(!bmupmu::is_pointer<D>::value);
|
||||
BOOST_MOVE_STATIC_ASSERT(!bmupmu::is_reference<D>::value);
|
||||
}
|
||||
|
||||
//!The signature of this constructor depends upon whether D is a reference type.
|
||||
@ -468,7 +467,7 @@ class unique_ptr
|
||||
{
|
||||
//If T is not an array type, element_type_t<Pointer> derives from T
|
||||
//it uses the default deleter and T has no virtual destructor, then you have a problem
|
||||
BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor
|
||||
BOOST_MOVE_STATIC_ASSERT(( !bmupd::missing_virtual_destructor
|
||||
<D, typename bmupd::get_element_type<Pointer>::type>::value ));
|
||||
}
|
||||
|
||||
@ -506,7 +505,7 @@ class unique_ptr
|
||||
{
|
||||
//If T is not an array type, element_type_t<Pointer> derives from T
|
||||
//it uses the default deleter and T has no virtual destructor, then you have a problem
|
||||
BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor
|
||||
BOOST_MOVE_STATIC_ASSERT(( !bmupd::missing_virtual_destructor
|
||||
<D, typename bmupd::get_element_type<Pointer>::type>::value ));
|
||||
}
|
||||
|
||||
@ -553,7 +552,7 @@ class unique_ptr
|
||||
{
|
||||
//If T is not an array type, U derives from T
|
||||
//it uses the default deleter and T has no virtual destructor, then you have a problem
|
||||
BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor
|
||||
BOOST_MOVE_STATIC_ASSERT(( !bmupd::missing_virtual_destructor
|
||||
<D, typename unique_ptr<U, E>::pointer>::value ));
|
||||
}
|
||||
|
||||
@ -620,7 +619,7 @@ class unique_ptr
|
||||
BOOST_MOVE_DOC1ST(element_type&, typename bmupmu::add_lvalue_reference<element_type>::type)
|
||||
operator*() const BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_STATIC_ASSERT((!bmupmu::is_array<T>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((!bmupmu::is_array<T>::value));
|
||||
return *m_data.m_p;
|
||||
}
|
||||
|
||||
@ -632,8 +631,8 @@ class unique_ptr
|
||||
BOOST_MOVE_FORCEINLINE BOOST_MOVE_DOC1ST(element_type&, typename bmupmu::add_lvalue_reference<element_type>::type)
|
||||
operator[](std::size_t i) const BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT( bmupmu::extent<T>::value == 0 || i < bmupmu::extent<T>::value );
|
||||
BOOST_ASSERT(m_data.m_p);
|
||||
assert( bmupmu::extent<T>::value == 0 || i < bmupmu::extent<T>::value );
|
||||
assert(m_data.m_p);
|
||||
return m_data.m_p[i];
|
||||
}
|
||||
|
||||
@ -646,8 +645,8 @@ class unique_ptr
|
||||
//! <b>Remarks</b: If T is an array type, the program is ill-formed.
|
||||
BOOST_MOVE_FORCEINLINE pointer operator->() const BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_STATIC_ASSERT((!bmupmu::is_array<T>::value));
|
||||
BOOST_ASSERT(m_data.m_p);
|
||||
BOOST_MOVE_STATIC_ASSERT((!bmupmu::is_array<T>::value));
|
||||
assert(m_data.m_p);
|
||||
return m_data.m_p;
|
||||
}
|
||||
|
||||
@ -711,7 +710,7 @@ class unique_ptr
|
||||
{
|
||||
//If T is not an array type, element_type_t<Pointer> derives from T
|
||||
//it uses the default deleter and T has no virtual destructor, then you have a problem
|
||||
BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor
|
||||
BOOST_MOVE_STATIC_ASSERT(( !bmupd::missing_virtual_destructor
|
||||
<D, typename bmupd::get_element_type<Pointer>::type>::value ));
|
||||
pointer tmp = m_data.m_p;
|
||||
m_data.m_p = p;
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include <boost/move/detail/workaround.hpp> //forceinline
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/move/detail/meta_utils.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
|
||||
|
||||
@ -252,7 +251,7 @@
|
||||
BOOST_MOVE_FORCEINLINE T&& forward(typename ::boost::move_detail::remove_reference<T>::type&& t) BOOST_NOEXCEPT
|
||||
{
|
||||
//"boost::forward<T> error: 'T' is a lvalue reference, can't forward as rvalue.";
|
||||
BOOST_STATIC_ASSERT(!boost::move_detail::is_lvalue_reference<T>::value);
|
||||
BOOST_MOVE_STATIC_ASSERT(!boost::move_detail::is_lvalue_reference<T>::value);
|
||||
return static_cast<T&&>(t);
|
||||
}
|
||||
|
||||
@ -292,7 +291,7 @@
|
||||
BOOST_MOVE_FORCEINLINE T&& move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference<T>::type&& t) BOOST_NOEXCEPT
|
||||
{
|
||||
//"boost::forward<T> error: 'T' is a lvalue reference, can't forward as rvalue.";
|
||||
BOOST_STATIC_ASSERT(!boost::move_detail::is_lvalue_reference<T>::value);
|
||||
BOOST_MOVE_STATIC_ASSERT(!boost::move_detail::is_lvalue_reference<T>::value);
|
||||
return static_cast<T&&>(t);
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ const char *AlgoNames [] = { "StdMerge "
|
||||
, "StdQuartAdaptMerge "
|
||||
};
|
||||
|
||||
BOOST_STATIC_ASSERT((sizeof(AlgoNames)/sizeof(*AlgoNames)) == MaxMerge);
|
||||
BOOST_MOVE_STATIC_ASSERT((sizeof(AlgoNames)/sizeof(*AlgoNames)) == MaxMerge);
|
||||
|
||||
template<class T>
|
||||
bool measure_algo(T *elements, std::size_t element_count, std::size_t split_pos, std::size_t alg, nanosecond_type &prev_clock)
|
||||
|
@ -125,7 +125,7 @@ const char *AlgoNames [] = { "MergeSort "
|
||||
, "HeapSort "
|
||||
};
|
||||
|
||||
BOOST_STATIC_ASSERT((sizeof(AlgoNames)/sizeof(*AlgoNames)) == MaxSort);
|
||||
BOOST_MOVE_STATIC_ASSERT((sizeof(AlgoNames)/sizeof(*AlgoNames)) == MaxSort);
|
||||
|
||||
template<class T>
|
||||
bool measure_algo(T *elements, std::size_t element_count, std::size_t alg, nanosecond_type &prev_clock)
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include "../example/movable.hpp"
|
||||
#include "../example/copymovable.hpp"
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
movable function(movable m)
|
||||
{
|
||||
@ -96,12 +95,12 @@ R factory_wrapper(F f)
|
||||
int main()
|
||||
{
|
||||
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
BOOST_STATIC_ASSERT((boost::has_nothrow_move<movable>::value == true));
|
||||
BOOST_STATIC_ASSERT((boost::has_move_emulation_enabled<copyable>::value == false));
|
||||
BOOST_STATIC_ASSERT((boost::has_move_emulation_enabled<copyable*>::value == false));
|
||||
BOOST_STATIC_ASSERT((boost::has_move_emulation_enabled<int>::value == false));
|
||||
BOOST_STATIC_ASSERT((boost::has_move_emulation_enabled<int&>::value == false));
|
||||
BOOST_STATIC_ASSERT((boost::has_move_emulation_enabled<int*>::value == false));
|
||||
BOOST_MOVE_STATIC_ASSERT((boost::has_nothrow_move<movable>::value == true));
|
||||
BOOST_MOVE_STATIC_ASSERT((boost::has_move_emulation_enabled<copyable>::value == false));
|
||||
BOOST_MOVE_STATIC_ASSERT((boost::has_move_emulation_enabled<copyable*>::value == false));
|
||||
BOOST_MOVE_STATIC_ASSERT((boost::has_move_emulation_enabled<int>::value == false));
|
||||
BOOST_MOVE_STATIC_ASSERT((boost::has_move_emulation_enabled<int&>::value == false));
|
||||
BOOST_MOVE_STATIC_ASSERT((boost::has_move_emulation_enabled<int*>::value == false));
|
||||
#endif
|
||||
|
||||
{
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include "../example/movable.hpp"
|
||||
#include "../example/copymovable.hpp"
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//A copy_movable_noexcept class
|
||||
|
@ -87,13 +87,13 @@ struct order_move_type
|
||||
order_move_type(BOOST_RV_REF(order_move_type) other)
|
||||
: key(other.key), val(other.val)
|
||||
{
|
||||
BOOST_ASSERT(this != &other);
|
||||
assert(this != &other);
|
||||
other.key = other.val = std::size_t(-1);
|
||||
}
|
||||
|
||||
order_move_type & operator=(BOOST_RV_REF(order_move_type) other)
|
||||
{
|
||||
BOOST_ASSERT(this != &other);
|
||||
assert(this != &other);
|
||||
key = other.key;
|
||||
val = other.val;
|
||||
other.key = other.val = std::size_t(-2);
|
||||
|
@ -11,7 +11,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/detail/type_traits.hpp>
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
//
|
||||
@ -54,9 +53,9 @@ namespace is_pod_test
|
||||
|
||||
void test()
|
||||
{
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_pod<int>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_pod<int>::value));
|
||||
#if defined(BOOST_MOVE_IS_POD)
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_pod<pod_struct>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_pod<pod_struct>::value));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -67,24 +66,24 @@ namespace trivially_memcopyable_test {
|
||||
void test()
|
||||
{
|
||||
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
|
||||
BOOST_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_constructible<deleted_copy_and_assign_type>::value));
|
||||
BOOST_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_assignable<deleted_copy_and_assign_type>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_constructible<deleted_copy_and_assign_type>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_assignable<deleted_copy_and_assign_type>::value));
|
||||
#endif //#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
|
||||
//boost_move_type
|
||||
BOOST_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_constructible<boost_move_type>::value));
|
||||
BOOST_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_assignable<boost_move_type>::value));
|
||||
BOOST_STATIC_ASSERT(!(boost::move_detail::is_copy_constructible<boost_move_type>::value));
|
||||
BOOST_STATIC_ASSERT(!(boost::move_detail::is_copy_assignable<boost_move_type>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_constructible<boost_move_type>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_assignable<boost_move_type>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT(!(boost::move_detail::is_copy_constructible<boost_move_type>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT(!(boost::move_detail::is_copy_assignable<boost_move_type>::value));
|
||||
//POD
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_trivially_copy_constructible<int>::value));
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_trivially_copy_assignable<int>::value));
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_copy_constructible<int>::value));
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_copy_assignable<int>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_trivially_copy_constructible<int>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_trivially_copy_assignable<int>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_copy_constructible<int>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_copy_assignable<int>::value));
|
||||
#if defined(BOOST_MOVE_IS_POD)
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_trivially_copy_constructible<pod_struct>::value));
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_trivially_copy_assignable<pod_struct>::value));
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_copy_constructible<pod_struct>::value));
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_copy_assignable<pod_struct>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_trivially_copy_constructible<pod_struct>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_trivially_copy_assignable<pod_struct>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_copy_constructible<pod_struct>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_copy_assignable<pod_struct>::value));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/unique_ptr.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
//////////////////////////////////////////////
|
||||
|
@ -12,7 +12,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/unique_ptr.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
//////////////////////////////////////////////
|
||||
|
@ -12,7 +12,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/unique_ptr.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/move/adl_move_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/unique_ptr.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
//////////////////////////////////////////////
|
||||
@ -267,7 +266,7 @@ void test()
|
||||
{
|
||||
//Single unique_ptr
|
||||
reset_counters();
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_convertible<B, A>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_convertible<B, A>::value));
|
||||
{
|
||||
bml::unique_ptr<B, move_constr_deleter<B> > s(new B);
|
||||
A* p = s.get();
|
||||
|
@ -12,7 +12,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/unique_ptr.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
//////////////////////////////////////////////
|
||||
|
@ -12,7 +12,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/unique_ptr.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
//////////////////////////////////////////////
|
||||
|
@ -14,7 +14,6 @@
|
||||
#define BOOST_MOVE_UNIQUE_PTR_TEST_UTILS_BEG_HPP
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/move/detail/unique_ptr_meta_utils.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
//////////////////////////////////////////////
|
||||
@ -183,7 +182,7 @@ int B::count = 0;
|
||||
|
||||
void reset_counters();
|
||||
|
||||
BOOST_STATIC_ASSERT((::boost::move_upmu::is_convertible<B, A>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((::boost::move_upmu::is_convertible<B, A>::value));
|
||||
|
||||
//Incomplete Type function declarations
|
||||
struct I;
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/unique_ptr.hpp>
|
||||
#include <boost/move/detail/type_traits.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
//////////////////////////////////////////////
|
||||
@ -51,40 +50,40 @@ void test()
|
||||
//Single unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<int> P;
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, int*>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_same<P::pointer, int*>::value));
|
||||
}
|
||||
{
|
||||
typedef bml::unique_ptr<int, Deleter> P;
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, Deleter::pointer>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_same<P::pointer, Deleter::pointer>::value));
|
||||
}
|
||||
//Unbounded array unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<int[]> P;
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, int*>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_same<P::pointer, int*>::value));
|
||||
}
|
||||
{
|
||||
typedef bml::unique_ptr<int[], Deleter> P;
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, Deleter::pointer>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_same<P::pointer, Deleter::pointer>::value));
|
||||
}
|
||||
//Bounded array unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<int[5]> P;
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, int*>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_same<P::pointer, int*>::value));
|
||||
}
|
||||
{
|
||||
typedef bml::unique_ptr<int[5], Deleter> P;
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, Deleter::pointer>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_same<P::pointer, Deleter::pointer>::value));
|
||||
}
|
||||
//Unbounded array of bounded array unique_ptr
|
||||
{
|
||||
typedef int int_5_t [5];
|
||||
typedef bml::unique_ptr<int_5_t[]> P;
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, int_5_t*>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_same<P::pointer, int_5_t*>::value));
|
||||
}
|
||||
{
|
||||
typedef int int_5_t [5];
|
||||
typedef bml::unique_ptr<int_5_t[], Deleter> P;
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, Deleter::pointer>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_same<P::pointer, Deleter::pointer>::value));
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,29 +103,29 @@ void test()
|
||||
//Single unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<int> P;
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, bml::default_delete<int> >::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, bml::default_delete<int> >::value));
|
||||
}
|
||||
{
|
||||
typedef bml::unique_ptr<int, Deleter> P;
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, Deleter >::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, Deleter >::value));
|
||||
}
|
||||
//Unbounded array unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<int[]> P;
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, bml::default_delete<int[]> >::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, bml::default_delete<int[]> >::value));
|
||||
}
|
||||
{
|
||||
typedef bml::unique_ptr<int[], Deleter> P;
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, Deleter >::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, Deleter >::value));
|
||||
}
|
||||
//Bounded array unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<int[2]> P;
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, bml::default_delete<int[2]> >::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, bml::default_delete<int[2]> >::value));
|
||||
}
|
||||
{
|
||||
typedef bml::unique_ptr<int[2], Deleter> P;
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, Deleter >::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, Deleter >::value));
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,17 +142,17 @@ void test()
|
||||
//Single unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<const int> P;
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::element_type, const int>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_same<P::element_type, const int>::value));
|
||||
}
|
||||
//Unbounded array unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<const int[]> P;
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::element_type, const int>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_same<P::element_type, const int>::value));
|
||||
}
|
||||
//Bounded array unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<const int[2]> P;
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::element_type, const int>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT((bmupmu::is_same<P::element_type, const int>::value));
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,13 +169,13 @@ namespace unique_ptr_construct_assign_traits {
|
||||
typedef bml::unique_ptr<int> unique_ptr_t;
|
||||
//Even if BOOST_MOVE_TT_CXX11_IS_COPY_CONSTRUCTIBLE is not defined
|
||||
//boost::unique_ptr shall work with boost::movelib traits
|
||||
BOOST_STATIC_ASSERT(!(boost::move_detail::is_copy_constructible<unique_ptr_t>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT(!(boost::move_detail::is_copy_constructible<unique_ptr_t>::value));
|
||||
//Even if BOOST_MOVE_TT_CXX11_IS_COPY_ASSIGNABLE is not defined
|
||||
//boost::unique_ptr shall work with boost::movelib traits
|
||||
BOOST_STATIC_ASSERT(!(boost::move_detail::is_copy_assignable<unique_ptr_t>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT(!(boost::move_detail::is_copy_assignable<unique_ptr_t>::value));
|
||||
//Important traits for containers like boost::vector
|
||||
BOOST_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_constructible<unique_ptr_t>::value));
|
||||
BOOST_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_assignable<unique_ptr_t>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_constructible<unique_ptr_t>::value));
|
||||
BOOST_MOVE_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_assignable<unique_ptr_t>::value));
|
||||
}
|
||||
|
||||
} //namespace unique_ptr_construct_assign_traits {
|
||||
|
Reference in New Issue
Block a user