Fixes #207 ("boost.vector doesn't work with common_iterator")

This commit is contained in:
Ion Gaztañaga
2022-01-12 01:38:05 +01:00
parent 06e8ebd255
commit 3787fc3021
8 changed files with 225 additions and 26 deletions

View File

@@ -127,7 +127,7 @@ struct are_contiguous_and_same
: boost::move_detail::and_
< are_elements_contiguous<I>
, are_elements_contiguous<O>
, is_same< typename remove_const< typename ::boost::container::iterator_traits<I>::value_type >::type
, is_same< typename remove_const< typename ::boost::container::iter_value<I>::type >::type
, typename ::boost::container::iterator_traits<O>::value_type
>
>
@@ -137,7 +137,7 @@ template <typename I, typename O>
struct is_memtransfer_copy_assignable
: boost::move_detail::and_
< are_contiguous_and_same<I, O>
, dtl::is_trivially_copy_assignable< typename ::boost::container::iterator_traits<I>::value_type >
, dtl::is_trivially_copy_assignable< typename ::boost::container::iter_value<I>::type >
>
{};
@@ -145,7 +145,7 @@ template <typename I, typename O>
struct is_memtransfer_copy_constructible
: boost::move_detail::and_
< are_contiguous_and_same<I, O>
, dtl::is_trivially_copy_constructible< typename ::boost::container::iterator_traits<I>::value_type >
, dtl::is_trivially_copy_constructible< typename ::boost::container::iter_value<I>::type >
>
{};
@@ -174,7 +174,7 @@ 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::iter_value<I>::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);
@@ -192,7 +192,7 @@ template
typename F> // F models ForwardIterator
BOOST_CONTAINER_FORCEINLINE F memmove_n(I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW
{
typedef typename boost::container::iterator_traits<I>::value_type value_type;
typedef typename boost::container::iter_value<I>::type value_type;
typedef typename boost::container::iterator_traits<F>::difference_type r_difference_type;
if(BOOST_LIKELY(n != 0)){
void *dst = boost::movelib::iterator_to_raw_pointer(r);
@@ -211,7 +211,7 @@ template
BOOST_CONTAINER_FORCEINLINE I memmove_n_source(I f, std::size_t n, F r) BOOST_NOEXCEPT_OR_NOTHROW
{
if(BOOST_LIKELY(n != 0)){
typedef typename boost::container::iterator_traits<I>::value_type value_type;
typedef typename boost::container::iter_value<I>::type value_type;
typedef typename boost::container::iterator_traits<I>::difference_type i_difference_type;
void *dst = boost::movelib::iterator_to_raw_pointer(r);
const void *src = boost::movelib::iterator_to_raw_pointer(f);
@@ -227,7 +227,7 @@ template
typename F> // F models ForwardIterator
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;
typedef typename boost::container::iter_value<I>::type value_type;
typedef typename boost::container::iterator_traits<F>::difference_type i_difference_type;
typedef typename boost::container::iterator_traits<F>::difference_type f_difference_type;
@@ -273,14 +273,14 @@ struct disable_if_memzero_initializable
template <typename I, typename R>
struct enable_if_trivially_destructible
: enable_if_c < dtl::is_trivially_destructible
<typename boost::container::iterator_traits<I>::value_type>::value
<typename boost::container::iter_value<I>::type>::value
, R>
{};
template <typename I, typename R>
struct disable_if_trivially_destructible
: enable_if_c <!dtl::is_trivially_destructible
<typename boost::container::iterator_traits<I>::value_type>::value
<typename boost::container::iter_value<I>::type>::value
, R>
{};
@@ -913,7 +913,7 @@ typename F> // F models ForwardIterator
BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_memtransfer_copy_assignable<I, F, F>::type
move_backward(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::iter_value<I>::type value_type;
const std::size_t n = boost::container::iterator_udistance(f, l);
if (BOOST_LIKELY(n != 0)){
r -= n;

View File

@@ -29,6 +29,10 @@ namespace boost {
namespace container {
using ::boost::intrusive::iterator_traits;
using ::boost::intrusive::iter_difference;
using ::boost::intrusive::iter_category;
using ::boost::intrusive::iter_value;
using ::boost::intrusive::iter_size;
using ::boost::intrusive::iterator_distance;
using ::boost::intrusive::iterator_udistance;
using ::boost::intrusive::iterator_advance;

View File

@@ -130,13 +130,7 @@
#endif
#if (__cplusplus >= 201703L)
//CTAD supported
#ifdef __INTEL_COMPILER
//Intel compilers do not offer this feature yet
#define BOOST_CONTAINER_NO_CXX17_CTAD
#endif
#else
#if (BOOST_CXX_VERSION < 201703L) || !defined(__cpp_deduction_guides)
#define BOOST_CONTAINER_NO_CXX17_CTAD
#endif

View File

@@ -1292,7 +1292,7 @@ private:
>::type * = 0)
)
{
typedef typename iterator_traits<FwdIt>::size_type it_size_type;
typedef typename iter_size<FwdIt>::type it_size_type;
//For Fwd iterators the standard only requires EmplaceConstructible and assignable from *first
//so we can't do any backwards allocation
const it_size_type sz = boost::container::iterator_udistance(first, last);
@@ -2012,7 +2012,7 @@ private:
>::type * = 0
)
{
typedef typename iterator_traits<FwdIt>::size_type it_size_type;
typedef typename iter_size<FwdIt>::type it_size_type;
BOOST_ASSERT(this->priv_in_range_or_end(pos));
const it_size_type sz = boost::container::iterator_udistance(first, last);
if (sz > size_type(-1)){
@@ -3375,11 +3375,11 @@ private:
template <typename InputIterator>
vector(InputIterator, InputIterator) ->
vector<typename iterator_traits<InputIterator>::value_type>;
vector<typename iter_value<InputIterator>::type>;
template <typename InputIterator, typename Allocator>
vector(InputIterator, InputIterator, Allocator const&) ->
vector<typename iterator_traits<InputIterator>::value_type, Allocator>;
vector<typename iter_value<InputIterator>::type, Allocator>;
#endif