#include <boost/container/detail/type_traits.hpp>
#include <boost/move/adl_move_swap.hpp> //adl_move_swap
+#include <boost/move/detail/force_ptr.hpp> //adl_move_swap
+
#include "varray_util.hpp"
// Linear O(N).
void swap_dispatch_impl(iterator first_sm, iterator last_sm, iterator first_la, iterator last_la, true_type const& /*use_memop*/)
{
- //BOOST_ASSERT_MSG(boost::container::iterator_distance(first_sm, last_sm) <= boost::container::iterator_distance(first_la, last_la));
+ //BOOST_ASSERT_MSG(boost::container::iterator_udistance(first_sm, last_sm) <= boost::container::iterator_udistance(first_la, last_la));
namespace sv = varray_detail;
for (; first_sm != last_sm ; ++first_sm, ++first_la)
::memcpy((addressof)(*first_la), temp_ptr, sizeof(value_type));
}
- ::memcpy(first_sm, first_la, sizeof(value_type) * boost::container::iterator_distance(first_la, last_la));
+ ::memcpy(first_sm, first_la, sizeof(value_type) * boost::container::iterator_udistance(first_la, last_la));
}
// @par Throws
// Linear O(N).
void swap_dispatch_impl(iterator first_sm, iterator last_sm, iterator first_la, iterator last_la, false_type const& /*use_memop*/)
{
- //BOOST_ASSERT_MSG(boost::container::iterator_distance(first_sm, last_sm) <= boost::container::iterator_distance(first_la, last_la));
+ //BOOST_ASSERT_MSG(boost::container::iterator_udistance(first_sm, last_sm) <= boost::container::iterator_udistance(first_la, last_la));
namespace sv = varray_detail;
for (; first_sm != last_sm ; ++first_sm, ++first_la)
{
errh::check_iterator_end_eq(*this, position);
- size_type count = boost::container::iterator_distance(first, last);
+ size_type count = boost::container::iterator_udistance(first, last);
errh::check_capacity(*this, m_size + count); // may throw
{
namespace sv = varray_detail;
- std::ptrdiff_t d = boost::container::iterator_distance(position, this->begin() + Capacity);
+ std::size_t d = boost::container::iterator_udistance(position, this->begin() + Capacity);
std::size_t count = sv::uninitialized_copy_s(first, last, position, d); // may throw
- errh::check_capacity(*this, count <= static_cast<std::size_t>(d) ? m_size + count : Capacity + 1); // may throw
+ errh::check_capacity(*this, count <= d ? m_size + count : Capacity + 1); // may throw
m_size += count;
}
else
{
- size_type count = boost::container::iterator_distance(first, last);
+ size_type count = boost::container::iterator_udistance(first, last);
errh::check_capacity(*this, m_size + count); // may throw
{
namespace sv = varray_detail;
- size_type s = boost::container::iterator_distance(first, last);
+ size_type s = boost::container::iterator_udistance(first, last);
errh::check_capacity(*this, s); // may throw
sv::destroy(it, this->end());
- std::ptrdiff_t d = boost::container::iterator_distance(it, this->begin() + Capacity);
+ std::size_t d = boost::container::iterator_udistance(it, this->begin() + Capacity);
std::size_t count = sv::uninitialized_copy_s(first, last, it, d); // may throw
s += count;
- errh::check_capacity(*this, count <= static_cast<std::size_t>(d) ? s : Capacity + 1); // may throw
+ errh::check_capacity(*this, count <= d ? s : Capacity + 1); // may throw
m_size = s; // update end
}
pointer ptr()
{
- return pointer(reinterpret_cast<Value*>(this));
+ return pointer(move_detail::force_ptr<Value*>(this));
}
const_pointer ptr() const
{
- return const_pointer(reinterpret_cast<const Value*>(this));
+ return const_pointer(move_detail::force_ptr<const Value*>(this));
}
};