Use directly boost::movelib::to_raw_pointer/iterator_to_raw_pointer

This commit is contained in:
Ion Gaztañaga
2017-04-07 16:07:00 +02:00
parent a7e2bed8f1
commit 1d727753e2
15 changed files with 152 additions and 177 deletions

View File

@@ -31,11 +31,11 @@
#include <boost/container/detail/alloc_helpers.hpp> #include <boost/container/detail/alloc_helpers.hpp>
#include <boost/container/detail/copy_move_algo.hpp> #include <boost/container/detail/copy_move_algo.hpp>
#include <boost/container/detail/iterator.hpp> #include <boost/container/detail/iterator.hpp>
#include <boost/container/detail/iterator_to_raw_pointer.hpp> #include <boost/move/detail/iterator_to_raw_pointer.hpp>
#include <boost/container/detail/iterators.hpp> #include <boost/container/detail/iterators.hpp>
#include <boost/container/detail/min_max.hpp> #include <boost/container/detail/min_max.hpp>
#include <boost/container/detail/mpl.hpp> #include <boost/container/detail/mpl.hpp>
#include <boost/container/detail/to_raw_pointer.hpp> #include <boost/move/detail/to_raw_pointer.hpp>
#include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/type_traits.hpp>
// move // move
#include <boost/move/adl_move_swap.hpp> #include <boost/move/adl_move_swap.hpp>
@@ -1649,7 +1649,7 @@ class deque : protected deque_base<Allocator>
if (this->members_.m_start.m_cur != this->members_.m_start.m_last - 1) { if (this->members_.m_start.m_cur != this->members_.m_start.m_last - 1) {
allocator_traits_type::destroy allocator_traits_type::destroy
( this->alloc() ( this->alloc()
, container_detail::to_raw_pointer(this->members_.m_start.m_cur) , boost::movelib::to_raw_pointer(this->members_.m_start.m_cur)
); );
++this->members_.m_start.m_cur; ++this->members_.m_start.m_cur;
} }
@@ -1669,7 +1669,7 @@ class deque : protected deque_base<Allocator>
--this->members_.m_finish.m_cur; --this->members_.m_finish.m_cur;
allocator_traits_type::destroy allocator_traits_type::destroy
( this->alloc() ( this->alloc()
, container_detail::to_raw_pointer(this->members_.m_finish.m_cur) , boost::movelib::to_raw_pointer(this->members_.m_finish.m_cur)
); );
} }
else else
@@ -1916,7 +1916,7 @@ class deque : protected deque_base<Allocator>
T *priv_push_back_simple_pos() const T *priv_push_back_simple_pos() const
{ {
return container_detail::to_raw_pointer(this->members_.m_finish.m_cur); return boost::movelib::to_raw_pointer(this->members_.m_finish.m_cur);
} }
void priv_push_back_simple_commit() void priv_push_back_simple_commit()
@@ -1931,7 +1931,7 @@ class deque : protected deque_base<Allocator>
} }
T *priv_push_front_simple_pos() const T *priv_push_front_simple_pos() const
{ return container_detail::to_raw_pointer(this->members_.m_start.m_cur) - 1; } { return boost::movelib::to_raw_pointer(this->members_.m_start.m_cur) - 1; }
void priv_push_front_simple_commit() void priv_push_front_simple_commit()
{ --this->members_.m_start.m_cur; } { --this->members_.m_start.m_cur; }
@@ -1940,7 +1940,7 @@ class deque : protected deque_base<Allocator>
{ {
if(!Base::traits_t::trivial_dctr){ if(!Base::traits_t::trivial_dctr){
for(;p != p2; ++p){ for(;p != p2; ++p){
allocator_traits_type::destroy(this->alloc(), container_detail::iterator_to_raw_pointer(p)); allocator_traits_type::destroy(this->alloc(), boost::movelib::iterator_to_raw_pointer(p));
} }
} }
} }
@@ -1949,7 +1949,7 @@ class deque : protected deque_base<Allocator>
{ {
if(!Base::traits_t::trivial_dctr){ if(!Base::traits_t::trivial_dctr){
for(;p != p2; ++p){ for(;p != p2; ++p){
allocator_traits_type::destroy(this->alloc(), container_detail::iterator_to_raw_pointer(p)); allocator_traits_type::destroy(this->alloc(), boost::movelib::iterator_to_raw_pointer(p));
} }
} }
} }
@@ -2133,7 +2133,7 @@ class deque : protected deque_base<Allocator>
this->members_.m_finish.m_cur = this->members_.m_finish.m_last - 1; this->members_.m_finish.m_cur = this->members_.m_finish.m_last - 1;
allocator_traits_type::destroy allocator_traits_type::destroy
( this->alloc() ( this->alloc()
, container_detail::to_raw_pointer(this->members_.m_finish.m_cur) , boost::movelib::to_raw_pointer(this->members_.m_finish.m_cur)
); );
} }
@@ -2145,7 +2145,7 @@ class deque : protected deque_base<Allocator>
{ {
allocator_traits_type::destroy allocator_traits_type::destroy
( this->alloc() ( this->alloc()
, container_detail::to_raw_pointer(this->members_.m_start.m_cur) , boost::movelib::to_raw_pointer(this->members_.m_start.m_cur)
); );
this->priv_deallocate_node(this->members_.m_start.m_first); this->priv_deallocate_node(this->members_.m_start.m_first);
this->members_.m_start.priv_set_node(this->members_.m_start.m_node + 1); this->members_.m_start.priv_set_node(this->members_.m_start.m_node + 1);

View File

@@ -28,10 +28,10 @@
// container/detail // container/detail
#include <boost/container/detail/pool_common.hpp> #include <boost/container/detail/pool_common.hpp>
#include <boost/container/detail/iterator.hpp> #include <boost/container/detail/iterator.hpp>
#include <boost/container/detail/iterator_to_raw_pointer.hpp> #include <boost/move/detail/iterator_to_raw_pointer.hpp>
#include <boost/container/detail/math_functions.hpp> #include <boost/container/detail/math_functions.hpp>
#include <boost/container/detail/mpl.hpp> #include <boost/container/detail/mpl.hpp>
#include <boost/container/detail/to_raw_pointer.hpp> #include <boost/move/detail/to_raw_pointer.hpp>
#include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/type_traits.hpp>
// intrusive // intrusive
#include <boost/intrusive/pointer_traits.hpp> #include <boost/intrusive/pointer_traits.hpp>
@@ -378,7 +378,7 @@ class private_adaptive_node_pool_impl
//!Returns the segment manager. Never throws //!Returns the segment manager. Never throws
segment_manager_base_type* get_segment_manager_base()const segment_manager_base_type* get_segment_manager_base()const
{ return container_detail::to_raw_pointer(mp_segment_mngr_base); } { return boost::movelib::to_raw_pointer(mp_segment_mngr_base); }
//!Allocates array of count elements. Can throw //!Allocates array of count elements. Can throw
void *allocate_node() void *allocate_node()
@@ -390,7 +390,7 @@ class private_adaptive_node_pool_impl
free_nodes_t &free_nodes = m_block_container.begin()->free_nodes; free_nodes_t &free_nodes = m_block_container.begin()->free_nodes;
BOOST_ASSERT(!free_nodes.empty()); BOOST_ASSERT(!free_nodes.empty());
const size_type free_nodes_count = free_nodes.size(); const size_type free_nodes_count = free_nodes.size();
void *first_node = container_detail::to_raw_pointer(free_nodes.pop_front()); void *first_node = boost::movelib::to_raw_pointer(free_nodes.pop_front());
if(free_nodes.empty()){ if(free_nodes.empty()){
block_container_traits_t::erase_first(m_block_container); block_container_traits_t::erase_first(m_block_container);
} }
@@ -401,7 +401,7 @@ class private_adaptive_node_pool_impl
else{ else{
multiallocation_chain chain; multiallocation_chain chain;
this->priv_append_from_new_blocks(1, chain, IsAlignOnly()); this->priv_append_from_new_blocks(1, chain, IsAlignOnly());
return container_detail::to_raw_pointer(chain.pop_front()); return boost::movelib::to_raw_pointer(chain.pop_front());
} }
} }
@@ -492,7 +492,7 @@ class private_adaptive_node_pool_impl
free_nodes_iterator itf(nodes.begin()), itbf(itbb); free_nodes_iterator itf(nodes.begin()), itbf(itbb);
size_type splice_node_count = size_type(-1); size_type splice_node_count = size_type(-1);
while(itf != ite){ while(itf != ite){
void *pElem = container_detail::to_raw_pointer(container_detail::iterator_to_raw_pointer(itf)); void *pElem = boost::movelib::to_raw_pointer(boost::movelib::iterator_to_raw_pointer(itf));
block_info_t &block_info = *this->priv_block_from_node(pElem); block_info_t &block_info = *this->priv_block_from_node(pElem);
BOOST_ASSERT(block_info.free_nodes.size() < m_real_num_node); BOOST_ASSERT(block_info.free_nodes.size() < m_real_num_node);
++splice_node_count; ++splice_node_count;
@@ -631,7 +631,7 @@ class private_adaptive_node_pool_impl
BOOST_ASSERT(to_deallocate->free_nodes.size() == mp_impl->m_real_num_node); BOOST_ASSERT(to_deallocate->free_nodes.size() == mp_impl->m_real_num_node);
BOOST_ASSERT(0 == to_deallocate->hdr_offset); BOOST_ASSERT(0 == to_deallocate->hdr_offset);
hdr_offset_holder *hdr_off_holder = hdr_offset_holder *hdr_off_holder =
mp_impl->priv_first_subblock_from_block(container_detail::to_raw_pointer(to_deallocate)); mp_impl->priv_first_subblock_from_block(boost::movelib::to_raw_pointer(to_deallocate));
m_chain.push_back(hdr_off_holder); m_chain.push_back(hdr_off_holder);
} }
@@ -763,7 +763,7 @@ class private_adaptive_node_pool_impl
//First add all possible nodes to the chain //First add all possible nodes to the chain
const size_type left = total_elements - chain.size(); const size_type left = total_elements - chain.size();
const size_type max_chain = (num_node < left) ? num_node : left; const size_type max_chain = (num_node < left) ? num_node : left;
mem_address = static_cast<char *>(container_detail::to_raw_pointer mem_address = static_cast<char *>(boost::movelib::to_raw_pointer
(chain.incorporate_after(chain.last(), void_pointer(mem_address), m_real_node_size, max_chain))); (chain.incorporate_after(chain.last(), void_pointer(mem_address), m_real_node_size, max_chain)));
//Now store remaining nodes in the free list //Now store remaining nodes in the free list
if(const size_type max_free = num_node - max_chain){ if(const size_type max_free = num_node - max_chain){

View File

@@ -31,7 +31,7 @@
#include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/type_traits.hpp>
#include <boost/container/detail/iterator.hpp> #include <boost/container/detail/iterator.hpp>
#include <boost/container/detail/iterators.hpp> #include <boost/container/detail/iterators.hpp>
#include <boost/container/detail/iterator_to_raw_pointer.hpp> #include <boost/move/detail/iterator_to_raw_pointer.hpp>
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#include <boost/move/detail/fwd_macros.hpp> #include <boost/move/detail/fwd_macros.hpp>
#endif #endif
@@ -157,7 +157,7 @@ struct insert_copy_proxy
void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const
{ {
BOOST_ASSERT(n == 1); (void)n; BOOST_ASSERT(n == 1); (void)n;
alloc_traits::construct( a, iterator_to_raw_pointer(p), v_); alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), v_);
} }
void copy_n_and_update(Allocator &, Iterator p, size_type n) const void copy_n_and_update(Allocator &, Iterator p, size_type n) const
@@ -184,7 +184,7 @@ struct insert_move_proxy
void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const
{ {
BOOST_ASSERT(n == 1); (void)n; BOOST_ASSERT(n == 1); (void)n;
alloc_traits::construct( a, iterator_to_raw_pointer(p), ::boost::move(v_) ); alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), ::boost::move(v_) );
} }
void copy_n_and_update(Allocator &, Iterator p, size_type n) const void copy_n_and_update(Allocator &, Iterator p, size_type n) const
@@ -240,7 +240,7 @@ struct insert_nonmovable_emplace_proxy
void priv_uninitialized_copy_some_and_update(Allocator &a, const index_tuple<IdxPack...>&, Iterator p, size_type n) void priv_uninitialized_copy_some_and_update(Allocator &a, const index_tuple<IdxPack...>&, Iterator p, size_type n)
{ {
BOOST_ASSERT(n == 1); (void)n; BOOST_ASSERT(n == 1); (void)n;
alloc_traits::construct( a, iterator_to_raw_pointer(p), ::boost::forward<Args>(get<IdxPack>(this->args_))... ); alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), ::boost::forward<Args>(get<IdxPack>(this->args_))... );
} }
protected: protected:
@@ -354,7 +354,7 @@ struct insert_nonmovable_emplace_proxy##N\
void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n)\ void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n)\
{\ {\
BOOST_ASSERT(n == 1); (void)n;\ BOOST_ASSERT(n == 1); (void)n;\
alloc_traits::construct(a, iterator_to_raw_pointer(p) BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\ alloc_traits::construct(a, boost::movelib::iterator_to_raw_pointer(p) BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\
}\ }\
\ \
void copy_n_and_update(Allocator &, Iterator, size_type)\ void copy_n_and_update(Allocator &, Iterator, size_type)\

View File

@@ -22,7 +22,7 @@
#include <boost/container/allocator_traits.hpp> #include <boost/container/allocator_traits.hpp>
// container/detail // container/detail
#include <boost/container/detail/iterator.hpp> #include <boost/container/detail/iterator.hpp>
#include <boost/container/detail/iterator_to_raw_pointer.hpp> #include <boost/move/detail/iterator_to_raw_pointer.hpp>
#include <boost/container/detail/mpl.hpp> #include <boost/container/detail/mpl.hpp>
#include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/type_traits.hpp>
#include <boost/container/detail/construct_in_place.hpp> #include <boost/container/detail/construct_in_place.hpp>
@@ -178,7 +178,7 @@ inline F memmove(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW
typedef typename boost::container::iterator_traits<I>::value_type value_type; typedef typename boost::container::iterator_traits<I>::value_type value_type;
typename boost::container::iterator_traits<I>::difference_type n = boost::container::iterator_distance(f, l); typename boost::container::iterator_traits<I>::difference_type n = boost::container::iterator_distance(f, l);
if(n){ if(n){
std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n); std::memmove(boost::movelib::iterator_to_raw_pointer(r), boost::movelib::iterator_to_raw_pointer(f), sizeof(value_type)*n);
boost::container::iterator_advance(r, n); boost::container::iterator_advance(r, n);
} }
return r; return r;
@@ -192,7 +192,7 @@ F memmove_n(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW
{ {
typedef typename boost::container::iterator_traits<I>::value_type value_type; typedef typename boost::container::iterator_traits<I>::value_type value_type;
if(n){ if(n){
std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n); std::memmove(boost::movelib::iterator_to_raw_pointer(r), boost::movelib::iterator_to_raw_pointer(f), sizeof(value_type)*n);
boost::container::iterator_advance(r, n); boost::container::iterator_advance(r, n);
} }
return r; return r;
@@ -206,7 +206,7 @@ I memmove_n_source(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW
{ {
if(n){ if(n){
typedef typename boost::container::iterator_traits<I>::value_type value_type; typedef typename boost::container::iterator_traits<I>::value_type value_type;
std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n); std::memmove(boost::movelib::iterator_to_raw_pointer(r), boost::movelib::iterator_to_raw_pointer(f), sizeof(value_type)*n);
boost::container::iterator_advance(f, n); boost::container::iterator_advance(f, n);
} }
return f; return f;
@@ -220,7 +220,7 @@ I memmove_n_source_dest(I f, U n, F &r) BOOST_NOEXCEPT_OR_NOTHROW
{ {
typedef typename boost::container::iterator_traits<I>::value_type value_type; typedef typename boost::container::iterator_traits<I>::value_type value_type;
if(n){ if(n){
std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n); std::memmove(boost::movelib::iterator_to_raw_pointer(r), boost::movelib::iterator_to_raw_pointer(f), sizeof(value_type)*n);
boost::container::iterator_advance(f, n); boost::container::iterator_advance(f, n);
boost::container::iterator_advance(r, n); boost::container::iterator_advance(r, n);
} }
@@ -295,13 +295,13 @@ inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F
F back = r; F back = r;
BOOST_TRY{ BOOST_TRY{
while (f != l) { while (f != l) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), boost::move(*f)); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), boost::move(*f));
++f; ++r; ++f; ++r;
} }
} }
BOOST_CATCH(...){ BOOST_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_RETHROW;
} }
@@ -340,13 +340,13 @@ inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F
F back = r; F back = r;
BOOST_TRY{ BOOST_TRY{
while (n--) { while (n--) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), boost::move(*f)); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), boost::move(*f));
++f; ++r; ++f; ++r;
} }
} }
BOOST_CATCH(...){ BOOST_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_RETHROW;
} }
@@ -385,13 +385,13 @@ inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F
F back = r; F back = r;
BOOST_TRY{ BOOST_TRY{
while (n--) { while (n--) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), boost::move(*f)); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), boost::move(*f));
++f; ++r; ++f; ++r;
} }
} }
BOOST_CATCH(...){ BOOST_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_RETHROW;
} }
@@ -430,13 +430,13 @@ inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F
F back = r; F back = r;
BOOST_TRY{ BOOST_TRY{
while (f != l) { while (f != l) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), *f); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), *f);
++f; ++r; ++f; ++r;
} }
} }
BOOST_CATCH(...){ BOOST_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_RETHROW;
} }
@@ -475,13 +475,13 @@ inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F
F back = r; F back = r;
BOOST_TRY{ BOOST_TRY{
while (n--) { while (n--) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), *f); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), *f);
++f; ++r; ++f; ++r;
} }
} }
BOOST_CATCH(...){ BOOST_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_RETHROW;
} }
@@ -520,13 +520,13 @@ inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F
F back = r; F back = r;
BOOST_TRY{ BOOST_TRY{
while (n--) { while (n--) {
boost::container::construct_in_place(a, container_detail::iterator_to_raw_pointer(r), f); boost::container::construct_in_place(a, boost::movelib::iterator_to_raw_pointer(r), f);
++f; ++r; ++f; ++r;
} }
} }
BOOST_CATCH(...){ BOOST_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_RETHROW;
} }
@@ -564,13 +564,13 @@ inline typename container_detail::disable_if_memzero_initializable<F, F>::type
F back = r; F back = r;
BOOST_TRY{ BOOST_TRY{
while (n--) { while (n--) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r)); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r));
++r; ++r;
} }
} }
BOOST_CATCH(...){ BOOST_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_RETHROW;
} }
@@ -585,7 +585,7 @@ inline typename container_detail::enable_if_memzero_initializable<F, F>::type
uninitialized_value_init_alloc_n(Allocator &, typename boost::container::allocator_traits<Allocator>::size_type n, F r) uninitialized_value_init_alloc_n(Allocator &, typename boost::container::allocator_traits<Allocator>::size_type n, F r)
{ {
typedef typename boost::container::iterator_traits<F>::value_type value_type; typedef typename boost::container::iterator_traits<F>::value_type value_type;
std::memset((void*)container_detail::iterator_to_raw_pointer(r), 0, sizeof(value_type)*n); std::memset((void*)boost::movelib::iterator_to_raw_pointer(r), 0, sizeof(value_type)*n);
boost::container::iterator_advance(r, n); boost::container::iterator_advance(r, n);
return r; return r;
} }
@@ -611,13 +611,13 @@ inline F uninitialized_default_init_alloc_n(Allocator &a, typename boost::contai
F back = r; F back = r;
BOOST_TRY{ BOOST_TRY{
while (n--) { while (n--) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), default_init); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), default_init);
++r; ++r;
} }
} }
BOOST_CATCH(...){ BOOST_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_RETHROW;
} }
@@ -647,13 +647,13 @@ inline void uninitialized_fill_alloc(Allocator &a, F f, F l, const T &t)
F back = f; F back = f;
BOOST_TRY{ BOOST_TRY{
while (f != l) { while (f != l) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(f), t); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(f), t);
++f; ++f;
} }
} }
BOOST_CATCH(...){ BOOST_CATCH(...){
for (; back != l; ++back){ for (; back != l; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_RETHROW;
} }
@@ -683,13 +683,13 @@ inline F uninitialized_fill_alloc_n(Allocator &a, const T &v, typename boost::co
F back = r; F back = r;
BOOST_TRY{ BOOST_TRY{
while (n--) { while (n--) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), v); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), v);
++r; ++r;
} }
} }
BOOST_CATCH(...){ BOOST_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_RETHROW;
} }
@@ -890,7 +890,7 @@ inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>
typedef typename boost::container::iterator_traits<I>::value_type value_type; typedef typename boost::container::iterator_traits<I>::value_type value_type;
const typename boost::container::iterator_traits<I>::difference_type n = boost::container::iterator_distance(f, l); const typename boost::container::iterator_traits<I>::difference_type n = boost::container::iterator_distance(f, l);
r -= n; r -= n;
std::memmove((container_detail::iterator_to_raw_pointer)(r), (container_detail::iterator_to_raw_pointer)(f), sizeof(value_type)*n); std::memmove((boost::movelib::iterator_to_raw_pointer)(r), (boost::movelib::iterator_to_raw_pointer)(f), sizeof(value_type)*n);
return r; return r;
} }
@@ -964,7 +964,7 @@ inline typename container_detail::disable_if_trivially_destructible<I, void>::ty
destroy_alloc_n(Allocator &a, I f, U n) destroy_alloc_n(Allocator &a, I f, U n)
{ {
while(n--){ while(n--){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(f)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(f));
++f; ++f;
} }
} }
@@ -1021,9 +1021,9 @@ inline typename container_detail::enable_if_c
storage_type storage; storage_type storage;
const std::size_t n_i_bytes = sizeof(value_type)*n_i; const std::size_t n_i_bytes = sizeof(value_type)*n_i;
void *const large_ptr = static_cast<void*>(container_detail::iterator_to_raw_pointer(large_range_f)); void *const large_ptr = static_cast<void*>(boost::movelib::iterator_to_raw_pointer(large_range_f));
void *const short_ptr = static_cast<void*>(container_detail::iterator_to_raw_pointer(short_range_f)); void *const short_ptr = static_cast<void*>(boost::movelib::iterator_to_raw_pointer(short_range_f));
void *const stora_ptr = static_cast<void*>(container_detail::iterator_to_raw_pointer(storage)); void *const stora_ptr = static_cast<void*>(boost::movelib::iterator_to_raw_pointer(storage));
std::memcpy(stora_ptr, large_ptr, n_i_bytes); std::memcpy(stora_ptr, large_ptr, n_i_bytes);
std::memcpy(large_ptr, short_ptr, n_i_bytes); std::memcpy(large_ptr, short_ptr, n_i_bytes);
std::memcpy(short_ptr, stora_ptr, n_i_bytes); std::memcpy(short_ptr, stora_ptr, n_i_bytes);
@@ -1052,8 +1052,8 @@ inline typename container_detail::enable_if_c
const std::size_t sizeof_storage = sizeof(storage); const std::size_t sizeof_storage = sizeof(storage);
std::size_t n_i_bytes = sizeof(value_type)*n_i; std::size_t n_i_bytes = sizeof(value_type)*n_i;
char *large_ptr = static_cast<char*>(static_cast<void*>(container_detail::iterator_to_raw_pointer(large_range_f))); char *large_ptr = static_cast<char*>(static_cast<void*>(boost::movelib::iterator_to_raw_pointer(large_range_f)));
char *short_ptr = static_cast<char*>(static_cast<void*>(container_detail::iterator_to_raw_pointer(short_range_f))); char *short_ptr = static_cast<char*>(static_cast<void*>(boost::movelib::iterator_to_raw_pointer(short_range_f)));
char *stora_ptr = static_cast<char*>(static_cast<void*>(&storage)); char *stora_ptr = static_cast<char*>(static_cast<void*>(&storage));
std::size_t szt_times = n_i_bytes/sizeof_storage; std::size_t szt_times = n_i_bytes/sizeof_storage;

