forked from boostorg/container
Support GCC's -Wconversion -Wfloat-conversion -Warith-conversion -Wsign-conversion warnings.
This commit is contained in:
1 parent
883868e6b2
commit
dad2cb2d02
42 files changed
+813
-754
No files matched your search
@@ -535,7 +535,7 @@ class private_adaptive_node_pool_impl_common
|
||||
//Check that header offsets are correct
|
||||
hdr_offset_holder *hdr_off_holder = this->priv_first_subblock_from_block(const_cast<block_info_t *>(&*it), num_subblocks, real_block_alignment);
|
||||
for (size_type i = 0, max = num_subblocks; i < max; ++i) {
|
||||
const size_type offset = reinterpret_cast<char*>(const_cast<block_info_t *>(&*it)) - reinterpret_cast<char*>(hdr_off_holder);
|
||||
const size_type offset = size_type(reinterpret_cast<char*>(const_cast<block_info_t *>(&*it)) - reinterpret_cast<char*>(hdr_off_holder));
|
||||
(void)offset;
|
||||
BOOST_ASSERT(hdr_off_holder->hdr_offset == offset);
|
||||
BOOST_ASSERT(0 == (reinterpret_cast<std::size_t>(hdr_off_holder) & (real_block_alignment - 1)));
|
||||
|
||||
@@ -46,20 +46,19 @@ namespace boost { namespace container { namespace dtl {
|
||||
template<class Allocator, class FwdIt, class Iterator>
|
||||
struct move_insert_range_proxy
|
||||
{
|
||||
typedef typename allocator_traits<Allocator>::size_type size_type;
|
||||
typedef typename allocator_traits<Allocator>::value_type value_type;
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE explicit move_insert_range_proxy(FwdIt first)
|
||||
: first_(first)
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n)
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n)
|
||||
{
|
||||
this->first_ = ::boost::container::uninitialized_move_alloc_n_source
|
||||
(a, this->first_, n, p);
|
||||
}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, size_type n)
|
||||
BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, std::size_t n)
|
||||
{
|
||||
this->first_ = ::boost::container::move_n_source(this->first_, n, p);
|
||||
}
|
||||
@@ -71,19 +70,18 @@ struct move_insert_range_proxy
|
||||
template<class Allocator, class FwdIt, class Iterator>
|
||||
struct insert_range_proxy
|
||||
{
|
||||
typedef typename allocator_traits<Allocator>::size_type size_type;
|
||||
typedef typename allocator_traits<Allocator>::value_type value_type;
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE explicit insert_range_proxy(FwdIt first)
|
||||
: first_(first)
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n)
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n)
|
||||
{
|
||||
this->first_ = ::boost::container::uninitialized_copy_alloc_n_source(a, this->first_, n, p);
|
||||
}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, size_type n)
|
||||
BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, std::size_t n)
|
||||
{
|
||||
this->first_ = ::boost::container::copy_n_source(this->first_, n, p);
|
||||
}
|
||||
@@ -95,17 +93,16 @@ struct insert_range_proxy
|
||||
template<class Allocator, class Iterator>
|
||||
struct insert_n_copies_proxy
|
||||
{
|
||||
typedef typename allocator_traits<Allocator>::size_type size_type;
|
||||
typedef typename allocator_traits<Allocator>::value_type value_type;
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE explicit insert_n_copies_proxy(const value_type &v)
|
||||
: v_(v)
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const
|
||||
{ boost::container::uninitialized_fill_alloc_n(a, v_, n, p); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, size_type n) const
|
||||
BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, std::size_t n) const
|
||||
{
|
||||
while (n){
|
||||
--n;
|
||||
@@ -121,14 +118,13 @@ template<class Allocator, class Iterator>
|
||||
struct insert_value_initialized_n_proxy
|
||||
{
|
||||
typedef ::boost::container::allocator_traits<Allocator> alloc_traits;
|
||||
typedef typename allocator_traits<Allocator>::size_type size_type;
|
||||
typedef typename allocator_traits<Allocator>::value_type value_type;
|
||||
typedef typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type storage_t;
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const
|
||||
{ boost::container::uninitialized_value_init_alloc_n(a, n, p); }
|
||||
|
||||
void copy_n_and_update(Allocator &a, Iterator p, size_type n) const
|
||||
void copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const
|
||||
{
|
||||
while (n){
|
||||
--n;
|
||||
@@ -146,14 +142,13 @@ template<class Allocator, class Iterator>
|
||||
struct insert_default_initialized_n_proxy
|
||||
{
|
||||
typedef ::boost::container::allocator_traits<Allocator> alloc_traits;
|
||||
typedef typename allocator_traits<Allocator>::size_type size_type;
|
||||
typedef typename allocator_traits<Allocator>::value_type value_type;
|
||||
typedef typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type storage_t;
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const
|
||||
{ boost::container::uninitialized_default_init_alloc_n(a, n, p); }
|
||||
|
||||
void copy_n_and_update(Allocator &a, Iterator p, size_type n) const
|
||||
void copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const
|
||||
{
|
||||
if(!is_pod<value_type>::value){
|
||||
while (n){
|
||||
@@ -173,7 +168,6 @@ template<class Allocator, class Iterator>
|
||||
struct insert_copy_proxy
|
||||
{
|
||||
typedef boost::container::allocator_traits<Allocator> alloc_traits;
|
||||
typedef typename alloc_traits::size_type size_type;
|
||||
typedef typename alloc_traits::value_type value_type;
|
||||
|
||||
static const bool single_value = true;
|
||||
@@ -182,13 +176,13 @@ struct insert_copy_proxy
|
||||
: v_(v)
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const
|
||||
{
|
||||
BOOST_ASSERT(n == 1); (void)n;
|
||||
alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), v_);
|
||||
}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, size_type n) const
|
||||
BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, std::size_t n) const
|
||||
{
|
||||
BOOST_ASSERT(n == 1); (void)n;
|
||||
*p = v_;
|
||||
@@ -202,7 +196,6 @@ template<class Allocator, class Iterator>
|
||||
struct insert_move_proxy
|
||||
{
|
||||
typedef boost::container::allocator_traits<Allocator> alloc_traits;
|
||||
typedef typename alloc_traits::size_type size_type;
|
||||
typedef typename alloc_traits::value_type value_type;
|
||||
|
||||
static const bool single_value = true;
|
||||
@@ -211,13 +204,13 @@ struct insert_move_proxy
|
||||
: v_(v)
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const
|
||||
{
|
||||
BOOST_ASSERT(n == 1); (void)n;
|
||||
alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), ::boost::move(v_) );
|
||||
}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, size_type n) const
|
||||
BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, std::size_t n) const
|
||||
{
|
||||
BOOST_ASSERT(n == 1); (void)n;
|
||||
*p = ::boost::move(v_);
|
||||
@@ -253,7 +246,6 @@ template<class Allocator, class Iterator, class ...Args>
|
||||
struct insert_nonmovable_emplace_proxy
|
||||
{
|
||||
typedef boost::container::allocator_traits<Allocator> alloc_traits;
|
||||
typedef typename alloc_traits::size_type size_type;
|
||||
typedef typename alloc_traits::value_type value_type;
|
||||
typedef typename build_number_seq<sizeof...(Args)>::type index_tuple_t;
|
||||
|
||||
@@ -263,12 +255,12 @@ struct insert_nonmovable_emplace_proxy
|
||||
: args_(args...)
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n)
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n)
|
||||
{ this->priv_uninitialized_copy_some_and_update(a, index_tuple_t(), p, n); }
|
||||
|
||||
private:
|
||||
template<std::size_t ...IdxPack>
|
||||
BOOST_CONTAINER_FORCEINLINE void priv_uninitialized_copy_some_and_update(Allocator &a, const index_tuple<IdxPack...>&, Iterator p, size_type n)
|
||||
BOOST_CONTAINER_FORCEINLINE void priv_uninitialized_copy_some_and_update(Allocator &a, const index_tuple<IdxPack...>&, Iterator p, std::size_t n)
|
||||
{
|
||||
BOOST_ASSERT(n == 1); (void)n;
|
||||
alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), ::boost::forward<Args>(get<IdxPack>(this->args_))... );
|
||||
@@ -285,7 +277,6 @@ struct insert_emplace_proxy
|
||||
typedef insert_nonmovable_emplace_proxy<Allocator, Iterator, Args...> base_t;
|
||||
typedef boost::container::allocator_traits<Allocator> alloc_traits;
|
||||
typedef typename base_t::value_type value_type;
|
||||
typedef typename base_t::size_type size_type;
|
||||
typedef typename base_t::index_tuple_t index_tuple_t;
|
||||
|
||||
static const bool single_value = true;
|
||||
@@ -294,13 +285,13 @@ struct insert_emplace_proxy
|
||||
: base_t(::boost::forward<Args>(args)...)
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &a, Iterator p, size_type n)
|
||||
BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &a, Iterator p, std::size_t n)
|
||||
{ this->priv_copy_some_and_update(a, index_tuple_t(), p, n); }
|
||||
|
||||
private:
|
||||
|
||||
template<std::size_t ...IdxPack>
|
||||
BOOST_CONTAINER_FORCEINLINE void priv_copy_some_and_update(Allocator &a, const index_tuple<IdxPack...>&, Iterator p, size_type n)
|
||||
BOOST_CONTAINER_FORCEINLINE void priv_copy_some_and_update(Allocator &a, const index_tuple<IdxPack...>&, Iterator p, std::size_t n)
|
||||
{
|
||||
BOOST_ASSERT(n ==1); (void)n;
|
||||
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;
|
||||
@@ -386,7 +377,6 @@ template< class Allocator, class Iterator BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
|
||||
struct insert_nonmovable_emplace_proxy##N\
|
||||
{\
|
||||
typedef boost::container::allocator_traits<Allocator> alloc_traits;\
|
||||
typedef typename alloc_traits::size_type size_type;\
|
||||
typedef typename alloc_traits::value_type value_type;\
|
||||
\
|
||||
static const bool single_value = true;\
|
||||
@@ -394,13 +384,13 @@ struct insert_nonmovable_emplace_proxy##N\
|
||||
BOOST_CONTAINER_FORCEINLINE explicit insert_nonmovable_emplace_proxy##N(BOOST_MOVE_UREF##N)\
|
||||
BOOST_MOVE_COLON##N BOOST_MOVE_FWD_INIT##N {}\
|
||||
\
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n)\
|
||||
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n)\
|
||||
{\
|
||||
BOOST_ASSERT(n == 1); (void)n;\
|
||||
alloc_traits::construct(a, boost::movelib::iterator_to_raw_pointer(p) BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\
|
||||
}\
|
||||
\
|
||||
BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator, size_type)\
|
||||
BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator, std::size_t)\
|
||||
{ BOOST_ASSERT(false); }\
|
||||
\
|
||||
protected:\
|
||||
@@ -414,7 +404,6 @@ struct insert_emplace_proxy_arg##N\
|
||||
typedef insert_nonmovable_emplace_proxy##N\
|
||||
< Allocator, Iterator BOOST_MOVE_I##N BOOST_MOVE_TARG##N > base_t;\
|
||||
typedef typename base_t::value_type value_type;\
|
||||
typedef typename base_t::size_type size_type;\
|
||||
typedef boost::container::allocator_traits<Allocator> alloc_traits;\
|
||||
\
|
||||
static const bool single_value = true;\
|
||||
@@ -422,7 +411,7 @@ struct insert_emplace_proxy_arg##N\
|
||||
BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy_arg##N(BOOST_MOVE_UREF##N)\
|
||||
: base_t(BOOST_MOVE_FWD##N){}\
|
||||
\
|
||||
BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &a, Iterator p, size_type n)\
|
||||
BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &a, Iterator p, std::size_t n)\
|
||||
{\
|
||||
BOOST_ASSERT(n == 1); (void)n;\
|
||||
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;\
|
||||
|
||||
@@ -34,26 +34,26 @@ template<class Allocator, class T, class InpIt>
|
||||
BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T* dest, InpIt source)
|
||||
{ boost::container::allocator_traits<Allocator>::construct(a, dest, *source); }
|
||||
|
||||
template<class Allocator, class T, class U, class D>
|
||||
BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, value_init_construct_iterator<U, D>)
|
||||
template<class Allocator, class T, class U>
|
||||
BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, value_init_construct_iterator<U>)
|
||||
{
|
||||
boost::container::allocator_traits<Allocator>::construct(a, dest);
|
||||
}
|
||||
|
||||
template <class T, class Difference>
|
||||
template <class T>
|
||||
class default_init_construct_iterator;
|
||||
|
||||
template<class Allocator, class T, class U, class D>
|
||||
BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, default_init_construct_iterator<U, D>)
|
||||
template<class Allocator, class T, class U>
|
||||
BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, default_init_construct_iterator<U>)
|
||||
{
|
||||
boost::container::allocator_traits<Allocator>::construct(a, dest, default_init);
|
||||
}
|
||||
|
||||
template <class T, class EmplaceFunctor, class Difference>
|
||||
template <class T, class EmplaceFunctor>
|
||||
class emplace_iterator;
|
||||
|
||||
template<class Allocator, class T, class U, class EF, class D>
|
||||
BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, emplace_iterator<U, EF, D> ei)
|
||||
template<class Allocator, class T, class U, class EF>
|
||||
BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, emplace_iterator<U, EF> ei)
|
||||
{
|
||||
ei.construct_in_place(a, dest);
|
||||
}
|
||||
@@ -64,28 +64,28 @@ template<class DstIt, class InpIt>
|
||||
BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, InpIt source)
|
||||
{ *dest = *source; }
|
||||
|
||||
template<class DstIt, class U, class D>
|
||||
BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, value_init_construct_iterator<U, D>)
|
||||
template<class DstIt, class U>
|
||||
BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, value_init_construct_iterator<U>)
|
||||
{
|
||||
dtl::value_init<U> val;
|
||||
*dest = boost::move(val.get());
|
||||
}
|
||||
|
||||
template <class DstIt, class Difference>
|
||||
template <class DstIt>
|
||||
class default_init_construct_iterator;
|
||||
|
||||
template<class DstIt, class U, class D>
|
||||
BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, default_init_construct_iterator<U, D>)
|
||||
BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, default_init_construct_iterator<U>)
|
||||
{
|
||||
U u;
|
||||
*dest = boost::move(u);
|
||||
}
|
||||
|
||||
template <class T, class EmplaceFunctor, class Difference>
|
||||
template <class T, class EmplaceFunctor>
|
||||
class emplace_iterator;
|
||||
|
||||
template<class DstIt, class U, class EF, class D>
|
||||
BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, emplace_iterator<U, EF, D> ei)
|
||||
template<class DstIt, class U, class EF>
|
||||
BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, emplace_iterator<U, EF> ei)
|
||||
{
|
||||
ei.assign_in_place(dest);
|
||||
}
|
||||
|
||||
@@ -174,14 +174,15 @@ template
|
||||
typename F> // F models ForwardIterator
|
||||
BOOST_CONTAINER_FORCEINLINE 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;
|
||||
typedef typename boost::container::iterator_traits<F>::difference_type r_difference_type;
|
||||
value_type *const dest_raw = boost::movelib::iterator_to_raw_pointer(r);
|
||||
const value_type *const beg_raw = boost::movelib::iterator_to_raw_pointer(f);
|
||||
const value_type *const end_raw = boost::movelib::iterator_to_raw_pointer(l);
|
||||
if(BOOST_LIKELY(beg_raw != end_raw && dest_raw && beg_raw)){
|
||||
const typename boost::container::iterator_traits<I>::difference_type n = end_raw - beg_raw;
|
||||
const std::size_t n = std::size_t(end_raw - beg_raw) ;
|
||||
std::memmove(dest_raw, beg_raw, sizeof(value_type)*n);
|
||||
r += n;
|
||||
r += static_cast<r_difference_type>(n);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -193,9 +194,10 @@ template
|
||||
BOOST_CONTAINER_FORCEINLINE F memmove_n(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
typedef typename boost::container::iterator_traits<I>::value_type value_type;
|
||||
if(BOOST_LIKELY(n)){
|
||||
typedef typename boost::container::iterator_traits<F>::difference_type r_difference_type;
|
||||
if(BOOST_LIKELY(n != 0)){
|
||||
std::memmove(boost::movelib::iterator_to_raw_pointer(r), boost::movelib::iterator_to_raw_pointer(f), sizeof(value_type)*n);
|
||||
r += n;
|
||||
r += static_cast<r_difference_type>(n);
|
||||
}
|
||||
|
||||
return r;
|
||||
@@ -203,29 +205,31 @@ BOOST_CONTAINER_FORCEINLINE F memmove_n(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
|
||||
template
|
||||
<typename I, // I models InputIterator
|
||||
typename U, // U models unsigned integral constant
|
||||
typename F> // F models ForwardIterator
|
||||
BOOST_CONTAINER_FORCEINLINE I memmove_n_source(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
BOOST_CONTAINER_FORCEINLINE I memmove_n_source(I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
if(BOOST_LIKELY(n)){
|
||||
if(BOOST_LIKELY(n != 0)){
|
||||
typedef typename boost::container::iterator_traits<I>::value_type value_type;
|
||||
typedef typename boost::container::iterator_traits<I>::difference_type i_difference_type;
|
||||
std::memmove(boost::movelib::iterator_to_raw_pointer(r), boost::movelib::iterator_to_raw_pointer(f), sizeof(value_type)*n);
|
||||
f += n;
|
||||
f += static_cast<i_difference_type>(n);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
template
|
||||
<typename I, // I models InputIterator
|
||||
typename U, // U models unsigned integral constant
|
||||
typename F> // F models ForwardIterator
|
||||
BOOST_CONTAINER_FORCEINLINE I memmove_n_source_dest(I f, U n, F &r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
BOOST_CONTAINER_FORCEINLINE I memmove_n_source_dest(I f, std::size_t n, F &r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
typedef typename boost::container::iterator_traits<I>::value_type value_type;
|
||||
if(BOOST_LIKELY(n)){
|
||||
typedef typename boost::container::iterator_traits<F>::difference_type i_difference_type;
|
||||
typedef typename boost::container::iterator_traits<F>::difference_type f_difference_type;
|
||||
|
||||
if(BOOST_LIKELY(n != 0)){
|
||||
std::memmove(boost::movelib::iterator_to_raw_pointer(r), boost::movelib::iterator_to_raw_pointer(f), sizeof(value_type)*n);
|
||||
f += n;
|
||||
r += n;
|
||||
f += i_difference_type(n);
|
||||
r += f_difference_type(n);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
@@ -338,7 +342,7 @@ template
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
uninitialized_move_alloc_n(Allocator &a, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r)
|
||||
uninitialized_move_alloc_n(Allocator &a, I f, std::size_t n, F r)
|
||||
{
|
||||
F back = r;
|
||||
BOOST_TRY{
|
||||
@@ -363,7 +367,7 @@ template
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
uninitialized_move_alloc_n(Allocator &, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
uninitialized_move_alloc_n(Allocator &, I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return dtl::memmove_n(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -384,7 +388,7 @@ template
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, I>::type
|
||||
uninitialized_move_alloc_n_source(Allocator &a, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r)
|
||||
uninitialized_move_alloc_n_source(Allocator &a, I f, std::size_t n, F r)
|
||||
{
|
||||
F back = r;
|
||||
BOOST_TRY{
|
||||
@@ -409,7 +413,7 @@ template
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_constructible<I, F, I>::type
|
||||
uninitialized_move_alloc_n_source(Allocator &, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
uninitialized_move_alloc_n_source(Allocator &, I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return dtl::memmove_n_source(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -475,7 +479,7 @@ template
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
uninitialized_copy_alloc_n(Allocator &a, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r)
|
||||
uninitialized_copy_alloc_n(Allocator &a, I f, std::size_t n, F r)
|
||||
{
|
||||
F back = r;
|
||||
BOOST_TRY{
|
||||
@@ -500,7 +504,7 @@ template
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
uninitialized_copy_alloc_n(Allocator &, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
uninitialized_copy_alloc_n(Allocator &, I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return dtl::memmove_n(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -521,7 +525,7 @@ template
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, I>::type
|
||||
uninitialized_copy_alloc_n_source(Allocator &a, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r)
|
||||
uninitialized_copy_alloc_n_source(Allocator &a, I f, std::size_t n, F r)
|
||||
{
|
||||
F back = r;
|
||||
BOOST_TRY{
|
||||
@@ -545,7 +549,7 @@ template
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_constructible<I, F, I>::type
|
||||
uninitialized_copy_alloc_n_source(Allocator &, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
uninitialized_copy_alloc_n_source(Allocator &, I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return dtl::memmove_n_source(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -565,7 +569,7 @@ template
|
||||
<typename Allocator,
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename dtl::disable_if_memzero_initializable<F, F>::type
|
||||
uninitialized_value_init_alloc_n(Allocator &a, typename boost::container::allocator_traits<Allocator>::size_type n, F r)
|
||||
uninitialized_value_init_alloc_n(Allocator &a, std::size_t n, F r)
|
||||
{
|
||||
F back = r;
|
||||
BOOST_TRY{
|
||||
@@ -589,12 +593,14 @@ template
|
||||
<typename Allocator,
|
||||
typename F> // F models ForwardIterator
|
||||
BOOST_CONTAINER_FORCEINLINE typename dtl::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 &, std::size_t n, F r)
|
||||
{
|
||||
typedef typename boost::container::iterator_traits<F>::value_type value_type;
|
||||
if (BOOST_LIKELY(n)){
|
||||
typedef typename boost::container::iterator_traits<F>::difference_type r_difference_type;
|
||||
|
||||
if (BOOST_LIKELY(n != 0)){
|
||||
std::memset((void*)boost::movelib::iterator_to_raw_pointer(r), 0, sizeof(value_type)*n);
|
||||
r += n;
|
||||
r += static_cast<r_difference_type>(n);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -615,7 +621,7 @@ BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memzero_initializable<F, F>:
|
||||
template
|
||||
<typename Allocator,
|
||||
typename F> // F models ForwardIterator
|
||||
inline F uninitialized_default_init_alloc_n(Allocator &a, typename boost::container::allocator_traits<Allocator>::size_type n, F r)
|
||||
inline F uninitialized_default_init_alloc_n(Allocator &a, std::size_t n, F r)
|
||||
{
|
||||
F back = r;
|
||||
BOOST_TRY{
|
||||
@@ -688,7 +694,7 @@ template
|
||||
<typename Allocator,
|
||||
typename T,
|
||||
typename F> // F models ForwardIterator
|
||||
inline F uninitialized_fill_alloc_n(Allocator &a, const T &v, typename boost::container::allocator_traits<Allocator>::size_type n, F r)
|
||||
inline F uninitialized_fill_alloc_n(Allocator &a, const T &v, std::size_t n, F r)
|
||||
{
|
||||
F back = r;
|
||||
BOOST_TRY{
|
||||
@@ -786,10 +792,9 @@ inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
|
||||
template
|
||||
<typename I, // I models InputIterator
|
||||
typename U, // U models unsigned integral constant
|
||||
typename F> // F models ForwardIterator
|
||||
BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
copy_n_source(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
copy_n_source(I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return dtl::memmove_n_source(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -800,10 +805,9 @@ BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_assignable<
|
||||
|
||||
template
|
||||
<typename I, // I models InputIterator
|
||||
typename U, // U models unsigned integral constant
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
copy_n_source_dest(I f, U n, F &r)
|
||||
copy_n_source_dest(I f, std::size_t n, F &r)
|
||||
{
|
||||
while (n) {
|
||||
--n;
|
||||
@@ -815,10 +819,9 @@ inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
|
||||
template
|
||||
<typename I, // I models InputIterator
|
||||
typename U, // U models unsigned integral constant
|
||||
typename F> // F models ForwardIterator
|
||||
BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
copy_n_source_dest(I f, U n, F &r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
copy_n_source_dest(I f, std::size_t n, F &r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return dtl::memmove_n_source_dest(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -903,8 +906,8 @@ BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_assignable<
|
||||
move_backward(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
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);
|
||||
if (BOOST_LIKELY(n)){
|
||||
const std::size_t n = boost::container::iterator_udistance(f, l);
|
||||
if (BOOST_LIKELY(n != 0)){
|
||||
r -= n;
|
||||
std::memmove((boost::movelib::iterator_to_raw_pointer)(r), (boost::movelib::iterator_to_raw_pointer)(f), sizeof(value_type)*n);
|
||||
}
|
||||
@@ -934,10 +937,9 @@ inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
|
||||
template
|
||||
<typename I // I models InputIterator
|
||||
,typename U // U models unsigned integral constant
|
||||
,typename F> // F models ForwardIterator
|
||||
BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
move_n_source_dest(I f, U n, F &r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
move_n_source_dest(I f, std::size_t n, F &r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return dtl::memmove_n_source_dest(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -963,10 +965,9 @@ inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
|
||||
template
|
||||
<typename I // I models InputIterator
|
||||
,typename U // U models unsigned integral constant
|
||||
,typename F> // F models ForwardIterator
|
||||
BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
move_n_source(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
move_n_source(I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return dtl::memmove_n_source(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1010,15 +1011,14 @@ template
|
||||
,typename G // G models ForwardIterator
|
||||
>
|
||||
inline typename dtl::disable_if_memtransfer_copy_assignable<F, G, void>::type
|
||||
deep_swap_alloc_n( Allocator &a, F short_range_f, typename allocator_traits<Allocator>::size_type n_i
|
||||
, G large_range_f, typename allocator_traits<Allocator>::size_type n_j)
|
||||
deep_swap_alloc_n( Allocator &a, F short_range_f, std::size_t n_i, G large_range_f, std::size_t n_j)
|
||||
{
|
||||
typename allocator_traits<Allocator>::size_type n = 0;
|
||||
std::size_t n = 0;
|
||||
for (; n != n_i ; ++short_range_f, ++large_range_f, ++n){
|
||||
boost::adl_move_swap(*short_range_f, *large_range_f);
|
||||
}
|
||||
boost::container::uninitialized_move_alloc_n(a, large_range_f, n_j - n_i, short_range_f); // may throw
|
||||
boost::container::destroy_alloc_n(a, large_range_f, n_j - n_i);
|
||||
boost::container::uninitialized_move_alloc_n(a, large_range_f, std::size_t(n_j - n_i), short_range_f); // may throw
|
||||
boost::container::destroy_alloc_n(a, large_range_f, std::size_t(n_j - n_i));
|
||||
}
|
||||
|
||||
static const std::size_t DeepSwapAllocNMaxStorage = std::size_t(1) << std::size_t(11); //2K bytes
|
||||
@@ -1032,8 +1032,7 @@ template
|
||||
inline typename dtl::enable_if_c
|
||||
< dtl::is_memtransfer_copy_assignable<F, G>::value && (MaxTmpBytes <= DeepSwapAllocNMaxStorage) && false
|
||||
, void>::type
|
||||
deep_swap_alloc_n( Allocator &a, F short_range_f, typename allocator_traits<Allocator>::size_type n_i
|
||||
, G large_range_f, typename allocator_traits<Allocator>::size_type n_j)
|
||||
deep_swap_alloc_n( Allocator &a, F short_range_f, std::size_t n_i, G large_range_f, std::size_t n_j)
|
||||
{
|
||||
typedef typename allocator_traits<Allocator>::value_type value_type;
|
||||
typedef typename dtl::aligned_storage
|
||||
@@ -1047,10 +1046,10 @@ inline typename dtl::enable_if_c
|
||||
std::memcpy(stora_ptr, large_ptr, n_i_bytes);
|
||||
std::memcpy(large_ptr, short_ptr, n_i_bytes);
|
||||
std::memcpy(short_ptr, stora_ptr, n_i_bytes);
|
||||
boost::container::iterator_advance(large_range_f, n_i);
|
||||
boost::container::iterator_advance(short_range_f, n_i);
|
||||
boost::container::uninitialized_move_alloc_n(a, large_range_f, n_j - n_i, short_range_f); // may throw
|
||||
boost::container::destroy_alloc_n(a, large_range_f, n_j - n_i);
|
||||
boost::container::iterator_uadvance(large_range_f, n_i);
|
||||
boost::container::iterator_uadvance(short_range_f, n_i);
|
||||
boost::container::uninitialized_move_alloc_n(a, large_range_f, std::size_t(n_j - n_i), short_range_f); // may throw
|
||||
boost::container::destroy_alloc_n(a, large_range_f, std::size_t(n_j - n_i));
|
||||
}
|
||||
|
||||
template
|
||||
@@ -1062,8 +1061,7 @@ template
|
||||
inline typename dtl::enable_if_c
|
||||
< dtl::is_memtransfer_copy_assignable<F, G>::value && true//(MaxTmpBytes > DeepSwapAllocNMaxStorage)
|
||||
, void>::type
|
||||
deep_swap_alloc_n( Allocator &a, F short_range_f, typename allocator_traits<Allocator>::size_type n_i
|
||||
, G large_range_f, typename allocator_traits<Allocator>::size_type n_j)
|
||||
deep_swap_alloc_n( Allocator &a, F short_range_f, std::size_t n_i, G large_range_f, std::size_t n_j)
|
||||
{
|
||||
typedef typename allocator_traits<Allocator>::value_type value_type;
|
||||
typedef typename dtl::aligned_storage
|
||||
@@ -1118,10 +1116,10 @@ inline typename dtl::enable_if_c
|
||||
std::memcpy(stora_ptr, large_ptr, szt_rem);
|
||||
std::memcpy(large_ptr, short_ptr, szt_rem);
|
||||
std::memcpy(short_ptr, stora_ptr, szt_rem);
|
||||
boost::container::iterator_advance(large_range_f, n_i);
|
||||
boost::container::iterator_advance(short_range_f, n_i);
|
||||
boost::container::uninitialized_move_alloc_n(a, large_range_f, n_j - n_i, short_range_f); // may throw
|
||||
boost::container::destroy_alloc_n(a, large_range_f, n_j - n_i);
|
||||
boost::container::iterator_uadvance(large_range_f, n_i);
|
||||
boost::container::iterator_uadvance(short_range_f, n_i);
|
||||
boost::container::uninitialized_move_alloc_n(a, large_range_f, std::size_t(n_j - n_i), short_range_f); // may throw
|
||||
boost::container::destroy_alloc_n(a, large_range_f, std::size_t(n_j - n_i));
|
||||
}
|
||||
|
||||
|
||||
@@ -1136,16 +1134,15 @@ template
|
||||
,typename I // F models InputIterator
|
||||
,typename O // G models OutputIterator
|
||||
>
|
||||
void copy_assign_range_alloc_n( Allocator &a, I inp_start, typename allocator_traits<Allocator>::size_type n_i
|
||||
, O out_start, typename allocator_traits<Allocator>::size_type n_o )
|
||||
void copy_assign_range_alloc_n( Allocator &a, I inp_start, std::size_t n_i, O out_start, std::size_t n_o )
|
||||
{
|
||||
if (n_o < n_i){
|
||||
inp_start = boost::container::copy_n_source_dest(inp_start, n_o, out_start); // may throw
|
||||
boost::container::uninitialized_copy_alloc_n(a, inp_start, n_i - n_o, out_start);// may throw
|
||||
boost::container::uninitialized_copy_alloc_n(a, inp_start, std::size_t(n_i - n_o), out_start);// may throw
|
||||
}
|
||||
else{
|
||||
out_start = boost::container::copy_n(inp_start, n_i, out_start); // may throw
|
||||
boost::container::destroy_alloc_n(a, out_start, n_o - n_i);
|
||||
boost::container::destroy_alloc_n(a, out_start, std::size_t(n_o - n_i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1160,16 +1157,15 @@ template
|
||||
,typename I // F models InputIterator
|
||||
,typename O // G models OutputIterator
|
||||
>
|
||||
void move_assign_range_alloc_n( Allocator &a, I inp_start, typename allocator_traits<Allocator>::size_type n_i
|
||||
, O out_start, typename allocator_traits<Allocator>::size_type n_o )
|
||||
void move_assign_range_alloc_n( Allocator &a, I inp_start, std::size_t n_i, O out_start, std::size_t n_o )
|
||||
{
|
||||
if (n_o < n_i){
|
||||
inp_start = boost::container::move_n_source_dest(inp_start, n_o, out_start); // may throw
|
||||
boost::container::uninitialized_move_alloc_n(a, inp_start, n_i - n_o, out_start); // may throw
|
||||
boost::container::uninitialized_move_alloc_n(a, inp_start, std::size_t(n_i - n_o), out_start); // may throw
|
||||
}
|
||||
else{
|
||||
out_start = boost::container::move_n(inp_start, n_i, out_start); // may throw
|
||||
boost::container::destroy_alloc_n(a, out_start, n_o - n_i);
|
||||
boost::container::destroy_alloc_n(a, out_start, std::size_t(n_o - n_i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1196,7 +1192,7 @@ void uninitialized_move_and_insert_alloc
|
||||
, F pos
|
||||
, F last
|
||||
, O d_first
|
||||
, typename allocator_traits<Allocator>::size_type n
|
||||
, std::size_t n
|
||||
, InsertionProxy insert_range_proxy)
|
||||
{
|
||||
typedef typename array_destructor<Allocator, F>::type array_destructor_t;
|
||||
@@ -1228,7 +1224,7 @@ void expand_forward_and_insert_alloc
|
||||
( Allocator &a
|
||||
, F pos
|
||||
, F last
|
||||
, typename allocator_traits<Allocator>::size_type n
|
||||
, std::size_t n
|
||||
, InsertionProxy insert_range_proxy)
|
||||
{
|
||||
typedef typename array_destructor<Allocator, F>::type array_destructor_t;
|
||||
@@ -1240,8 +1236,7 @@ void expand_forward_and_insert_alloc
|
||||
insert_range_proxy.uninitialized_copy_n_and_update(a, last, n);
|
||||
}
|
||||
else{
|
||||
typedef typename allocator_traits<Allocator>::size_type alloc_size_type;
|
||||
const alloc_size_type elems_after = static_cast<alloc_size_type>(last - pos);
|
||||
const std::size_t elems_after = static_cast<std::size_t>(last - pos);
|
||||
if(elems_after >= n){
|
||||
//New elements can be just copied.
|
||||
//Move to uninitialized memory last objects
|
||||
@@ -1261,7 +1256,7 @@ void expand_forward_and_insert_alloc
|
||||
//Copy first new elements in pos (gap is still there)
|
||||
insert_range_proxy.copy_n_and_update(a, pos, elems_after);
|
||||
//Copy to the beginning of the unallocated zone the last new elements (the gap is closed).
|
||||
insert_range_proxy.uninitialized_copy_n_and_update(a, last, n - elems_after);
|
||||
insert_range_proxy.uninitialized_copy_n_and_update(a, last, std::size_t(n - elems_after));
|
||||
on_exception.release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,9 +83,8 @@ struct null_scoped_deallocator
|
||||
{
|
||||
typedef boost::container::allocator_traits<Allocator> AllocTraits;
|
||||
typedef typename AllocTraits::pointer pointer;
|
||||
typedef typename AllocTraits::size_type size_type;
|
||||
|
||||
null_scoped_deallocator(pointer, Allocator&, size_type)
|
||||
null_scoped_deallocator(pointer, Allocator&, std::size_t)
|
||||
{}
|
||||
|
||||
void release()
|
||||
@@ -107,11 +106,11 @@ struct scoped_array_deallocator
|
||||
typedef typename AllocTraits::pointer pointer;
|
||||
typedef typename AllocTraits::size_type size_type;
|
||||
|
||||
scoped_array_deallocator(pointer p, Allocator& a, size_type length)
|
||||
scoped_array_deallocator(pointer p, Allocator& a, std::size_t length)
|
||||
: m_ptr(p), m_alloc(a), m_length(length) {}
|
||||
|
||||
~scoped_array_deallocator()
|
||||
{ if (m_ptr) m_alloc.deallocate(m_ptr, m_length); }
|
||||
{ if (m_ptr) m_alloc.deallocate(m_ptr, size_type(m_length)); }
|
||||
|
||||
void release()
|
||||
{ m_ptr = 0; }
|
||||
@@ -119,7 +118,7 @@ struct scoped_array_deallocator
|
||||
private:
|
||||
pointer m_ptr;
|
||||
Allocator& m_alloc;
|
||||
size_type m_length;
|
||||
std::size_t m_length;
|
||||
};
|
||||
|
||||
template <class Allocator>
|
||||
@@ -127,9 +126,8 @@ struct null_scoped_array_deallocator
|
||||
{
|
||||
typedef boost::container::allocator_traits<Allocator> AllocTraits;
|
||||
typedef typename AllocTraits::pointer pointer;
|
||||
typedef typename AllocTraits::size_type size_type;
|
||||
|
||||
null_scoped_array_deallocator(pointer, Allocator&, size_type)
|
||||
null_scoped_array_deallocator(pointer, Allocator&, std::size_t)
|
||||
{}
|
||||
|
||||
void release()
|
||||
@@ -141,7 +139,6 @@ struct scoped_destroy_deallocator
|
||||
{
|
||||
typedef boost::container::allocator_traits<Allocator> AllocTraits;
|
||||
typedef typename AllocTraits::pointer pointer;
|
||||
typedef typename AllocTraits::size_type size_type;
|
||||
typedef dtl::integral_constant<unsigned,
|
||||
boost::container::dtl::
|
||||
version<Allocator>::value> alloc_version;
|
||||
@@ -181,23 +178,22 @@ struct scoped_destructor_n
|
||||
typedef boost::container::allocator_traits<Allocator> AllocTraits;
|
||||
typedef typename AllocTraits::pointer pointer;
|
||||
typedef typename AllocTraits::value_type value_type;
|
||||
typedef typename AllocTraits::size_type size_type;
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE scoped_destructor_n(pointer p, Allocator& a, size_type n)
|
||||
BOOST_CONTAINER_FORCEINLINE scoped_destructor_n(pointer p, Allocator& a, std::size_t n)
|
||||
: m_p(p), m_a(a), m_n(n)
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void release()
|
||||
{ m_p = 0; m_n = 0; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void increment_size(size_type inc)
|
||||
BOOST_CONTAINER_FORCEINLINE void increment_size(std::size_t inc)
|
||||
{ m_n += inc; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void increment_size_backwards(size_type inc)
|
||||
{ m_n += inc; m_p -= inc; }
|
||||
BOOST_CONTAINER_FORCEINLINE void increment_size_backwards(std::size_t inc)
|
||||
{ m_n += inc; m_p -= std::ptrdiff_t(inc); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void shrink_forward(size_type inc)
|
||||
{ m_n -= inc; m_p += inc; }
|
||||
BOOST_CONTAINER_FORCEINLINE void shrink_forward(std::size_t inc)
|
||||
{ m_n -= inc; m_p += std::ptrdiff_t(inc); }
|
||||
|
||||
~scoped_destructor_n()
|
||||
{
|
||||
@@ -214,7 +210,7 @@ struct scoped_destructor_n
|
||||
private:
|
||||
pointer m_p;
|
||||
Allocator & m_a;
|
||||
size_type m_n;
|
||||
std::size_t m_n;
|
||||
};
|
||||
|
||||
//!A deleter for scoped_ptr that destroys
|
||||
@@ -224,18 +220,17 @@ struct null_scoped_destructor_n
|
||||
{
|
||||
typedef boost::container::allocator_traits<Allocator> AllocTraits;
|
||||
typedef typename AllocTraits::pointer pointer;
|
||||
typedef typename AllocTraits::size_type size_type;
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE null_scoped_destructor_n(pointer, Allocator&, size_type)
|
||||
BOOST_CONTAINER_FORCEINLINE null_scoped_destructor_n(pointer, Allocator&, std::size_t)
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void increment_size(size_type)
|
||||
BOOST_CONTAINER_FORCEINLINE void increment_size(std::size_t)
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void increment_size_backwards(size_type)
|
||||
BOOST_CONTAINER_FORCEINLINE void increment_size_backwards(std::size_t)
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void shrink_forward(size_type)
|
||||
BOOST_CONTAINER_FORCEINLINE void shrink_forward(std::size_t)
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void release()
|
||||
|
||||
@@ -212,15 +212,16 @@ template<class SequenceContainer, class Iterator, class Compare>
|
||||
BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_unique //has_merge_unique == false
|
||||
(SequenceContainer& dest, Iterator first, Iterator last, Compare comp, dtl::false_)
|
||||
{
|
||||
typedef typename SequenceContainer::iterator iterator;
|
||||
typedef typename SequenceContainer::size_type size_type;
|
||||
typedef typename SequenceContainer::iterator iterator;
|
||||
typedef typename SequenceContainer::size_type size_type;
|
||||
typedef typename SequenceContainer::difference_type difference_type;
|
||||
|
||||
size_type const old_sz = dest.size();
|
||||
iterator const first_new = dest.insert(dest.cend(), first, last );
|
||||
iterator e = boost::movelib::inplace_set_unique_difference(first_new, dest.end(), dest.begin(), first_new, comp);
|
||||
dest.erase(e, dest.end());
|
||||
dtl::bool_<is_contiguous_container<SequenceContainer>::value> contiguous_tag;
|
||||
(flat_tree_container_inplace_merge)(dest, dest.begin()+old_sz, comp, contiguous_tag);
|
||||
(flat_tree_container_inplace_merge)(dest, dest.begin() + difference_type(old_sz), comp, contiguous_tag);
|
||||
}
|
||||
|
||||
///////////////////////////////////////
|
||||
@@ -263,7 +264,7 @@ BOOST_CONTAINER_FORCEINLINE Iterator
|
||||
flat_tree_nth // has_nth == false
|
||||
(SequenceContainer& cont, typename SequenceContainer::size_type n, dtl::false_)
|
||||
{
|
||||
return cont.begin()+ n;
|
||||
return cont.begin()+ typename SequenceContainer::difference_type(n);
|
||||
}
|
||||
|
||||
///////////////////////////////////////
|
||||
@@ -1013,7 +1014,7 @@ class flat_tree
|
||||
: this->priv_insert_unique_prepare(hint, k, data);
|
||||
|
||||
if(!ret.second){
|
||||
ret.first = this->nth(data.position - this->cbegin());
|
||||
ret.first = this->nth(size_type(data.position - this->cbegin()));
|
||||
}
|
||||
else{
|
||||
ret.first = this->m_data.m_seq.emplace(data.position, try_emplace_t(), ::boost::forward<KeyType>(key), ::boost::forward<Args>(args)...);
|
||||
@@ -1079,7 +1080,7 @@ class flat_tree
|
||||
: this->priv_insert_unique_prepare(hint, k, data);\
|
||||
\
|
||||
if(!ret.second){\
|
||||
ret.first = this->nth(data.position - this->cbegin());\
|
||||
ret.first = this->nth(size_type(data.position - this->cbegin()));\
|
||||
}\
|
||||
else{\
|
||||
ret.first = this->m_data.m_seq.emplace(data.position, try_emplace_t(), ::boost::forward<KeyType>(key) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
|
||||
@@ -1102,7 +1103,7 @@ class flat_tree
|
||||
? this->priv_insert_unique_prepare(k, data)
|
||||
: this->priv_insert_unique_prepare(hint, k, data);
|
||||
if(!ret.second){
|
||||
ret.first = this->nth(data.position - this->cbegin());
|
||||
ret.first = this->nth(size_type(data.position - this->cbegin()));
|
||||
ret.first->second = boost::forward<M>(obj);
|
||||
}
|
||||
else{
|
||||
@@ -1234,7 +1235,7 @@ class flat_tree
|
||||
size_type count(const key_type& k) const
|
||||
{
|
||||
std::pair<const_iterator, const_iterator> p = this->equal_range(k);
|
||||
size_type n = p.second - p.first;
|
||||
size_type n = size_type(p.second - p.first);
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -1244,7 +1245,7 @@ class flat_tree
|
||||
count(const K& k) const
|
||||
{
|
||||
std::pair<const_iterator, const_iterator> p = this->equal_range(k);
|
||||
size_type n = p.second - p.first;
|
||||
size_type n = size_type(p.second - p.first);
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -1588,7 +1589,7 @@ class flat_tree
|
||||
while (len) {
|
||||
size_type step = len >> 1;
|
||||
middle = first;
|
||||
middle += step;
|
||||
middle += difference_type(step);
|
||||
|
||||
if (key_cmp(key_extract(*middle), key)) {
|
||||
first = ++middle;
|
||||
@@ -1613,7 +1614,7 @@ class flat_tree
|
||||
while (len) {
|
||||
size_type step = len >> 1;
|
||||
middle = first;
|
||||
middle += step;
|
||||
middle += difference_type(step);
|
||||
|
||||
if (key_cmp(key, key_extract(*middle))) {
|
||||
len = step;
|
||||
@@ -1638,7 +1639,7 @@ class flat_tree
|
||||
while (len) {
|
||||
size_type step = len >> 1;
|
||||
middle = first;
|
||||
middle += step;
|
||||
middle += difference_type(step);
|
||||
|
||||
if (key_cmp(key_extract(*middle), key)){
|
||||
first = ++middle;
|
||||
@@ -1650,7 +1651,7 @@ class flat_tree
|
||||
else {
|
||||
//Middle is equal to key
|
||||
last = first;
|
||||
last += len;
|
||||
last += difference_type(len);
|
||||
RanIt const first_ret = this->priv_lower_bound(first, middle, key);
|
||||
return std::pair<RanIt, RanIt>
|
||||
( first_ret, this->priv_upper_bound(++middle, last, key));
|
||||
|
||||
@@ -30,7 +30,9 @@ namespace container {
|
||||
|
||||
using ::boost::intrusive::iterator_traits;
|
||||
using ::boost::intrusive::iterator_distance;
|
||||
using ::boost::intrusive::iterator_udistance;
|
||||
using ::boost::intrusive::iterator_advance;
|
||||
using ::boost::intrusive::iterator_uadvance;
|
||||
using ::boost::intrusive::iterator;
|
||||
using ::boost::intrusive::iterator_enable_if_tag;
|
||||
using ::boost::intrusive::iterator_disable_if_tag;
|
||||
|
||||
@@ -41,15 +41,15 @@
|
||||
namespace boost {
|
||||
namespace container {
|
||||
|
||||
template <class T, class Difference = std::ptrdiff_t>
|
||||
template <class T>
|
||||
class constant_iterator
|
||||
: public ::boost::container::iterator
|
||||
<std::random_access_iterator_tag, T, Difference, const T*, const T &>
|
||||
<std::random_access_iterator_tag, T, std::ptrdiff_t, const T*, const T &>
|
||||
{
|
||||
typedef constant_iterator<T, Difference> this_type;
|
||||
typedef constant_iterator<T> this_type;
|
||||
|
||||
public:
|
||||
BOOST_CONTAINER_FORCEINLINE explicit constant_iterator(const T &ref, Difference range_size)
|
||||
BOOST_CONTAINER_FORCEINLINE explicit constant_iterator(const T &ref, std::size_t range_size)
|
||||
: m_ptr(&ref), m_num(range_size){}
|
||||
|
||||
//Constructors
|
||||
@@ -94,41 +94,60 @@ class constant_iterator
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const constant_iterator& i, const constant_iterator& i2)
|
||||
{ return !(i < i2); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE friend Difference operator- (const constant_iterator& i, const constant_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend std::ptrdiff_t operator- (const constant_iterator& i, const constant_iterator& i2)
|
||||
{ return i2.distance_to(i); }
|
||||
|
||||
//Arithmetic
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator& operator+=(Difference off)
|
||||
//Arithmetic signed
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator& operator+=(std::ptrdiff_t off)
|
||||
{ this->advance(off); return *this; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator operator+(Difference off) const
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator operator+(std::ptrdiff_t off) const
|
||||
{
|
||||
constant_iterator other(*this);
|
||||
other.advance(off);
|
||||
return other;
|
||||
}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE friend constant_iterator operator+(Difference off, const constant_iterator& right)
|
||||
BOOST_CONTAINER_FORCEINLINE friend constant_iterator operator+(std::ptrdiff_t off, const constant_iterator& right)
|
||||
{ return right + off; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator& operator-=(Difference off)
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator& operator-=(std::ptrdiff_t off)
|
||||
{ this->advance(-off); return *this; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator operator-(Difference off) const
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator operator-(std::ptrdiff_t off) const
|
||||
{ return *this + (-off); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const T& operator*() const
|
||||
BOOST_CONTAINER_FORCEINLINE const T& operator[] (std::ptrdiff_t ) const
|
||||
{ return dereference(); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const T& operator[] (Difference ) const
|
||||
BOOST_CONTAINER_FORCEINLINE const T& operator*() const
|
||||
{ return dereference(); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const T* operator->() const
|
||||
{ return &(dereference()); }
|
||||
|
||||
//Arithmetic unsigned
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator& operator+=(std::size_t off)
|
||||
{ return *this += std::ptrdiff_t(off); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator operator+(std::size_t off) const
|
||||
{ return *this + std::ptrdiff_t(off); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE friend constant_iterator operator+(std::size_t off, const constant_iterator& right)
|
||||
{ return std::ptrdiff_t(off) + right; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator& operator-=(std::size_t off)
|
||||
{ return *this -= std::ptrdiff_t(off); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator operator-(std::size_t off) const
|
||||
{ return *this - std::ptrdiff_t(off); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const T& operator[] (std::size_t off) const
|
||||
{ return (*this)[std::ptrdiff_t(off)]; }
|
||||
|
||||
private:
|
||||
const T * m_ptr;
|
||||
Difference m_num;
|
||||
std::size_t m_num;
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void increment()
|
||||
{ --m_num; }
|
||||
@@ -145,22 +164,22 @@ class constant_iterator
|
||||
BOOST_CONTAINER_FORCEINLINE const T & dereference() const
|
||||
{ return *m_ptr; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void advance(Difference n)
|
||||
{ m_num -= n; }
|
||||
BOOST_CONTAINER_FORCEINLINE void advance(std::ptrdiff_t n)
|
||||
{ m_num = std::size_t(std::ptrdiff_t(m_num) - n); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE Difference distance_to(const this_type &other)const
|
||||
{ return m_num - other.m_num; }
|
||||
BOOST_CONTAINER_FORCEINLINE std::ptrdiff_t distance_to(const this_type &other)const
|
||||
{ return std::ptrdiff_t(m_num - other.m_num); }
|
||||
};
|
||||
|
||||
template <class T, class Difference>
|
||||
template <class T>
|
||||
class value_init_construct_iterator
|
||||
: public ::boost::container::iterator
|
||||
<std::random_access_iterator_tag, T, Difference, const T*, const T &>
|
||||
<std::random_access_iterator_tag, T, std::ptrdiff_t, const T*, const T &>
|
||||
{
|
||||
typedef value_init_construct_iterator<T, Difference> this_type;
|
||||
typedef value_init_construct_iterator<T> this_type;
|
||||
|
||||
public:
|
||||
BOOST_CONTAINER_FORCEINLINE explicit value_init_construct_iterator(Difference range_size)
|
||||
BOOST_CONTAINER_FORCEINLINE explicit value_init_construct_iterator(std::size_t range_size)
|
||||
: m_num(range_size){}
|
||||
|
||||
//Constructors
|
||||
@@ -205,27 +224,27 @@ class value_init_construct_iterator
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
|
||||
{ return !(i < i2); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE friend Difference operator- (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend std::ptrdiff_t operator- (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
|
||||
{ return i2.distance_to(i); }
|
||||
|
||||
//Arithmetic
|
||||
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator+=(Difference off)
|
||||
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator+=(std::ptrdiff_t off)
|
||||
{ this->advance(off); return *this; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator+(Difference off) const
|
||||
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator+(std::ptrdiff_t off) const
|
||||
{
|
||||
value_init_construct_iterator other(*this);
|
||||
other.advance(off);
|
||||
return other;
|
||||
}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE friend value_init_construct_iterator operator+(Difference off, const value_init_construct_iterator& right)
|
||||
BOOST_CONTAINER_FORCEINLINE friend value_init_construct_iterator operator+(std::ptrdiff_t off, const value_init_construct_iterator& right)
|
||||
{ return right + off; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator-=(Difference off)
|
||||
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator-=(std::ptrdiff_t off)
|
||||
{ this->advance(-off); return *this; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator-(Difference off) const
|
||||
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator-(std::ptrdiff_t off) const
|
||||
{ return *this + (-off); }
|
||||
|
||||
//This pseudo-iterator's dereference operations have no sense since value is not
|
||||
@@ -236,7 +255,7 @@ class value_init_construct_iterator
|
||||
//const T* operator->() const;
|
||||
|
||||
private:
|
||||
Difference m_num;
|
||||
std::size_t m_num;
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void increment()
|
||||
{ --m_num; }
|
||||
@@ -256,22 +275,22 @@ class value_init_construct_iterator
|
||||
return dummy;
|
||||
}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void advance(Difference n)
|
||||
{ m_num -= n; }
|
||||
BOOST_CONTAINER_FORCEINLINE void advance(std::ptrdiff_t n)
|
||||
{ m_num = std::size_t(std::ptrdiff_t(m_num) - n); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE Difference distance_to(const this_type &other)const
|
||||
{ return m_num - other.m_num; }
|
||||
BOOST_CONTAINER_FORCEINLINE std::ptrdiff_t distance_to(const this_type &other)const
|
||||
{ return std::ptrdiff_t(m_num - other.m_num); }
|
||||
};
|
||||
|
||||
template <class T, class Difference>
|
||||
template <class T>
|
||||
class default_init_construct_iterator
|
||||
: public ::boost::container::iterator
|
||||
<std::random_access_iterator_tag, T, Difference, const T*, const T &>
|
||||
<std::random_access_iterator_tag, T, std::ptrdiff_t, const T*, const T &>
|
||||
{
|
||||
typedef default_init_construct_iterator<T, Difference> this_type;
|
||||
typedef default_init_construct_iterator<T> this_type;
|
||||
|
||||
public:
|
||||
BOOST_CONTAINER_FORCEINLINE explicit default_init_construct_iterator(Difference range_size)
|
||||
BOOST_CONTAINER_FORCEINLINE explicit default_init_construct_iterator(std::size_t range_size)
|
||||
: m_num(range_size){}
|
||||
|
||||
//Constructors
|
||||
@@ -316,27 +335,27 @@ class default_init_construct_iterator
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
|
||||
{ return !(i < i2); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE friend Difference operator- (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend std::ptrdiff_t operator- (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
|
||||
{ return i2.distance_to(i); }
|
||||
|
||||
//Arithmetic
|
||||
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator+=(Difference off)
|
||||
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator+=(std::ptrdiff_t off)
|
||||
{ this->advance(off); return *this; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator+(Difference off) const
|
||||
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator+(std::ptrdiff_t off) const
|
||||
{
|
||||
default_init_construct_iterator other(*this);
|
||||
other.advance(off);
|
||||
return other;
|
||||
}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE friend default_init_construct_iterator operator+(Difference off, const default_init_construct_iterator& right)
|
||||
BOOST_CONTAINER_FORCEINLINE friend default_init_construct_iterator operator+(std::ptrdiff_t off, const default_init_construct_iterator& right)
|
||||
{ return right + off; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator-=(Difference off)
|
||||
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator-=(std::ptrdiff_t off)
|
||||
{ this->advance(-off); return *this; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator-(Difference off) const
|
||||
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator-(std::ptrdiff_t off) const
|
||||
{ return *this + (-off); }
|
||||
|
||||
//This pseudo-iterator's dereference operations have no sense since value is not
|
||||
@@ -347,7 +366,7 @@ class default_init_construct_iterator
|
||||
//const T* operator->() const;
|
||||
|
||||
private:
|
||||
Difference m_num;
|
||||
std::size_t m_num;
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void increment()
|
||||
{ --m_num; }
|
||||
@@ -367,22 +386,22 @@ class default_init_construct_iterator
|
||||
return dummy;
|
||||
}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void advance(Difference n)
|
||||
{ m_num -= n; }
|
||||
BOOST_CONTAINER_FORCEINLINE void advance(std::ptrdiff_t n)
|
||||
{ m_num = std::size_t(std::ptrdiff_t(m_num) - n); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE Difference distance_to(const this_type &other) const
|
||||
{ return m_num - other.m_num; }
|
||||
BOOST_CONTAINER_FORCEINLINE std::ptrdiff_t distance_to(const this_type &other) const
|
||||
{ return std::ptrdiff_t(m_num - other.m_num); }
|
||||
};
|
||||
|
||||
|
||||
template <class T, class Difference = std::ptrdiff_t>
|
||||
template <class T>
|
||||
class repeat_iterator
|
||||
: public ::boost::container::iterator
|
||||
<std::random_access_iterator_tag, T, Difference, T*, T&>
|
||||
<std::random_access_iterator_tag, T, std::ptrdiff_t, T*, T&>
|
||||
{
|
||||
typedef repeat_iterator<T, Difference> this_type;
|
||||
typedef repeat_iterator<T> this_type;
|
||||
public:
|
||||
BOOST_CONTAINER_FORCEINLINE explicit repeat_iterator(T &ref, Difference range_size)
|
||||
BOOST_CONTAINER_FORCEINLINE explicit repeat_iterator(T &ref, std::size_t range_size)
|
||||
: m_ptr(&ref), m_num(range_size){}
|
||||
|
||||
//Constructors
|
||||
@@ -427,33 +446,33 @@ class repeat_iterator
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const this_type& i, const this_type& i2)
|
||||
{ return !(i < i2); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE friend Difference operator- (const this_type& i, const this_type& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend std::ptrdiff_t operator- (const this_type& i, const this_type& i2)
|
||||
{ return i2.distance_to(i); }
|
||||
|
||||
//Arithmetic
|
||||
BOOST_CONTAINER_FORCEINLINE this_type& operator+=(Difference off)
|
||||
BOOST_CONTAINER_FORCEINLINE this_type& operator+=(std::ptrdiff_t off)
|
||||
{ this->advance(off); return *this; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE this_type operator+(Difference off) const
|
||||
BOOST_CONTAINER_FORCEINLINE this_type operator+(std::ptrdiff_t off) const
|
||||
{
|
||||
this_type other(*this);
|
||||
other.advance(off);
|
||||
return other;
|
||||
}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE friend this_type operator+(Difference off, const this_type& right)
|
||||
BOOST_CONTAINER_FORCEINLINE friend this_type operator+(std::ptrdiff_t off, const this_type& right)
|
||||
{ return right + off; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE this_type& operator-=(Difference off)
|
||||
BOOST_CONTAINER_FORCEINLINE this_type& operator-=(std::ptrdiff_t off)
|
||||
{ this->advance(-off); return *this; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE this_type operator-(Difference off) const
|
||||
BOOST_CONTAINER_FORCEINLINE this_type operator-(std::ptrdiff_t off) const
|
||||
{ return *this + (-off); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE T& operator*() const
|
||||
{ return dereference(); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE T& operator[] (Difference ) const
|
||||
BOOST_CONTAINER_FORCEINLINE T& operator[] (std::ptrdiff_t ) const
|
||||
{ return dereference(); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE T *operator->() const
|
||||
@@ -461,7 +480,7 @@ class repeat_iterator
|
||||
|
||||
private:
|
||||
T * m_ptr;
|
||||
Difference m_num;
|
||||
std::size_t m_num;
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void increment()
|
||||
{ --m_num; }
|
||||
@@ -478,22 +497,22 @@ class repeat_iterator
|
||||
BOOST_CONTAINER_FORCEINLINE T & dereference() const
|
||||
{ return *m_ptr; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void advance(Difference n)
|
||||
{ m_num -= n; }
|
||||
BOOST_CONTAINER_FORCEINLINE void advance(std::ptrdiff_t n)
|
||||
{ m_num = std::size_t(std::ptrdiff_t(m_num - n)); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE Difference distance_to(const this_type &other)const
|
||||
{ return m_num - other.m_num; }
|
||||
BOOST_CONTAINER_FORCEINLINE std::ptrdiff_t distance_to(const this_type &other)const
|
||||
{ return std::ptrdiff_t(m_num - other.m_num); }
|
||||
};
|
||||
|
||||
template <class T, class EmplaceFunctor, class Difference /*= std::ptrdiff_t*/>
|
||||
template <class T, class EmplaceFunctor>
|
||||
class emplace_iterator
|
||||
: public ::boost::container::iterator
|
||||
<std::random_access_iterator_tag, T, Difference, const T*, const T &>
|
||||
<std::random_access_iterator_tag, T, std::ptrdiff_t, const T*, const T &>
|
||||
{
|
||||
typedef emplace_iterator this_type;
|
||||
|
||||
public:
|
||||
typedef Difference difference_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
BOOST_CONTAINER_FORCEINLINE explicit emplace_iterator(EmplaceFunctor&e)
|
||||
: m_num(1), m_pe(&e){}
|
||||
|
||||
@@ -579,7 +598,7 @@ class emplace_iterator
|
||||
{ (*m_pe)(dest); }
|
||||
|
||||
private:
|
||||
difference_type m_num;
|
||||
std::size_t m_num;
|
||||
EmplaceFunctor * m_pe;
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void increment()
|
||||
|
||||
@@ -153,8 +153,8 @@ class basic_multiallocation_chain
|
||||
char_ptr elem = char_pointer_traits::static_cast_from(b);
|
||||
if(num_units){
|
||||
char_ptr prev_elem = elem;
|
||||
elem += unit_bytes;
|
||||
for(size_type i = 0; i != num_units-1; ++i, elem += unit_bytes){
|
||||
elem += difference_type(unit_bytes);
|
||||
for(size_type i = 0; i != num_units-1u; ++i, elem += difference_type(unit_bytes)){
|
||||
::new (boost::movelib::to_raw_pointer(prev_elem), boost_container_new_t()) void_pointer(elem);
|
||||
prev_elem = elem;
|
||||
}
|
||||
|
||||
@@ -48,13 +48,13 @@ struct grow_factor_ratio
|
||||
SizeType new_cap = 0;
|
||||
|
||||
if(cur_cap <= overflow_limit){
|
||||
new_cap = cur_cap * Numerator / Denominator;
|
||||
new_cap = SizeType(cur_cap * Numerator / Denominator);
|
||||
}
|
||||
else if(Denominator == 1 || (SizeType(new_cap = cur_cap) / Denominator) > overflow_limit){
|
||||
new_cap = (SizeType)-1;
|
||||
}
|
||||
else{
|
||||
new_cap *= Numerator;
|
||||
new_cap = SizeType(new_cap*Numerator);
|
||||
}
|
||||
return max_value<SizeType>
|
||||
( SizeType(Minimum)
|
||||
|
||||
@@ -329,7 +329,7 @@ struct node_alloc_holder
|
||||
|
||||
template<class FwdIterator, class Inserter>
|
||||
void allocate_many_and_construct
|
||||
(FwdIterator beg, difference_type n, Inserter inserter)
|
||||
(FwdIterator beg, size_type n, Inserter inserter)
|
||||
{
|
||||
if(n){
|
||||
typedef typename node_allocator_version_traits_type::multiallocation_chain multiallocation_chain_t;
|
||||
|
||||
@@ -711,7 +711,7 @@ class tree
|
||||
{
|
||||
//Optimized allocation and construction
|
||||
this->allocate_many_and_construct
|
||||
( first, boost::container::iterator_distance(first, last)
|
||||
( first, boost::container::iterator_udistance(first, last)
|
||||
, insert_equal_end_hint_functor<Node, Icont>(this->icont()));
|
||||
}
|
||||
|
||||
@@ -728,7 +728,7 @@ class tree
|
||||
{
|
||||
//Optimized allocation and construction
|
||||
this->allocate_many_and_construct
|
||||
( first, boost::container::iterator_distance(first, last)
|
||||
( first, boost::container::iterator_udistance(first, last)
|
||||
, dtl::push_back_functor<Node, Icont>(this->icont()));
|
||||
//AllocHolder clears in case of exception
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user