mirror of
https://github.com/boostorg/move.git
synced 2025-07-30 12:27:14 +02:00
- Remove config_begin.hpp/config_end.hpp includes in tests to avoid disabling warnings.
- Fixes #30 ("(void) C-cast is a non-portable way of suppressing compiler warnings").
This commit is contained in:
@ -11,8 +11,6 @@
|
||||
#ifndef BOOST_MOVE_TEST_COPYMOVABLE_HPP
|
||||
#define BOOST_MOVE_TEST_COPYMOVABLE_HPP
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
//[copy_movable_definition
|
||||
//header file "copymovable.hpp"
|
||||
#include <boost/move/core.hpp>
|
||||
@ -59,6 +57,4 @@ class non_copy_movable
|
||||
|
||||
//]
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_MOVE_TEST_COPYMOVABLE_HPP
|
||||
|
@ -8,7 +8,6 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
//[clone_ptr_base_derived
|
||||
@ -153,5 +152,3 @@ int main()
|
||||
//]
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -9,8 +9,6 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
//[construct_forward_example
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <iostream>
|
||||
@ -105,5 +103,3 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -9,9 +9,6 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <cassert>
|
||||
|
||||
//[file_descriptor_def
|
||||
|
||||
#include <boost/move/utility_core.hpp>
|
||||
@ -25,8 +22,8 @@ class file_descriptor
|
||||
return 1;
|
||||
}
|
||||
|
||||
void operating_system_close_file(int fd)
|
||||
{ (void)fd; assert(fd != 0); }
|
||||
void operating_system_close_file(int)
|
||||
{}
|
||||
//->
|
||||
int os_descr_;
|
||||
|
||||
@ -88,5 +85,3 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -20,8 +20,6 @@ int main()
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
//[how_works_example
|
||||
#include <boost/move/core.hpp>
|
||||
#include <iostream>
|
||||
@ -58,6 +56,4 @@ int main()
|
||||
}
|
||||
//]
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -9,8 +9,6 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
//[move_algorithms_example
|
||||
#include "movable.hpp"
|
||||
#include <boost/move/algorithm.hpp>
|
||||
@ -43,4 +41,3 @@ int main()
|
||||
}
|
||||
//]
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -9,8 +9,6 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
//[move_inserter_example
|
||||
#include <boost/container/list.hpp>
|
||||
#include "movable.hpp"
|
||||
@ -48,5 +46,3 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -8,7 +8,7 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
//[move_iterator_example
|
||||
#include <boost/container/vector.hpp>
|
||||
#include "movable.hpp"
|
||||
@ -37,5 +37,3 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -9,7 +9,7 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
|
||||
//[move_return_example
|
||||
#include "movable.hpp"
|
||||
@ -61,10 +61,8 @@ int main()
|
||||
copyable c = lock_wrapper(factory_functor<copyable> ());
|
||||
non_copy_movable &mr = lock_wrapper(return_reference ());
|
||||
//<-
|
||||
(void)m; (void)cm; (void)c; (void)mr;
|
||||
boost::ignore_unused(m); boost::ignore_unused(cm); boost::ignore_unused(c); boost::ignore_unused(mr);
|
||||
//->
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -9,7 +9,6 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <boost/move/detail/meta_utils_core.hpp>
|
||||
|
||||
#include <boost/move/move.hpp>
|
||||
@ -94,5 +93,3 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -11,8 +11,6 @@
|
||||
#ifndef BOOST_MOVE_TEST_MOVABLE_HPP
|
||||
#define BOOST_MOVE_TEST_MOVABLE_HPP
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
//[movable_definition
|
||||
//header file "movable.hpp"
|
||||
#include <boost/move/core.hpp>
|
||||
@ -52,6 +50,4 @@ struct has_nothrow_move<movable>
|
||||
} //namespace boost{
|
||||
//]
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_MOVE_TEST_MOVABLE_HPP
|
||||
|
@ -98,16 +98,14 @@ inline void adaptive_merge_final_merge( RandIt first
|
||||
, typename iterator_traits<RandIt>::size_type len2
|
||||
, typename iterator_traits<RandIt>::size_type collected
|
||||
, typename iterator_traits<RandIt>::size_type l_intbuf
|
||||
, typename iterator_traits<RandIt>::size_type l_block
|
||||
, bool use_internal_buf
|
||||
, typename iterator_traits<RandIt>::size_type //l_block
|
||||
, bool //use_internal_buf
|
||||
, bool xbuf_used
|
||||
, Compare comp
|
||||
, XBuf & xbuf
|
||||
)
|
||||
{
|
||||
typedef typename iterator_traits<RandIt>::size_type size_type;
|
||||
(void)l_block;
|
||||
(void)use_internal_buf;
|
||||
size_type n_keys = collected-l_intbuf;
|
||||
size_type len = len1+len2;
|
||||
if (!xbuf_used || n_keys) {
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <boost/move/algo/detail/adaptive_sort_merge.hpp>
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace movelib {
|
||||
@ -165,7 +166,7 @@ void adaptive_sort_combine_blocks
|
||||
, Compare comp
|
||||
, bool merge_left)
|
||||
{
|
||||
(void)xbuf;
|
||||
boost::ignore_unused(xbuf);
|
||||
typedef typename iterator_traits<RandIt>::size_type size_type;
|
||||
|
||||
size_type const l_reg_combined = 2*l_prev_merged;
|
||||
@ -174,7 +175,7 @@ void adaptive_sort_combine_blocks
|
||||
size_type const n_reg_combined = len/l_reg_combined;
|
||||
RandIt combined_first = first;
|
||||
|
||||
(void)l_total_combined;
|
||||
boost::ignore_unused(l_total_combined);
|
||||
BOOST_ASSERT(l_total_combined <= len);
|
||||
|
||||
size_type const max_i = n_reg_combined + (l_irreg_combined != 0);
|
||||
|
@ -52,6 +52,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/core/ignore_unused.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
@ -312,7 +313,8 @@ void merge_blocks_bufferless
|
||||
, Compare comp)
|
||||
{
|
||||
typedef typename iterator_traits<RandIt>::size_type size_type;
|
||||
size_type const key_count = needed_keys_count(n_block_a, n_block_b); (void)key_count;
|
||||
size_type const key_count = needed_keys_count(n_block_a, n_block_b);
|
||||
::boost::ignore_unused(key_count);
|
||||
//BOOST_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]));
|
||||
@ -602,7 +604,8 @@ void unstable_sort( RandIt first, RandIt last
|
||||
, Comp comp
|
||||
, XBuf & xbuf)
|
||||
{
|
||||
heap_sort(first, last, comp);(void)xbuf;
|
||||
heap_sort(first, last, comp);
|
||||
::boost::ignore_unused(xbuf);
|
||||
}
|
||||
|
||||
template<class RandIt, class Compare, class XBuf>
|
||||
@ -943,13 +946,15 @@ OutputIt op_merge_blocks_with_irreg
|
||||
max_check = min_value<size_type>(max_value<size_type>(max_check, next_key_idx+size_type(2)), n_block_left);
|
||||
RandIt const last_reg = first_reg + l_block;
|
||||
RandIt first_min = first_reg + next_key_idx*l_block;
|
||||
RandIt const last_min = first_min + l_block; (void)last_min;
|
||||
RandIt const last_min = first_min + l_block;
|
||||
boost::ignore_unused(last_min);
|
||||
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted(first_reg, last_reg, comp));
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(!next_key_idx || boost::movelib::is_sorted(first_min, last_min, comp));
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT((!next_key_idx || !comp(*first_reg, *first_min )));
|
||||
|
||||
OutputIt orig_dest = dest; (void)orig_dest;
|
||||
OutputIt orig_dest = dest;
|
||||
boost::ignore_unused(orig_dest);
|
||||
dest = next_key_idx ? op_partial_merge_and_swap(first_irr, last_irr, first_reg, last_reg, first_min, dest, comp, op, is_stable)
|
||||
: op_partial_merge (first_irr, last_irr, first_reg, last_reg, dest, comp, op, is_stable);
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted(orig_dest, dest, comp));
|
||||
@ -995,7 +1000,9 @@ void op_merge_blocks_left
|
||||
, Compare comp, Op op)
|
||||
{
|
||||
typedef typename iterator_traits<RandIt>::size_type size_type;
|
||||
size_type const key_count = needed_keys_count(n_block_a, n_block_b); (void)key_count;
|
||||
size_type const key_count = needed_keys_count(n_block_a, n_block_b);
|
||||
boost::ignore_unused(key_count);
|
||||
|
||||
// BOOST_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]));
|
||||
@ -1023,7 +1030,9 @@ void op_merge_blocks_left
|
||||
size_type const next_key_idx = find_next_block(key_range2, key_comp, first2, l_block, min_check, max_check, comp);
|
||||
max_check = min_value<size_type>(max_value<size_type>(max_check, next_key_idx+size_type(2)), n_block_left);
|
||||
RandIt const first_min = first2 + next_key_idx*l_block;
|
||||
RandIt const last_min = first_min + l_block; (void)last_min;
|
||||
RandIt const last_min = first_min + l_block;
|
||||
|
||||
boost::ignore_unused(last_min);
|
||||
RandIt const last2 = first2 + l_block;
|
||||
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted(first1, last1, comp));
|
||||
@ -1068,7 +1077,8 @@ void op_merge_blocks_left
|
||||
unmerged = op_partial_merge_and_save
|
||||
(buffer, buffer+(last1-first1), first2, last2, first_min, buf_beg, buf_end, comp, op, is_range1_A);
|
||||
}
|
||||
(void)unmerged;
|
||||
|
||||
boost::ignore_unused(unmerged);
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted(first-l_block, unmerged, comp));
|
||||
|
||||
swap_and_update_key( key_next, key_range2, key_mid, first2, last2
|
||||
@ -1126,7 +1136,8 @@ void op_merge_blocks_left
|
||||
buffer = op_merge_blocks_with_irreg
|
||||
( key_range2, key_mid, key_comp, first2, first_irr2, last_irr2
|
||||
, buffer, l_block, n_block_left, min_check, max_check, comp, false, op);
|
||||
buffer = op(forward_t(), first_irr2, last_irr2, buffer);(void)buffer;
|
||||
buffer = op(forward_t(), first_irr2, last_irr2, buffer);
|
||||
boost::ignore_unused(buffer);
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted(first-l_block, buffer, comp));
|
||||
}
|
||||
|
||||
@ -1216,7 +1227,8 @@ void op_merge_blocks_with_buf
|
||||
, RandItBuf const buf_first)
|
||||
{
|
||||
typedef typename iterator_traits<RandIt>::size_type size_type;
|
||||
size_type const key_count = needed_keys_count(n_block_a, n_block_b); (void)key_count;
|
||||
size_type const key_count = needed_keys_count(n_block_a, n_block_b);
|
||||
boost::ignore_unused(key_count);
|
||||
//BOOST_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]));
|
||||
@ -1233,7 +1245,8 @@ void op_merge_blocks_with_buf
|
||||
RandIt first2 = last1;
|
||||
RandIt const first_irr2 = first2 + n_block_left*l_block;
|
||||
bool is_range1_A = true;
|
||||
const size_type len = l_block * n_block_a + l_block * n_block_b + l_irreg1 + l_irreg2; (void)len;
|
||||
const size_type len = l_block * n_block_a + l_block * n_block_b + l_irreg1 + l_irreg2;
|
||||
boost::ignore_unused(len);
|
||||
|
||||
RandItKeys key_range2(key_first);
|
||||
|
||||
@ -1246,10 +1259,12 @@ void op_merge_blocks_with_buf
|
||||
size_type const next_key_idx = find_next_block(key_range2, key_comp, first2, l_block, min_check, max_check, comp);
|
||||
max_check = min_value<size_type>(max_value<size_type>(max_check, next_key_idx+size_type(2)), n_block_left);
|
||||
RandIt first_min = first2 + next_key_idx*l_block;
|
||||
RandIt const last_min = first_min + l_block; (void)last_min;
|
||||
RandIt const last_min = first_min + l_block;
|
||||
boost::ignore_unused(last_min);
|
||||
RandIt const last2 = first2 + l_block;
|
||||
|
||||
bool const buffer_empty = buffer == buffer_end; (void)buffer_empty;
|
||||
bool const buffer_empty = buffer == buffer_end;
|
||||
boost::ignore_unused(buffer_empty);
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(buffer_empty ? boost::movelib::is_sorted(first1, last1, comp) : boost::movelib::is_sorted(buffer, buffer_end, comp));
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted(first2, last2, comp));
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(!n_block_left || boost::movelib::is_sorted(first_min, last_min, comp));
|
||||
@ -1270,7 +1285,8 @@ 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); (void)res;
|
||||
BOOST_ASSERT(buffer_empty || res == last1);
|
||||
boost::ignore_unused(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);
|
||||
BOOST_MOVE_ADAPTIVE_SORT_PRINT_L2(" merge_blocks_w_swp: ", len);
|
||||
@ -1307,7 +1323,8 @@ void op_merge_blocks_with_buf
|
||||
last1 += l_block;
|
||||
first2 = last2;
|
||||
}
|
||||
RandIt res = op(forward_t(), buffer, buffer_end, first1); (void)res;
|
||||
RandIt res = op(forward_t(), buffer, buffer_end, first1);
|
||||
boost::ignore_unused(res);
|
||||
BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted(first, res, comp));
|
||||
BOOST_MOVE_ADAPTIVE_SORT_PRINT_L2(" merge_blocks_w_fwd: ", len);
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#ifndef BOOST_MOVE_MERGE_HPP
|
||||
#define BOOST_MOVE_MERGE_HPP
|
||||
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
#include <boost/move/algo/move.hpp>
|
||||
#include <boost/move/adl_move_swap.hpp>
|
||||
#include <boost/move/algo/detail/basic_op.hpp>
|
||||
@ -680,7 +681,7 @@ void op_merge_with_right_placed
|
||||
if (r_first == r_last) {
|
||||
InputOutIterator end = op(forward_t(), first, last, dest_first);
|
||||
BOOST_ASSERT(end == r_last);
|
||||
(void)end;
|
||||
boost::ignore_unused(end);
|
||||
return;
|
||||
}
|
||||
else if (comp(*r_first, *first)) {
|
||||
@ -717,7 +718,7 @@ void op_merge_with_left_placed
|
||||
if(first == last) {
|
||||
BidirOutIterator res = op(backward_t(), r_first, r_last, dest_last);
|
||||
BOOST_ASSERT(last == res);
|
||||
(void)res;
|
||||
boost::ignore_unused(res);
|
||||
return;
|
||||
}
|
||||
--r_last;
|
||||
@ -781,7 +782,7 @@ void uninitialized_merge_with_right_placed
|
||||
d.release();
|
||||
InputOutIterator end = ::boost::move(first, last, original_r_first);
|
||||
BOOST_ASSERT(end == r_last);
|
||||
(void)end;
|
||||
boost::ignore_unused(end);
|
||||
return;
|
||||
}
|
||||
else if (comp(*r_first, *first)) {
|
||||
@ -800,51 +801,6 @@ void uninitialized_merge_with_right_placed
|
||||
merge_with_right_placed(first, last, original_r_first, r_first, r_last, comp);
|
||||
}
|
||||
|
||||
/*
|
||||
// [r_first, r_last) are already in the right part of the destination range.
|
||||
// [dest_first, r_first) is uninitialized memory
|
||||
template <class Compare, class BidirOutIterator, class BidirIterator>
|
||||
void uninitialized_merge_with_left_placed
|
||||
( BidirOutIterator dest_first, BidirOutIterator r_first, BidirOutIterator r_last
|
||||
, BidirIterator first, BidirIterator last
|
||||
, Compare comp)
|
||||
{
|
||||
BOOST_ASSERT((last - first) == (r_last - r_first));
|
||||
typedef typename iterator_traits<BidirOutIterator>::value_type value_type;
|
||||
BidirOutIterator const original_r_last = r_last;
|
||||
|
||||
destruct_n<value_type> d(&*dest_last);
|
||||
|
||||
while ( first != last && dest_first != original_r_first ) {
|
||||
if (r_first == r_last) {
|
||||
for(; dest_first != original_r_first; ++dest_first, ++first){
|
||||
::new(&*dest_first) value_type(::boost::move(*first));
|
||||
d.incr();
|
||||
}
|
||||
d.release();
|
||||
BidirOutIterator end = ::boost::move(first, last, original_r_first);
|
||||
BOOST_ASSERT(end == r_last);
|
||||
(void)end;
|
||||
return;
|
||||
}
|
||||
else if (comp(*r_first, *first)) {
|
||||
::new(&*dest_first) value_type(::boost::move(*r_first));
|
||||
d.incr();
|
||||
++r_first;
|
||||
}
|
||||
else {
|
||||
::new(&*dest_first) value_type(::boost::move(*first));
|
||||
d.incr();
|
||||
++first;
|
||||
}
|
||||
++dest_first;
|
||||
}
|
||||
d.release();
|
||||
merge_with_right_placed(first, last, original_r_first, r_first, r_last, comp);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/// This is a helper function for the merge routines.
|
||||
template<typename BidirectionalIterator1, typename BidirectionalIterator2>
|
||||
BidirectionalIterator1
|
||||
|
@ -8,7 +8,6 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <boost/move/adl_move_swap.hpp>
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
@ -166,4 +165,3 @@ int main()
|
||||
}
|
||||
return ::boost::report_errors();
|
||||
}
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -8,7 +8,7 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
// move
|
||||
#include <boost/move/algorithm.hpp>
|
||||
#include <boost/move/iterator.hpp>
|
||||
@ -76,5 +76,3 @@ int main()
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -8,8 +8,9 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include "../example/movable.hpp"
|
||||
#include "../example/copymovable.hpp"
|
||||
@ -23,36 +24,36 @@ class non_movable
|
||||
};
|
||||
|
||||
template<class MaybeRvalue>
|
||||
void catch_test(BOOST_RV_REF(MaybeRvalue) x
|
||||
void catch_test(BOOST_RV_REF(MaybeRvalue)
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
,typename ::boost::enable_if< ::boost::has_move_emulation_enabled<MaybeRvalue> >::type* = 0
|
||||
#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
)
|
||||
{ (void)x;}
|
||||
{}
|
||||
|
||||
template<class MaybeRvalue>
|
||||
void catch_test(BOOST_COPY_ASSIGN_REF(MaybeRvalue) x
|
||||
void catch_test(BOOST_COPY_ASSIGN_REF(MaybeRvalue)
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
,typename ::boost::enable_if< ::boost::has_move_emulation_enabled<MaybeRvalue> >::type* = 0
|
||||
#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
)
|
||||
|
||||
{ (void)x;}
|
||||
{}
|
||||
|
||||
template<class MaybeRvalue>
|
||||
void catch_test(MaybeRvalue &x
|
||||
void catch_test(MaybeRvalue &
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
,typename ::boost::enable_if< ::boost::has_move_emulation_enabled<MaybeRvalue> >::type* = 0
|
||||
#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
)
|
||||
{ (void)x;}
|
||||
{}
|
||||
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template<class MaybeRvalue>
|
||||
void catch_test(const MaybeRvalue& x
|
||||
void catch_test(const MaybeRvalue&
|
||||
,typename ::boost::disable_if< ::boost::has_move_emulation_enabled<MaybeRvalue> >::type* = 0
|
||||
)
|
||||
{ (void)x;}
|
||||
{}
|
||||
#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
movable create_movable()
|
||||
@ -113,5 +114,3 @@ int main()
|
||||
forward_test();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -2,9 +2,9 @@
|
||||
// Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <iostream>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
|
||||
#ifdef NO_MOVE
|
||||
# undef BOOST_COPY_ASSIGN_REF
|
||||
@ -148,7 +148,7 @@ X ternary( bool y )
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
(void)argv;
|
||||
::boost::ignore_unused(argv);
|
||||
// Double parens prevent "most vexing parse"
|
||||
CHECK_COPIES( X a(( lvalue() )), 1U, 1U, "Direct initialization from lvalue");
|
||||
CHECK_COPIES( X a(( rvalue() )), 0U, 1U, "Direct initialization from rvalue");
|
||||
@ -173,5 +173,3 @@ int main(int argc, char* argv[])
|
||||
CHECK_COPIES( X a = ternary( argc != 1000 ), 0U, 2U, "Return result of ternary operation again" );
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -8,7 +8,7 @@
|
||||
//Optimization:
|
||||
//Since RVO is better than move-construction,
|
||||
//avoid copy constructor overloading.
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <iostream>
|
||||
|
||||
@ -103,5 +103,3 @@ int main()
|
||||
//1 rv<T> & constructor: move constructor
|
||||
//1 const rv<T> & constructor: copy constructor
|
||||
//1 T & constructor: copy constructor
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -9,8 +9,8 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
#include "../example/movable.hpp"
|
||||
#include "../example/copymovable.hpp"
|
||||
#include <boost/static_assert.hpp>
|
||||
@ -110,40 +110,40 @@ int main()
|
||||
movable m2(boost::move(m));
|
||||
movable m3(function(movable(boost::move(m2))));
|
||||
movable m4(function(boost::move(m3)));
|
||||
(void)m;(void)m2;(void)m3;(void)m4;
|
||||
::boost::ignore_unused(m);::boost::ignore_unused(m2);::boost::ignore_unused(m3);::boost::ignore_unused(m4);
|
||||
}
|
||||
{
|
||||
movable m;
|
||||
movable m2(boost::move(m));
|
||||
movable m3(functionr(movable(boost::move(m2))));
|
||||
movable m4(functionr(boost::move(m3)));
|
||||
(void)m;(void)m2;(void)m3;(void)m4;
|
||||
::boost::ignore_unused(m);::boost::ignore_unused(m2);::boost::ignore_unused(m3);::boost::ignore_unused(m4);
|
||||
}
|
||||
{
|
||||
movable m;
|
||||
movable m2(boost::move(m));
|
||||
movable m3(function2(movable(boost::move(m2))));
|
||||
movable m4(function2(boost::move(m3)));
|
||||
(void)m;(void)m2;(void)m3;(void)m4;
|
||||
::boost::ignore_unused(m);::boost::ignore_unused(m2);::boost::ignore_unused(m3);::boost::ignore_unused(m4);
|
||||
}
|
||||
{
|
||||
movable m;
|
||||
movable m2(boost::move(m));
|
||||
movable m3(function2r(movable(boost::move(m2))));
|
||||
movable m4(function2r(boost::move(m3)));
|
||||
(void)m;(void)m2;(void)m3;(void)m4;
|
||||
::boost::ignore_unused(m);::boost::ignore_unused(m2);::boost::ignore_unused(m3);::boost::ignore_unused(m4);
|
||||
}
|
||||
{
|
||||
movable m;
|
||||
movable m2(boost::move(m));
|
||||
movable m3(move_return_function());
|
||||
(void)m;(void)m2;(void)m3;
|
||||
::boost::ignore_unused(m);::boost::ignore_unused(m2);::boost::ignore_unused(m3);
|
||||
}
|
||||
{
|
||||
movable m;
|
||||
movable m2(boost::move(m));
|
||||
movable m3(move_return_function2());
|
||||
(void)m;(void)m2;(void)m3;
|
||||
::boost::ignore_unused(m);::boost::ignore_unused(m2);::boost::ignore_unused(m3);
|
||||
}
|
||||
{
|
||||
//movable
|
||||
@ -151,9 +151,9 @@ int main()
|
||||
m = factory_wrapper<movable>(factory<movable>());
|
||||
movable&mr(factory_wrapper<movable&>(factory<movable&>()));
|
||||
movable&mr2 = factory_wrapper<movable&>(factory<movable&>());
|
||||
(void)mr;
|
||||
(void)mr2;
|
||||
(void)m;
|
||||
::boost::ignore_unused(mr);
|
||||
::boost::ignore_unused(mr2);
|
||||
::boost::ignore_unused(m);
|
||||
}
|
||||
{
|
||||
//copyable
|
||||
@ -161,9 +161,9 @@ int main()
|
||||
c = factory_wrapper<copyable>(factory<copyable>());
|
||||
copyable&cr(factory_wrapper<copyable&>(factory<copyable&>()));
|
||||
copyable&cr2 = factory_wrapper<copyable&>(factory<copyable&>());
|
||||
(void)cr;
|
||||
(void)cr2;
|
||||
(void)c;
|
||||
::boost::ignore_unused(cr);
|
||||
::boost::ignore_unused(cr2);
|
||||
::boost::ignore_unused(c);
|
||||
}
|
||||
|
||||
{
|
||||
@ -172,12 +172,10 @@ int main()
|
||||
c = factory_wrapper<copy_movable>(factory<copy_movable>());
|
||||
copy_movable&cr(factory_wrapper<copy_movable&>(factory<copy_movable&>()));
|
||||
copy_movable&cr2 = factory_wrapper<copy_movable&>(factory<copy_movable&>());
|
||||
(void)cr;
|
||||
(void)cr2;
|
||||
(void)c;
|
||||
::boost::ignore_unused(cr);
|
||||
::boost::ignore_unused(cr2);
|
||||
::boost::ignore_unused(c);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -8,7 +8,7 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
#include <boost/move/algorithm.hpp>
|
||||
#include <boost/container/vector.hpp>
|
||||
#include "../example/movable.hpp"
|
||||
@ -54,5 +54,3 @@ int main()
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -9,7 +9,7 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
#include <boost/move/utility.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include "../example/movable.hpp"
|
||||
@ -226,5 +226,3 @@ int main()
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -8,7 +8,7 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
#include <boost/move/iterator.hpp>
|
||||
#include <boost/container/vector.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
@ -40,5 +40,3 @@ int main()
|
||||
|
||||
return ::boost::report_errors();
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -11,6 +11,7 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
#include <boost/move/unique_ptr.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/move/adl_move_swap.hpp>
|
||||
@ -88,7 +89,7 @@ void test()
|
||||
bml::unique_ptr<A> p(new A);
|
||||
BOOST_TEST(A::count == 1);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset();
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@ -98,7 +99,7 @@ void test()
|
||||
bml::unique_ptr<A> p(new A);
|
||||
BOOST_TEST(A::count == 1);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new A);
|
||||
BOOST_TEST(A::count == 1);
|
||||
}
|
||||
@ -107,7 +108,7 @@ void test()
|
||||
bml::unique_ptr<A> p(new A);
|
||||
BOOST_TEST(A::count == 1);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(0);
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@ -121,7 +122,7 @@ void test()
|
||||
bml::unique_ptr<A[]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset();
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@ -131,7 +132,7 @@ void test()
|
||||
bml::unique_ptr<A[]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new A[3]);
|
||||
BOOST_TEST(A::count == 3);
|
||||
}
|
||||
@ -140,7 +141,7 @@ void test()
|
||||
bml::unique_ptr<A[]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(0);
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@ -154,7 +155,7 @@ void test()
|
||||
bml::unique_ptr<A[2]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset();
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@ -164,7 +165,7 @@ void test()
|
||||
bml::unique_ptr<A[2]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new A[3]);
|
||||
BOOST_TEST(A::count == 3);
|
||||
}
|
||||
@ -173,7 +174,7 @@ void test()
|
||||
bml::unique_ptr<A[2]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(0);
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@ -199,7 +200,7 @@ void test()
|
||||
BOOST_TEST(A::count == 1);
|
||||
BOOST_TEST(B::count == 0);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new B);
|
||||
BOOST_TEST(A::count == 1);
|
||||
BOOST_TEST(B::count == 1);
|
||||
@ -211,7 +212,7 @@ void test()
|
||||
BOOST_TEST(A::count == 1);
|
||||
BOOST_TEST(B::count == 1);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new B);
|
||||
BOOST_TEST(A::count == 1);
|
||||
BOOST_TEST(B::count == 1);
|
||||
@ -224,7 +225,7 @@ void test()
|
||||
bml::unique_ptr<const volatile A[2]> p(new const A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
const volatile A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new volatile A[3]);
|
||||
BOOST_TEST(A::count == 3);
|
||||
}
|
||||
@ -233,7 +234,7 @@ void test()
|
||||
bml::unique_ptr<const A[2]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
const A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new const A[3]);
|
||||
BOOST_TEST(A::count == 3);
|
||||
}
|
||||
@ -244,7 +245,7 @@ void test()
|
||||
bml::unique_ptr<const volatile A[2]> p(new const A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
const volatile A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new volatile A[3]);
|
||||
BOOST_TEST(A::count == 3);
|
||||
}
|
||||
@ -253,7 +254,7 @@ void test()
|
||||
bml::unique_ptr<const A[2]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
const A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new const A[3]);
|
||||
BOOST_TEST(A::count == 3);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
#include <boost/move/unique_ptr.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
@ -107,7 +108,7 @@ void test()
|
||||
bml::unique_ptr<A> p(new A);
|
||||
BOOST_TEST(A::count == 1);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(nullptr);
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@ -117,7 +118,7 @@ void test()
|
||||
bml::unique_ptr<A> p(new A);
|
||||
BOOST_TEST(A::count == 1);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p = nullptr;
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@ -143,7 +144,7 @@ void test()
|
||||
bml::unique_ptr<A[]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(nullptr);
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@ -153,7 +154,7 @@ void test()
|
||||
bml::unique_ptr<A[]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p = nullptr;
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@ -178,7 +179,7 @@ void test()
|
||||
bml::unique_ptr<A[2]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(nullptr);
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@ -188,7 +189,7 @@ void test()
|
||||
bml::unique_ptr<A[2]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p = nullptr;
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
|
Reference in New Issue
Block a user