View File

@@ -25,7 +25,7 @@
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
#include <boost/container/allocator_traits.hpp> #include <boost/container/allocator_traits.hpp>
#include <boost/container/detail/to_raw_pointer.hpp> #include <boost/move/detail/to_raw_pointer.hpp>
#include <boost/container/detail/version_type.hpp> #include <boost/container/detail/version_type.hpp>
namespace boost { namespace boost {
@@ -152,7 +152,7 @@ struct scoped_destroy_deallocator
~scoped_destroy_deallocator() ~scoped_destroy_deallocator()
{ {
if(m_ptr){ if(m_ptr){
AllocTraits::destroy(m_alloc, container_detail::to_raw_pointer(m_ptr)); AllocTraits::destroy(m_alloc, boost::movelib::to_raw_pointer(m_ptr));
priv_deallocate(m_ptr, alloc_version()); priv_deallocate(m_ptr, alloc_version());
} }
} }
@@ -202,7 +202,7 @@ struct scoped_destructor_n
~scoped_destructor_n() ~scoped_destructor_n()
{ {
if(!m_p) return; if(!m_p) return;
value_type *raw_ptr = container_detail::to_raw_pointer(m_p); value_type *raw_ptr = boost::movelib::to_raw_pointer(m_p);
while(m_n--){ while(m_n--){
AllocTraits::destroy(m_a, raw_ptr++); AllocTraits::destroy(m_a, raw_ptr++);
} }
@@ -317,7 +317,7 @@ class allocator_destroyer
void operator()(const pointer &p) void operator()(const pointer &p)
{ {
AllocTraits::destroy(a_, container_detail::to_raw_pointer(p)); AllocTraits::destroy(a_, boost::movelib::to_raw_pointer(p));
this->priv_deallocate(p, alloc_version()); this->priv_deallocate(p, alloc_version());
} }
}; };
@@ -339,7 +339,7 @@ class allocator_destroyer_and_chain_builder
void operator()(const typename Allocator::pointer &p) void operator()(const typename Allocator::pointer &p)
{ {
allocator_traits<Allocator>::destroy(a_, container_detail::to_raw_pointer(p)); allocator_traits<Allocator>::destroy(a_, boost::movelib::to_raw_pointer(p));
c_.push_back(p); c_.push_back(p);
} }
}; };

View File

@@ -859,10 +859,10 @@ class flat_tree
{ {
sequence_type &tseq = m_data.m_seq; sequence_type &tseq = m_data.m_seq;
boost::movelib::adaptive_sort boost::movelib::adaptive_sort
( container_detail::iterator_to_raw_pointer(seq.begin()) ( boost::movelib::iterator_to_raw_pointer(seq.begin())
, container_detail::iterator_to_raw_pointer(seq.end()) , boost::movelib::iterator_to_raw_pointer(seq.end())
, this->priv_value_comp() , this->priv_value_comp()
, container_detail::iterator_to_raw_pointer(tseq.begin() + tseq.size()) , boost::movelib::iterator_to_raw_pointer(tseq.begin() + tseq.size())
, tseq.capacity() - tseq.size()); , tseq.capacity() - tseq.size());
tseq = boost::move(seq); tseq = boost::move(seq);
} }
@@ -878,10 +878,10 @@ class flat_tree
{ {
sequence_type &tseq = m_data.m_seq; sequence_type &tseq = m_data.m_seq;
boost::movelib::adaptive_sort boost::movelib::adaptive_sort
( container_detail::iterator_to_raw_pointer(seq.begin()) ( boost::movelib::iterator_to_raw_pointer(seq.begin())
, container_detail::iterator_to_raw_pointer(seq.end()) , boost::movelib::iterator_to_raw_pointer(seq.end())
, this->priv_value_comp() , this->priv_value_comp()
, container_detail::iterator_to_raw_pointer(tseq.begin() + tseq.size()) , boost::movelib::iterator_to_raw_pointer(tseq.begin() + tseq.size())
, tseq.capacity() - tseq.size()); , tseq.capacity() - tseq.size());
seq.erase( boost::movelib::unique seq.erase( boost::movelib::unique
(seq.begin(), seq.end(), boost::movelib::negate<value_compare>(this->m_data.get_comp())) (seq.begin(), seq.end(), boost::movelib::negate<value_compare>(this->m_data.get_comp()))

View File

@@ -18,38 +18,13 @@
# pragma once # pragma once
#endif #endif
#include <boost/container/detail/iterator.hpp> #include <boost/move/detail/iterator_to_raw_pointer.hpp>
#include <boost/container/detail/to_raw_pointer.hpp>
#include <boost/intrusive/pointer_traits.hpp>
namespace boost { namespace boost {
namespace container { namespace container {
namespace container_detail { namespace container_detail {
template <class T> using ::boost::movelib::iterator_to_raw_pointer;
inline T* iterator_to_pointer(T* i)
{ return i; }
template <class Iterator>
inline typename boost::container::iterator_traits<Iterator>::pointer
iterator_to_pointer(const Iterator &i)
{ return i.operator->(); }
template <class Iterator>
struct iterator_to_element_ptr
{
typedef typename boost::container::iterator_traits<Iterator>::pointer pointer;
typedef typename boost::intrusive::pointer_traits<pointer>::element_type element_type;
typedef element_type* type;
};
template <class Iterator>
inline typename iterator_to_element_ptr<Iterator>::type
iterator_to_raw_pointer(const Iterator &i)
{
return ::boost::intrusive::detail::to_raw_pointer
( ::boost::container::container_detail::iterator_to_pointer(i) );
}
} //namespace container_detail { } //namespace container_detail {
} //namespace container { } //namespace container {

View File

@@ -24,7 +24,7 @@
// container // container
#include <boost/container/container_fwd.hpp> #include <boost/container/container_fwd.hpp>
// container/detail // container/detail
#include <boost/container/detail/to_raw_pointer.hpp> #include <boost/move/detail/to_raw_pointer.hpp>
#include <boost/container/detail/transform_iterator.hpp> #include <boost/container/detail/transform_iterator.hpp>
#include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/type_traits.hpp>
// intrusive // intrusive
@@ -63,7 +63,7 @@ class basic_multiallocation_chain
pointer_traits<node_ptr> node_ptr_traits; pointer_traits<node_ptr> node_ptr_traits;
static node & to_node(const VoidPointer &p) static node & to_node(const VoidPointer &p)
{ return *static_cast<node*>(static_cast<void*>(container_detail::to_raw_pointer(p))); } { return *static_cast<node*>(static_cast<void*>(boost::movelib::to_raw_pointer(p))); }
static VoidPointer from_node(node &n) static VoidPointer from_node(node &n)
{ return node_ptr_traits::pointer_to(n); } { return node_ptr_traits::pointer_to(n); }
@@ -152,7 +152,7 @@ class basic_multiallocation_chain
char_ptr prev_elem = elem; char_ptr prev_elem = elem;
elem += unit_bytes; elem += unit_bytes;
for(size_type i = 0; i != num_units-1; ++i, elem += unit_bytes){ for(size_type i = 0; i != num_units-1; ++i, elem += unit_bytes){
::new (container_detail::to_raw_pointer(prev_elem)) void_pointer(elem); ::new (boost::movelib::to_raw_pointer(prev_elem)) void_pointer(elem);
prev_elem = elem; prev_elem = elem;
} }
slist_impl_.incorporate_after(after_this, to_node_ptr(b), to_node_ptr(prev_elem), num_units); slist_impl_.incorporate_after(after_this, to_node_ptr(b), to_node_ptr(prev_elem), num_units);

View File

@@ -30,10 +30,10 @@
#include <boost/container/detail/allocator_version_traits.hpp> #include <boost/container/detail/allocator_version_traits.hpp>
#include <boost/container/detail/construct_in_place.hpp> #include <boost/container/detail/construct_in_place.hpp>
#include <boost/container/detail/destroyers.hpp> #include <boost/container/detail/destroyers.hpp>
#include <boost/container/detail/iterator_to_raw_pointer.hpp> #include <boost/move/detail/iterator_to_raw_pointer.hpp>
#include <boost/container/detail/mpl.hpp> #include <boost/container/detail/mpl.hpp>
#include <boost/container/detail/placement_new.hpp> #include <boost/container/detail/placement_new.hpp>
#include <boost/container/detail/to_raw_pointer.hpp> #include <boost/move/detail/to_raw_pointer.hpp>
#include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/type_traits.hpp>
#include <boost/container/detail/version_type.hpp> #include <boost/container/detail/version_type.hpp>
// intrusive // intrusive
@@ -171,7 +171,7 @@ struct node_alloc_holder
node_deallocator.release(); node_deallocator.release();
//This does not throw //This does not throw
typedef typename Node::hook_type hook_type; typedef typename Node::hook_type hook_type;
::new(static_cast<hook_type*>(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type; ::new(static_cast<hook_type*>(boost::movelib::to_raw_pointer(p)), boost_container_new_t()) hook_type;
return (p); return (p);
} }
@@ -189,7 +189,7 @@ struct node_alloc_holder
BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
node_deallocator.release();\ node_deallocator.release();\
typedef typename Node::hook_type hook_type;\ typedef typename Node::hook_type hook_type;\
::new(static_cast<hook_type*>(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type;\ ::new(static_cast<hook_type*>(boost::movelib::to_raw_pointer(p)), boost_container_new_t()) hook_type;\
return (p);\ return (p);\
}\ }\
// //
@@ -207,7 +207,7 @@ struct node_alloc_holder
node_deallocator.release(); node_deallocator.release();
//This does not throw //This does not throw
typedef typename Node::hook_type hook_type; typedef typename Node::hook_type hook_type;
::new(static_cast<hook_type*>(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type; ::new(static_cast<hook_type*>(boost::movelib::to_raw_pointer(p)), boost_container_new_t()) hook_type;
return (p); return (p);
} }
@@ -230,13 +230,13 @@ struct node_alloc_holder
node_deallocator.release(); node_deallocator.release();
//This does not throw //This does not throw
typedef typename Node::hook_type hook_type; typedef typename Node::hook_type hook_type;
::new(static_cast<hook_type*>(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type; ::new(static_cast<hook_type*>(boost::movelib::to_raw_pointer(p)), boost_container_new_t()) hook_type;
return (p); return (p);
} }
void destroy_node(const NodePtr &nodep) void destroy_node(const NodePtr &nodep)
{ {
allocator_traits<NodeAlloc>::destroy(this->node_alloc(), container_detail::to_raw_pointer(nodep)); allocator_traits<NodeAlloc>::destroy(this->node_alloc(), boost::movelib::to_raw_pointer(nodep));
this->deallocate_one(nodep); this->deallocate_one(nodep);
} }
@@ -266,7 +266,7 @@ struct node_alloc_holder
Deallocator node_deallocator(NodePtr(), nalloc); Deallocator node_deallocator(NodePtr(), nalloc);
container_detail::scoped_destructor<NodeAlloc> sdestructor(nalloc, 0); container_detail::scoped_destructor<NodeAlloc> sdestructor(nalloc, 0);
while(n--){ while(n--){
p = container_detail::iterator_to_raw_pointer(itbeg); p = boost::movelib::iterator_to_raw_pointer(itbeg);
node_deallocator.set(p); node_deallocator.set(p);
++itbeg; ++itbeg;
//This can throw //This can throw

View File

@@ -25,7 +25,7 @@
#include <boost/container/detail/math_functions.hpp> #include <boost/container/detail/math_functions.hpp>
#include <boost/container/detail/mpl.hpp> #include <boost/container/detail/mpl.hpp>
#include <boost/container/detail/pool_common.hpp> #include <boost/container/detail/pool_common.hpp>
#include <boost/container/detail/to_raw_pointer.hpp> #include <boost/move/detail/to_raw_pointer.hpp>
#include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/type_traits.hpp>
#include <boost/intrusive/pointer_traits.hpp> #include <boost/intrusive/pointer_traits.hpp>
@@ -92,7 +92,7 @@ class private_node_pool_impl
//!Returns the segment manager. Never throws //!Returns the segment manager. Never throws
segment_manager_base_type* get_segment_manager_base()const segment_manager_base_type* get_segment_manager_base()const
{ return container_detail::to_raw_pointer(mp_segment_mngr_base); } { return boost::movelib::to_raw_pointer(mp_segment_mngr_base); }
void *allocate_node() void *allocate_node()
{ return this->priv_alloc_node(); } { return this->priv_alloc_node(); }

View File

@@ -23,7 +23,7 @@
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/container/detail/placement_new.hpp> #include <boost/container/detail/placement_new.hpp>
#include <boost/container/detail/to_raw_pointer.hpp> #include <boost/move/detail/to_raw_pointer.hpp>
#include <boost/container/allocator_traits.hpp> #include <boost/container/allocator_traits.hpp>
#include <boost/container/detail/mpl.hpp> #include <boost/container/detail/mpl.hpp>
@@ -123,7 +123,7 @@ class node_handle
void destroy_deallocate_node() void destroy_deallocate_node()
{ {
nator_traits::destroy(this->node_alloc(), container_detail::to_raw_pointer(m_ptr)); nator_traits::destroy(this->node_alloc(), boost::movelib::to_raw_pointer(m_ptr));
nator_traits::deallocate(this->node_alloc(), m_ptr, 1u); nator_traits::deallocate(this->node_alloc(), m_ptr, 1u);
} }

View File

@@ -387,8 +387,8 @@ class small_vector_base
this->steal_resources(x); this->steal_resources(x);
} }
else{ else{
this->assign( boost::make_move_iterator(container_detail::iterator_to_raw_pointer(x.begin())) this->assign( boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(x.begin()))
, boost::make_move_iterator(container_detail::iterator_to_raw_pointer(x.end ())) , boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(x.end ()))
); );
} }
} }

View File

@@ -44,7 +44,7 @@
#include <boost/container/detail/iterator.hpp> #include <boost/container/detail/iterator.hpp>
#include <boost/container/detail/iterators.hpp> #include <boost/container/detail/iterators.hpp>
#include <boost/container/detail/placement_new.hpp> #include <boost/container/detail/placement_new.hpp>
#include <boost/container/detail/to_raw_pointer.hpp> #include <boost/move/detail/to_raw_pointer.hpp>
#include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/type_traits.hpp>
// intrusive // intrusive
#include <boost/intrusive/pointer_traits.hpp> #include <boost/intrusive/pointer_traits.hpp>
@@ -1975,7 +1975,7 @@ class stable_vector
, container_detail::addressof(p->value) , container_detail::addressof(p->value)
, it); , it);
//This does not throw //This does not throw
::new(static_cast<node_base_type*>(container_detail::to_raw_pointer(p)), boost_container_new_t()) ::new(static_cast<node_base_type*>(boost::movelib::to_raw_pointer(p)), boost_container_new_t())
node_base_type(index_traits_type::ptr_to_node_base_ptr(*up_index)); node_base_type(index_traits_type::ptr_to_node_base_ptr(*up_index));
} }
@@ -1988,7 +1988,7 @@ class stable_vector
, container_detail::addressof(p->value) , container_detail::addressof(p->value)
, ::boost::forward<ValueConvertible>(value_convertible)); , ::boost::forward<ValueConvertible>(value_convertible));
//This does not throw //This does not throw
::new(static_cast<node_base_type*>(container_detail::to_raw_pointer(p)), boost_container_new_t()) node_base_type; ::new(static_cast<node_base_type*>(boost::movelib::to_raw_pointer(p)), boost_container_new_t()) node_base_type;
} }
void priv_swap_members(stable_vector &x) void priv_swap_members(stable_vector &x)

View File

@@ -35,7 +35,7 @@
#include <boost/container/detail/min_max.hpp> #include <boost/container/detail/min_max.hpp>
#include <boost/container/detail/mpl.hpp> #include <boost/container/detail/mpl.hpp>
#include <boost/container/detail/next_capacity.hpp> #include <boost/container/detail/next_capacity.hpp>
#include <boost/container/detail/to_raw_pointer.hpp> #include <boost/move/detail/to_raw_pointer.hpp>
#include <boost/container/detail/version_type.hpp> #include <boost/container/detail/version_type.hpp>
#include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/type_traits.hpp>
#include <boost/container/detail/minimal_char_traits_header.hpp> #include <boost/container/detail/minimal_char_traits_header.hpp>
@@ -308,14 +308,14 @@ class basic_string_base
{ {
allocator_traits_type::construct allocator_traits_type::construct
( this->alloc() ( this->alloc()
, container_detail::to_raw_pointer(p) , boost::movelib::to_raw_pointer(p)
, value , value
); );
} }
void destroy(pointer p, size_type n) void destroy(pointer p, size_type n)
{ {
value_type *raw_p = container_detail::to_raw_pointer(p); value_type *raw_p = boost::movelib::to_raw_pointer(p);
for(; n--; ++raw_p){ for(; n--; ++raw_p){
allocator_traits_type::destroy( this->alloc(), raw_p); allocator_traits_type::destroy( this->alloc(), raw_p);
} }
@@ -325,7 +325,7 @@ class basic_string_base
{ {
allocator_traits_type::destroy allocator_traits_type::destroy
( this->alloc() ( this->alloc()
, container_detail::to_raw_pointer(p) , boost::movelib::to_raw_pointer(p)
); );
} }
@@ -1158,8 +1158,8 @@ class basic_string
size_type long_storage = this->priv_long_storage(); size_type long_storage = this->priv_long_storage();
size_type long_size = this->priv_long_size(); size_type long_size = this->priv_long_size();
//Shrink from allocated buffer to the internal one, including trailing null //Shrink from allocated buffer to the internal one, including trailing null
Traits::copy( container_detail::to_raw_pointer(this->priv_short_addr()) Traits::copy( boost::movelib::to_raw_pointer(this->priv_short_addr())
, container_detail::to_raw_pointer(long_addr) , boost::movelib::to_raw_pointer(long_addr)
, long_size+1); , long_size+1);
this->is_short(true); this->is_short(true);
this->alloc().deallocate(long_addr, long_storage); this->alloc().deallocate(long_addr, long_storage);
@@ -1492,7 +1492,7 @@ class basic_string
{ {
size_type n = static_cast<size_type>(last - first); size_type n = static_cast<size_type>(last - first);
this->reserve(n); this->reserve(n);
CharT* ptr = container_detail::to_raw_pointer(this->priv_addr()); CharT* ptr = boost::movelib::to_raw_pointer(this->priv_addr());
Traits::copy(ptr, first, n); Traits::copy(ptr, first, n);
this->priv_construct_null(ptr + n); this->priv_construct_null(ptr + n);
this->priv_size(n); this->priv_size(n);
@@ -1511,7 +1511,7 @@ class basic_string
{ {
size_type cur = 0; size_type cur = 0;
const pointer addr = this->priv_addr(); const pointer addr = this->priv_addr();
CharT *ptr = container_detail::to_raw_pointer(addr); CharT *ptr = boost::movelib::to_raw_pointer(addr);
const size_type old_size = this->priv_size(); const size_type old_size = this->priv_size();
while (first != last && cur != old_size) { while (first != last && cur != old_size) {
Traits::assign(*ptr, *first); Traits::assign(*ptr, *first);
@@ -1570,7 +1570,7 @@ class basic_string
size_type len = container_detail::min_value(n, str_size - pos2); size_type len = container_detail::min_value(n, str_size - pos2);
if (sz > this->max_size() - len) if (sz > this->max_size() - len)
throw_length_error("basic_string::insert max_size() exceeded"); throw_length_error("basic_string::insert max_size() exceeded");
const CharT *beg_ptr = container_detail::to_raw_pointer(s.begin()) + pos2; const CharT *beg_ptr = boost::movelib::to_raw_pointer(s.begin()) + pos2;
const CharT *end_ptr = beg_ptr + len; const CharT *end_ptr = beg_ptr + len;
this->insert(this->priv_addr() + pos1, beg_ptr, end_ptr); this->insert(this->priv_addr() + pos1, beg_ptr, end_ptr);
return *this; return *this;
@@ -1730,10 +1730,10 @@ class basic_string
pointer_past_last, pointer_past_last); pointer_past_last, pointer_past_last);
this->priv_size(old_size+n); this->priv_size(old_size+n);
Traits::move(const_cast<CharT*>(container_detail::to_raw_pointer(p + n)), Traits::move(const_cast<CharT*>(boost::movelib::to_raw_pointer(p + n)),
container_detail::to_raw_pointer(p), boost::movelib::to_raw_pointer(p),
(elems_after - n) + 1); (elems_after - n) + 1);
this->priv_copy(first, last, const_cast<CharT*>(container_detail::to_raw_pointer(p))); this->priv_copy(first, last, const_cast<CharT*>(boost::movelib::to_raw_pointer(p)));
} }
else { else {
ForwardIter mid = first; ForwardIter mid = first;
@@ -1746,7 +1746,7 @@ class basic_string
(p, const_iterator(old_start + old_length + 1), (p, const_iterator(old_start + old_length + 1),
old_start + newer_size); old_start + newer_size);
this->priv_size(newer_size + elems_after); this->priv_size(newer_size + elems_after);
this->priv_copy(first, mid, const_cast<CharT*>(container_detail::to_raw_pointer(p))); this->priv_copy(first, mid, const_cast<CharT*>(boost::movelib::to_raw_pointer(p)));
} }
} }
else{ else{
@@ -1773,9 +1773,9 @@ class basic_string
else{ else{
//value_type is POD, so backwards expansion is much easier //value_type is POD, so backwards expansion is much easier
//than with vector<T> //than with vector<T>
value_type * const oldbuf = container_detail::to_raw_pointer(old_start); value_type * const oldbuf = boost::movelib::to_raw_pointer(old_start);
value_type * const newbuf = container_detail::to_raw_pointer(new_start); value_type * const newbuf = boost::movelib::to_raw_pointer(new_start);
const value_type *const pos = container_detail::to_raw_pointer(p); const value_type *const pos = boost::movelib::to_raw_pointer(p);
const size_type before = pos - oldbuf; const size_type before = pos - oldbuf;
//First move old data //First move old data
@@ -1847,10 +1847,10 @@ class basic_string
iterator erase(const_iterator p) BOOST_NOEXCEPT_OR_NOTHROW iterator erase(const_iterator p) BOOST_NOEXCEPT_OR_NOTHROW
{ {
// The move includes the terminating null. // The move includes the terminating null.
CharT * const ptr = const_cast<CharT*>(container_detail::to_raw_pointer(p)); CharT * const ptr = const_cast<CharT*>(boost::movelib::to_raw_pointer(p));
const size_type old_size = this->priv_size(); const size_type old_size = this->priv_size();
Traits::move(ptr, Traits::move(ptr,
container_detail::to_raw_pointer(p + 1), boost::movelib::to_raw_pointer(p + 1),
old_size - (p - this->priv_addr())); old_size - (p - this->priv_addr()));
this->priv_size(old_size-1); this->priv_size(old_size-1);
return iterator(ptr); return iterator(ptr);
@@ -1866,12 +1866,12 @@ class basic_string
//! the other elements being erased. If no such element exists, end() is returned. //! the other elements being erased. If no such element exists, end() is returned.
iterator erase(const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW iterator erase(const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW
{ {
CharT * f = const_cast<CharT*>(container_detail::to_raw_pointer(first)); CharT * f = const_cast<CharT*>(boost::movelib::to_raw_pointer(first));
if (first != last) { // The move includes the terminating null. if (first != last) { // The move includes the terminating null.
const size_type num_erased = last - first; const size_type num_erased = last - first;
const size_type old_size = this->priv_size(); const size_type old_size = this->priv_size();
Traits::move(f, Traits::move(f,
container_detail::to_raw_pointer(last), boost::movelib::to_raw_pointer(last),
(old_size + 1)-(last - this->priv_addr())); (old_size + 1)-(last - this->priv_addr()));
const size_type new_length = old_size - num_erased; const size_type new_length = old_size - num_erased;
this->priv_size(new_length); this->priv_size(new_length);
@@ -2059,11 +2059,11 @@ class basic_string
{ {
const size_type len = static_cast<size_type>(i2 - i1); const size_type len = static_cast<size_type>(i2 - i1);
if (len >= n) { if (len >= n) {
Traits::assign(const_cast<CharT*>(container_detail::to_raw_pointer(i1)), n, c); Traits::assign(const_cast<CharT*>(boost::movelib::to_raw_pointer(i1)), n, c);
erase(i1 + n, i2); erase(i1 + n, i2);
} }
else { else {
Traits::assign(const_cast<CharT*>(container_detail::to_raw_pointer(i1)), len, c); Traits::assign(const_cast<CharT*>(boost::movelib::to_raw_pointer(i1)), len, c);
insert(i2, n - len, c); insert(i2, n - len, c);
} }
return *this; return *this;
@@ -2088,7 +2088,7 @@ class basic_string
) )
{ {
for ( ; i1 != i2 && j1 != j2; ++i1, ++j1){ for ( ; i1 != i2 && j1 != j2; ++i1, ++j1){
Traits::assign(*const_cast<CharT*>(container_detail::to_raw_pointer(i1)), *j1); Traits::assign(*const_cast<CharT*>(boost::movelib::to_raw_pointer(i1)), *j1);
} }
if (j1 == j2) if (j1 == j2)
@@ -2111,13 +2111,13 @@ class basic_string
difference_type n = boost::container::iterator_distance(j1, j2); difference_type n = boost::container::iterator_distance(j1, j2);
const difference_type len = i2 - i1; const difference_type len = i2 - i1;
if (len >= n) { if (len >= n) {
this->priv_copy(j1, j2, const_cast<CharT*>(container_detail::to_raw_pointer(i1))); this->priv_copy(j1, j2, const_cast<CharT*>(boost::movelib::to_raw_pointer(i1)));
this->erase(i1 + n, i2); this->erase(i1 + n, i2);
} }
else { else {
ForwardIter m = j1; ForwardIter m = j1;
boost::container::iterator_advance(m, len); boost::container::iterator_advance(m, len);
this->priv_copy(j1, m, const_cast<CharT*>(container_detail::to_raw_pointer(i1))); this->priv_copy(j1, m, const_cast<CharT*>(boost::movelib::to_raw_pointer(i1)));
this->insert(i2, m, j2); this->insert(i2, m, j2);
} }
return *this; return *this;
@@ -2166,7 +2166,7 @@ class basic_string
if (pos > this->size()) if (pos > this->size())
throw_out_of_range("basic_string::copy out of range position"); throw_out_of_range("basic_string::copy out of range position");
const size_type len = container_detail::min_value(n, this->size() - pos); const size_type len = container_detail::min_value(n, this->size() - pos);
Traits::copy(s, container_detail::to_raw_pointer(this->priv_addr() + pos), len); Traits::copy(s, boost::movelib::to_raw_pointer(this->priv_addr() + pos), len);
return len; return len;
} }
@@ -2195,7 +2195,7 @@ class basic_string
//! //!
//! <b>Complexity</b>: constant time. //! <b>Complexity</b>: constant time.
const CharT* c_str() const BOOST_NOEXCEPT_OR_NOTHROW const CharT* c_str() const BOOST_NOEXCEPT_OR_NOTHROW
{ return container_detail::to_raw_pointer(this->priv_addr()); } { return boost::movelib::to_raw_pointer(this->priv_addr()); }
//! <b>Requires</b>: The program shall not alter any of the values stored in the character array. //! <b>Requires</b>: The program shall not alter any of the values stored in the character array.
//! //!
@@ -2203,13 +2203,13 @@ class basic_string
//! //!
//! <b>Complexity</b>: constant time. //! <b>Complexity</b>: constant time.
const CharT* data() const BOOST_NOEXCEPT_OR_NOTHROW const CharT* data() const BOOST_NOEXCEPT_OR_NOTHROW
{ return container_detail::to_raw_pointer(this->priv_addr()); } { return boost::movelib::to_raw_pointer(this->priv_addr()); }
//! <b>Returns</b>: A pointer p such that p + i == &operator[](i) for each i in [0,size()]. //! <b>Returns</b>: A pointer p such that p + i == &operator[](i) for each i in [0,size()].
//! //!
//! <b>Complexity</b>: constant time. //! <b>Complexity</b>: constant time.
CharT* data() BOOST_NOEXCEPT_OR_NOTHROW CharT* data() BOOST_NOEXCEPT_OR_NOTHROW
{ return container_detail::to_raw_pointer(this->priv_addr()); } { return boost::movelib::to_raw_pointer(this->priv_addr()); }
#ifndef BOOST_CONTAINER_TEMPLATED_CONVERSION_OPERATOR_BROKEN #ifndef BOOST_CONTAINER_TEMPLATED_CONVERSION_OPERATOR_BROKEN
//! <b>Returns</b>: a string_view to the characters in the string. //! <b>Returns</b>: a string_view to the characters in the string.
@@ -2272,8 +2272,8 @@ class basic_string
const pointer addr = this->priv_addr(); const pointer addr = this->priv_addr();
pointer finish = addr + this->priv_size(); pointer finish = addr + this->priv_size();
const const_iterator result = const const_iterator result =
std::search(container_detail::to_raw_pointer(addr + pos), std::search(boost::movelib::to_raw_pointer(addr + pos),
container_detail::to_raw_pointer(finish), boost::movelib::to_raw_pointer(finish),
s, s + n, Eq_traits<Traits>()); s, s + n, Eq_traits<Traits>());
return result != finish ? result - begin() : npos; return result != finish ? result - begin() : npos;
} }
@@ -2804,8 +2804,8 @@ class basic_string
{ {
const difference_type n1 = l1 - f1; const difference_type n1 = l1 - f1;
const difference_type n2 = l2 - f2; const difference_type n2 = l2 - f2;
const int cmp = Traits::compare(container_detail::to_raw_pointer(f1), const int cmp = Traits::compare(boost::movelib::to_raw_pointer(f1),
container_detail::to_raw_pointer(f2), boost::movelib::to_raw_pointer(f2),
container_detail::min_value(n1, n2)); container_detail::min_value(n1, n2));
return cmp != 0 ? cmp : (n1 < n2 ? -1 : (n1 > n2 ? 1 : 0)); return cmp != 0 ? cmp : (n1 < n2 ? -1 : (n1 > n2 ? 1 : 0));
} }
@@ -2826,8 +2826,8 @@ class basic_string
real_cap = long_size+1; real_cap = long_size+1;
const pointer ret = this->allocation_command(allocate_new, long_size+1, real_cap, reuse); const pointer ret = this->allocation_command(allocate_new, long_size+1, real_cap, reuse);
//Copy and update //Copy and update
Traits::copy( container_detail::to_raw_pointer(ret) Traits::copy( boost::movelib::to_raw_pointer(ret)
, container_detail::to_raw_pointer(this->priv_long_addr()) , boost::movelib::to_raw_pointer(this->priv_long_addr())
, long_size+1); , long_size+1);
this->priv_long_addr(ret); this->priv_long_addr(ret);
this->priv_storage(real_cap); this->priv_storage(real_cap);

View File

@@ -36,10 +36,10 @@
#include <boost/container/detail/destroyers.hpp> #include <boost/container/detail/destroyers.hpp>
#include <boost/container/detail/iterator.hpp> #include <boost/container/detail/iterator.hpp>
#include <boost/container/detail/iterators.hpp> #include <boost/container/detail/iterators.hpp>
#include <boost/container/detail/iterator_to_raw_pointer.hpp> #include <boost/move/detail/iterator_to_raw_pointer.hpp>
#include <boost/container/detail/mpl.hpp> #include <boost/container/detail/mpl.hpp>
#include <boost/container/detail/next_capacity.hpp> #include <boost/container/detail/next_capacity.hpp>
#include <boost/container/detail/to_raw_pointer.hpp> #include <boost/move/detail/to_raw_pointer.hpp>
#include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/type_traits.hpp>
#include <boost/container/detail/version_type.hpp> #include <boost/container/detail/version_type.hpp>
// intrusive // intrusive
@@ -613,7 +613,7 @@ struct vector_alloc_holder<Allocator, version_0>
, m_size(holder.m_size) //Size is initialized here so vector should only call uninitialized_xxx after this , m_size(holder.m_size) //Size is initialized here so vector should only call uninitialized_xxx after this
{ {
::boost::container::uninitialized_move_alloc_n ::boost::container::uninitialized_move_alloc_n
(this->alloc(), container_detail::to_raw_pointer(holder.start()), m_size, container_detail::to_raw_pointer(this->start())); (this->alloc(), boost::movelib::to_raw_pointer(holder.start()), m_size, boost::movelib::to_raw_pointer(this->start()));
} }
template<class OtherAllocator, class OtherAllocatorVersion> template<class OtherAllocator, class OtherAllocatorVersion>
@@ -625,7 +625,7 @@ struct vector_alloc_holder<Allocator, version_0>
const size_type n = holder.m_size; const size_type n = holder.m_size;
this->priv_first_allocation(n); this->priv_first_allocation(n);
::boost::container::uninitialized_move_alloc_n ::boost::container::uninitialized_move_alloc_n
(this->alloc(), container_detail::to_raw_pointer(holder.start()), n, container_detail::to_raw_pointer(this->start())); (this->alloc(), boost::movelib::to_raw_pointer(holder.start()), n, boost::movelib::to_raw_pointer(this->start()));
} }
BOOST_CONTAINER_FORCEINLINE void priv_first_allocation(size_type cap) BOOST_CONTAINER_FORCEINLINE void priv_first_allocation(size_type cap)
@@ -679,8 +679,8 @@ struct vector_alloc_holder<Allocator, version_0>
void priv_deep_swap(vector_alloc_holder<OtherAllocator, OtherAllocatorVersion> &x) void priv_deep_swap(vector_alloc_holder<OtherAllocator, OtherAllocatorVersion> &x)
{ {
const size_type MaxTmpStorage = sizeof(value_type)*Allocator::internal_capacity; const size_type MaxTmpStorage = sizeof(value_type)*Allocator::internal_capacity;
value_type *const first_this = container_detail::to_raw_pointer(this->start()); value_type *const first_this = boost::movelib::to_raw_pointer(this->start());
value_type *const first_x = container_detail::to_raw_pointer(x.start()); value_type *const first_x = boost::movelib::to_raw_pointer(x.start());
if(this->m_size < x.m_size){ if(this->m_size < x.m_size){
boost::container::deep_swap_alloc_n<MaxTmpStorage>(this->alloc(), first_this, this->m_size, first_x, x.m_size); boost::container::deep_swap_alloc_n<MaxTmpStorage>(this->alloc(), first_this, this->m_size, first_x, x.m_size);
@@ -1190,7 +1190,7 @@ class vector
if (first == last){ if (first == last){
//There are no more elements in the sequence, erase remaining //There are no more elements in the sequence, erase remaining
T* const end_pos = this->priv_raw_end(); T* const end_pos = this->priv_raw_end();
const size_type n = static_cast<size_type>(end_pos - container_detail::iterator_to_raw_pointer(cur)); const size_type n = static_cast<size_type>(end_pos - boost::movelib::iterator_to_raw_pointer(cur));
this->priv_destroy_last_n(n); this->priv_destroy_last_n(n);
} }
else{ else{
@@ -2009,7 +2009,7 @@ class vector
{ {
BOOST_ASSERT(this->priv_in_range(position)); BOOST_ASSERT(this->priv_in_range(position));
const pointer p = vector_iterator_get_ptr(position); const pointer p = vector_iterator_get_ptr(position);
T *const pos_ptr = container_detail::to_raw_pointer(p); T *const pos_ptr = boost::movelib::to_raw_pointer(p);
T *const beg_ptr = this->priv_raw_begin(); T *const beg_ptr = this->priv_raw_begin();
T *const new_end_ptr = ::boost::container::move(pos_ptr + 1, beg_ptr + this->m_holder.m_size, pos_ptr); T *const new_end_ptr = ::boost::container::move(pos_ptr + 1, beg_ptr + this->m_holder.m_size, pos_ptr);
//Move elements forward and destroy last //Move elements forward and destroy last
@@ -2029,9 +2029,9 @@ class vector
(first < last && this->priv_in_range(first) && this->priv_in_range_or_end(last))); (first < last && this->priv_in_range(first) && this->priv_in_range_or_end(last)));
if (first != last){ if (first != last){
T* const old_end_ptr = this->priv_raw_end(); T* const old_end_ptr = this->priv_raw_end();
T* const first_ptr = container_detail::to_raw_pointer(vector_iterator_get_ptr(first)); T* const first_ptr = boost::movelib::to_raw_pointer(vector_iterator_get_ptr(first));
T* const last_ptr = container_detail::to_raw_pointer(vector_iterator_get_ptr(last)); T* const last_ptr = boost::movelib::to_raw_pointer(vector_iterator_get_ptr(last));
T* const ptr = container_detail::to_raw_pointer(boost::container::move(last_ptr, old_end_ptr, first_ptr)); T* const ptr = boost::movelib::to_raw_pointer(boost::container::move(last_ptr, old_end_ptr, first_ptr));
this->priv_destroy_last_n(old_end_ptr - ptr); this->priv_destroy_last_n(old_end_ptr - ptr);
} }
return iterator(vector_iterator_get_ptr(first)); return iterator(vector_iterator_get_ptr(first));
@@ -2245,7 +2245,7 @@ class vector
this->priv_merge_in_new_buffer(UniqueBool(), first, n, comp, p, new_cap); this->priv_merge_in_new_buffer(UniqueBool(), first, n, comp, p, new_cap);
} }
else{ else{
T *raw_pos = container_detail::iterator_to_raw_pointer(this->insert(this->cend(), first, last)); T *raw_pos = boost::movelib::iterator_to_raw_pointer(this->insert(this->cend(), first, last));
T *raw_beg = this->priv_raw_begin(); T *raw_beg = this->priv_raw_begin();
T *raw_end = this->priv_raw_end(); T *raw_end = this->priv_raw_end();
boost::movelib::adaptive_merge(raw_beg, raw_pos, raw_end, comp, raw_end, free_c - n); boost::movelib::adaptive_merge(raw_beg, raw_pos, raw_end, comp, raw_end, free_c - n);
@@ -2272,7 +2272,7 @@ class vector
T* pbeg = this->priv_raw_begin(); T* pbeg = this->priv_raw_begin();
size_type const old_size = this->size(); size_type const old_size = this->size();
T* const pend = pbeg + old_size; T* const pend = pbeg + old_size;
T* d_first = container_detail::to_raw_pointer(new_storage); T* d_first = boost::movelib::to_raw_pointer(new_storage);
size_type added = n; size_type added = n;
//Merge in new buffer loop //Merge in new buffer loop
while(1){ while(1){
@@ -2308,7 +2308,7 @@ class vector
//Nothrow operations //Nothrow operations
pointer const old_p = this->m_holder.start(); pointer const old_p = this->m_holder.start();
size_type const old_cap = this->m_holder.capacity(); size_type const old_cap = this->m_holder.capacity();
boost::container::destroy_alloc_n(a, container_detail::to_raw_pointer(old_p), old_size); boost::container::destroy_alloc_n(a, boost::movelib::to_raw_pointer(old_p), old_size);
a.deallocate(old_p, old_cap); a.deallocate(old_p, old_cap);
this->m_holder.m_size = old_size + added; this->m_holder.m_size = old_size + added;
this->m_holder.start(new_storage); this->m_holder.start(new_storage);
@@ -2379,8 +2379,8 @@ class vector
} }
//Else do a one by one move //Else do a one by one move
else{ else{
this->assign( boost::make_move_iterator(container_detail::iterator_to_raw_pointer(x.begin())) this->assign( boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(x.begin()))
, boost::make_move_iterator(container_detail::iterator_to_raw_pointer(x.end() )) , boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(x.end() ))
); );
} }
//Move allocator if needed //Move allocator if needed
@@ -2449,8 +2449,8 @@ class vector
} }
//... and move-insert the remaining range //... and move-insert the remaining range
sml.insert( sml.cend() sml.insert( sml.cend()
, boost::make_move_iterator(container_detail::iterator_to_raw_pointer(big.nth(common_elements))) , boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(big.nth(common_elements)))
, boost::make_move_iterator(container_detail::iterator_to_raw_pointer(big.end())) , boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(big.end()))
); );
//Destroy remaining elements //Destroy remaining elements
big.erase(big.nth(common_elements), big.cend()); big.erase(big.nth(common_elements), big.cend());
@@ -2475,7 +2475,7 @@ class vector
pointer const p = allocator_traits_type::allocate(this->m_holder.alloc(), new_cap, this->m_holder.m_start); pointer const p = allocator_traits_type::allocate(this->m_holder.alloc(), new_cap, this->m_holder.m_start);
//We will reuse insert code, so create a dummy input iterator //We will reuse insert code, so create a dummy input iterator
this->priv_forward_range_insert_new_allocation this->priv_forward_range_insert_new_allocation
( container_detail::to_raw_pointer(p), new_cap, this->priv_raw_end(), 0, this->priv_dummy_empty_proxy()); ( boost::movelib::to_raw_pointer(p), new_cap, this->priv_raw_end(), 0, this->priv_dummy_empty_proxy());
} }
void priv_reserve_no_capacity(size_type new_cap, version_2) void priv_reserve_no_capacity(size_type new_cap, version_2)
@@ -2496,7 +2496,7 @@ class vector
this->m_holder.capacity(real_cap); this->m_holder.capacity(real_cap);
} }
else{ //If there is no forward expansion, move objects, we will reuse insertion code else{ //If there is no forward expansion, move objects, we will reuse insertion code
T * const new_mem = container_detail::to_raw_pointer(ret); T * const new_mem = boost::movelib::to_raw_pointer(ret);
T * const ins_pos = this->priv_raw_end(); T * const ins_pos = this->priv_raw_end();
if(reuse){ //Backwards (and possibly forward) expansion if(reuse){ //Backwards (and possibly forward) expansion
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
@@ -2626,7 +2626,7 @@ class vector
++this->num_alloc; ++this->num_alloc;
#endif #endif
this->priv_forward_range_insert_new_allocation this->priv_forward_range_insert_new_allocation
( container_detail::to_raw_pointer(p), sz ( boost::movelib::to_raw_pointer(p), sz
, this->priv_raw_begin(), 0, this->priv_dummy_empty_proxy()); , this->priv_raw_begin(), 0, this->priv_dummy_empty_proxy());
} }
} }
@@ -2670,11 +2670,11 @@ class vector
{ {
//Check if we have enough memory or try to expand current memory //Check if we have enough memory or try to expand current memory
const size_type n_pos = pos - this->m_holder.start(); const size_type n_pos = pos - this->m_holder.start();
T *const raw_pos = container_detail::to_raw_pointer(pos); T *const raw_pos = boost::movelib::to_raw_pointer(pos);
const size_type new_cap = this->m_holder.next_capacity(n); const size_type new_cap = this->m_holder.next_capacity(n);
//Pass the hint so that allocators can take advantage of this. //Pass the hint so that allocators can take advantage of this.
T * const new_buf = container_detail::to_raw_pointer T * const new_buf = boost::movelib::to_raw_pointer
(allocator_traits_type::allocate(this->m_holder.alloc(), new_cap, this->m_holder.m_start)); (allocator_traits_type::allocate(this->m_holder.alloc(), new_cap, this->m_holder.m_start));
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
++this->num_alloc; ++this->num_alloc;
@@ -2689,7 +2689,7 @@ class vector
(const pointer &pos, const size_type n, const InsertionProxy insert_range_proxy, version_2) (const pointer &pos, const size_type n, const InsertionProxy insert_range_proxy, version_2)
{ {
//Check if we have enough memory or try to expand current memory //Check if we have enough memory or try to expand current memory
T *const raw_pos = container_detail::to_raw_pointer(pos); T *const raw_pos = boost::movelib::to_raw_pointer(pos);
const size_type n_pos = raw_pos - this->priv_raw_begin(); const size_type n_pos = raw_pos - this->priv_raw_begin();
//There is not enough memory, allocate a new //There is not enough memory, allocate a new
@@ -2716,7 +2716,7 @@ class vector
++this->num_expand_bwd; ++this->num_expand_bwd;
#endif #endif
this->priv_forward_range_insert_expand_backwards this->priv_forward_range_insert_expand_backwards
(container_detail::to_raw_pointer(ret), real_cap, raw_pos, n, insert_range_proxy); (boost::movelib::to_raw_pointer(ret), real_cap, raw_pos, n, insert_range_proxy);
} }
} }
//New buffer //New buffer
@@ -2725,7 +2725,7 @@ class vector
++this->num_alloc; ++this->num_alloc;
#endif #endif
this->priv_forward_range_insert_new_allocation this->priv_forward_range_insert_new_allocation
( container_detail::to_raw_pointer(ret), real_cap, raw_pos, n, insert_range_proxy); ( boost::movelib::to_raw_pointer(ret), real_cap, raw_pos, n, insert_range_proxy);
} }
return iterator(this->m_holder.start() + n_pos); return iterator(this->m_holder.start() + n_pos);
@@ -2745,7 +2745,7 @@ class vector
} }
else{ else{
//Expand forward //Expand forward
T *const raw_pos = container_detail::to_raw_pointer(pos); T *const raw_pos = boost::movelib::to_raw_pointer(pos);
const size_type n_pos = raw_pos - this->priv_raw_begin(); const size_type n_pos = raw_pos - this->priv_raw_begin();
this->priv_forward_range_insert_expand_forward(raw_pos, n, insert_range_proxy); this->priv_forward_range_insert_expand_forward(raw_pos, n, insert_range_proxy);
return iterator(this->m_holder.start() + n_pos); return iterator(this->m_holder.start() + n_pos);
@@ -2862,7 +2862,7 @@ class vector
private: private:
BOOST_CONTAINER_FORCEINLINE T *priv_raw_begin() const BOOST_CONTAINER_FORCEINLINE T *priv_raw_begin() const
{ return container_detail::to_raw_pointer(m_holder.start()); } { return boost::movelib::to_raw_pointer(m_holder.start()); }
BOOST_CONTAINER_FORCEINLINE T* priv_raw_end() const BOOST_CONTAINER_FORCEINLINE T* priv_raw_end() const
{ return this->priv_raw_begin() + this->m_holder.m_size; } { return this->priv_raw_begin() + this->m_holder.m_size; }