forked from boostorg/intrusive
Merge branch 'develop'
This commit is contained in:
@@ -3869,6 +3869,9 @@ to be inserted in intrusive containers are allocated using `std::vector` or `std
|
|||||||
|
|
||||||
* Fixed bugs:
|
* Fixed bugs:
|
||||||
* [@https://svn.boost.org/trac/boost/ticket/12894 Boost Trac #12894: ['Allow non std::size_t size_type]]
|
* [@https://svn.boost.org/trac/boost/ticket/12894 Boost Trac #12894: ['Allow non std::size_t size_type]]
|
||||||
|
* [@https://svn.boost.org/trac/boost/ticket/12698 Boost Trac #12698: ['base64 iterators can't be used with iterator_advance]]
|
||||||
|
* [@https://github.com/boostorg/intrusive/pull/23 GitHub Pull #23: ['Conditionally replace deprecated/removed C++98 std::random_shuffle by...]]
|
||||||
|
* [@https://github.com/boostorg/intrusive/pull/24 GitHub Pull #24: ['Adds support for MSVC ARM64 target]]
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ namespace detail {
|
|||||||
#define BOOST_INTRUSIVE_TT_DECL
|
#define BOOST_INTRUSIVE_TT_DECL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) && !defined(_WIN64) && !defined(_M_ARM) && !defined(UNDER_CE)
|
#if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) && !defined(_WIN64) && !defined(_M_ARM) && !defined(_M_ARM64) && !defined(UNDER_CE)
|
||||||
#define BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
|
#define BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -27,6 +27,24 @@
|
|||||||
#include <boost/move/detail/iterator_traits.hpp>
|
#include <boost/move/detail/iterator_traits.hpp>
|
||||||
#include <boost/move/detail/meta_utils_core.hpp>
|
#include <boost/move/detail/meta_utils_core.hpp>
|
||||||
|
|
||||||
|
namespace boost{
|
||||||
|
namespace iterators{
|
||||||
|
|
||||||
|
struct incrementable_traversal_tag;
|
||||||
|
struct single_pass_traversal_tag;
|
||||||
|
struct forward_traversal_tag;
|
||||||
|
struct bidirectional_traversal_tag;
|
||||||
|
struct random_access_traversal_tag;
|
||||||
|
|
||||||
|
namespace detail{
|
||||||
|
|
||||||
|
template <class Category, class Traversal>
|
||||||
|
struct iterator_category_with_traversal;
|
||||||
|
|
||||||
|
} //namespace boost{
|
||||||
|
} //namespace iterators{
|
||||||
|
} //namespace detail{
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace intrusive {
|
namespace intrusive {
|
||||||
|
|
||||||
@@ -45,6 +63,28 @@ struct iterator
|
|||||||
typedef Reference reference;
|
typedef Reference reference;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////
|
||||||
|
// iterator_[dis|en]able_if_boost_iterator
|
||||||
|
////////////////////////////////////////
|
||||||
|
template<class I>
|
||||||
|
struct is_boost_iterator
|
||||||
|
{
|
||||||
|
static const bool value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class Category, class Traversal>
|
||||||
|
struct is_boost_iterator< boost::iterators::detail::iterator_category_with_traversal<Category, Traversal> >
|
||||||
|
{
|
||||||
|
static const bool value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class I, class R = void>
|
||||||
|
struct iterator_enable_if_boost_iterator
|
||||||
|
: ::boost::move_detail::enable_if_c
|
||||||
|
< is_boost_iterator<typename boost::intrusive::iterator_traits<I>::iterator_category >::value
|
||||||
|
, R>
|
||||||
|
{};
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// iterator_[dis|en]able_if_tag
|
// iterator_[dis|en]able_if_tag
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
@@ -68,6 +108,23 @@ struct iterator_disable_if_tag
|
|||||||
, R>
|
, R>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
|
////////////////////////////////////////
|
||||||
|
// iterator_[dis|en]able_if_tag
|
||||||
|
////////////////////////////////////////
|
||||||
|
template<class I, class Tag, class Tag2, class R = void>
|
||||||
|
struct iterator_enable_if_convertible_tag
|
||||||
|
: ::boost::move_detail::enable_if_c
|
||||||
|
< ::boost::move_detail::is_same_or_convertible
|
||||||
|
< typename boost::intrusive::iterator_traits<I>::iterator_category
|
||||||
|
, Tag
|
||||||
|
>::value &&
|
||||||
|
!::boost::move_detail::is_same_or_convertible
|
||||||
|
< typename boost::intrusive::iterator_traits<I>::iterator_category
|
||||||
|
, Tag2
|
||||||
|
>::value
|
||||||
|
, R>
|
||||||
|
{};
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// iterator_[dis|en]able_if_tag_difference_type
|
// iterator_[dis|en]able_if_tag_difference_type
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
@@ -84,8 +141,9 @@ struct iterator_disable_if_tag_difference_type
|
|||||||
////////////////////
|
////////////////////
|
||||||
// advance
|
// advance
|
||||||
////////////////////
|
////////////////////
|
||||||
|
|
||||||
template<class InputIt, class Distance>
|
template<class InputIt, class Distance>
|
||||||
typename iterator_enable_if_tag<InputIt, std::input_iterator_tag>::type
|
BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag<InputIt, std::input_iterator_tag>::type
|
||||||
iterator_advance(InputIt& it, Distance n)
|
iterator_advance(InputIt& it, Distance n)
|
||||||
{
|
{
|
||||||
while(n--)
|
while(n--)
|
||||||
@@ -101,7 +159,7 @@ typename iterator_enable_if_tag<InputIt, std::forward_iterator_tag>::type
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class InputIt, class Distance>
|
template<class InputIt, class Distance>
|
||||||
typename iterator_enable_if_tag<InputIt, std::bidirectional_iterator_tag>::type
|
BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag<InputIt, std::bidirectional_iterator_tag>::type
|
||||||
iterator_advance(InputIt& it, Distance n)
|
iterator_advance(InputIt& it, Distance n)
|
||||||
{
|
{
|
||||||
for (; 0 < n; --n)
|
for (; 0 < n; --n)
|
||||||
@@ -117,6 +175,54 @@ BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag<InputIt, std::random
|
|||||||
it += n;
|
it += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class InputIt, class Distance>
|
||||||
|
BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag
|
||||||
|
<InputIt, const boost::iterators::incrementable_traversal_tag&, const boost::iterators::single_pass_traversal_tag&>::type
|
||||||
|
iterator_advance(InputIt& it, Distance n)
|
||||||
|
{
|
||||||
|
while(n--)
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class InputIt, class Distance>
|
||||||
|
BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag
|
||||||
|
<InputIt, const boost::iterators::single_pass_traversal_tag &, const boost::iterators::forward_traversal_tag&>::type
|
||||||
|
iterator_advance(InputIt& it, Distance n)
|
||||||
|
{
|
||||||
|
while(n--)
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class InputIt, class Distance>
|
||||||
|
BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag
|
||||||
|
<InputIt, const boost::iterators::forward_traversal_tag&, const boost::iterators::bidirectional_traversal_tag&>::type
|
||||||
|
iterator_advance(InputIt& it, Distance n)
|
||||||
|
{
|
||||||
|
while(n--)
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class InputIt, class Distance>
|
||||||
|
BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag
|
||||||
|
<InputIt, const boost::iterators::bidirectional_traversal_tag&, const boost::iterators::random_access_traversal_tag&>::type
|
||||||
|
iterator_advance(InputIt& it, Distance n)
|
||||||
|
{
|
||||||
|
for (; 0 < n; --n)
|
||||||
|
++it;
|
||||||
|
for (; n < 0; ++n)
|
||||||
|
--it;
|
||||||
|
}
|
||||||
|
|
||||||
|
class fake{};
|
||||||
|
|
||||||
|
template<class InputIt, class Distance>
|
||||||
|
BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag
|
||||||
|
<InputIt, const boost::iterators::random_access_traversal_tag&, const fake&>::type
|
||||||
|
iterator_advance(InputIt& it, Distance n)
|
||||||
|
{
|
||||||
|
it += n;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
// distance
|
// distance
|
||||||
////////////////////
|
////////////////////
|
||||||
|
@@ -11,7 +11,6 @@
|
|||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
#include <boost/container/vector.hpp> //vector
|
#include <boost/container/vector.hpp> //vector
|
||||||
#include <algorithm> //sort, random_shuffle
|
|
||||||
#include <boost/intrusive/detail/config_begin.hpp>
|
#include <boost/intrusive/detail/config_begin.hpp>
|
||||||
#include "common_functors.hpp"
|
#include "common_functors.hpp"
|
||||||
#include <boost/intrusive/options.hpp>
|
#include <boost/intrusive/options.hpp>
|
||||||
@@ -122,7 +121,7 @@ void test_generic_assoc<ContainerDefiner>::test_insert_erase_burst()
|
|||||||
}
|
}
|
||||||
TEST_INTRUSIVE_SEQUENCE_EXPECTED(testset, testset.begin());
|
TEST_INTRUSIVE_SEQUENCE_EXPECTED(testset, testset.begin());
|
||||||
//Random erasure
|
//Random erasure
|
||||||
std::random_shuffle(it_vector.begin(), it_vector.end());
|
random_shuffle(it_vector.begin(), it_vector.end());
|
||||||
for(std::size_t i = 0; i != MaxValues; ++i){
|
for(std::size_t i = 0; i != MaxValues; ++i){
|
||||||
testset.erase(testset.iterator_to(*it_vector[i]));
|
testset.erase(testset.iterator_to(*it_vector[i]));
|
||||||
testset.check();
|
testset.check();
|
||||||
|
@@ -18,9 +18,11 @@
|
|||||||
#include <boost/intrusive/detail/simple_disposers.hpp>
|
#include <boost/intrusive/detail/simple_disposers.hpp>
|
||||||
#include <boost/intrusive/detail/iterator.hpp>
|
#include <boost/intrusive/detail/iterator.hpp>
|
||||||
#include <boost/move/utility_core.hpp>
|
#include <boost/move/utility_core.hpp>
|
||||||
|
#include <boost/move/adl_move_swap.hpp>
|
||||||
#include <boost/intrusive/detail/mpl.hpp>
|
#include <boost/intrusive/detail/mpl.hpp>
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
#include "iterator_test.hpp"
|
#include "iterator_test.hpp"
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace intrusive {
|
namespace intrusive {
|
||||||
@@ -552,6 +554,19 @@ template< class Container, class Data >
|
|||||||
void test_maybe_unique_container(Container & c, Data & d, detail::true_)//!is_unique
|
void test_maybe_unique_container(Container & c, Data & d, detail::true_)//!is_unique
|
||||||
{ test_non_unique_container(c, d); }
|
{ test_non_unique_container(c, d); }
|
||||||
|
|
||||||
|
template< class RandomIt >
|
||||||
|
void random_shuffle( RandomIt first, RandomIt last )
|
||||||
|
{
|
||||||
|
typedef typename boost::intrusive::iterator_traits<RandomIt>::difference_type difference_type;
|
||||||
|
difference_type n = last - first;
|
||||||
|
for (difference_type i = n-1; i > 0; --i) {
|
||||||
|
difference_type j = std::rand() % (i+1);
|
||||||
|
if(j != i) {
|
||||||
|
boost::adl_move_swap(first[i], first[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
#endif //#ifndef BOOST_INTRUSIVE_TEST_CONTAINER_HPP
|
#endif //#ifndef BOOST_INTRUSIVE_TEST_CONTAINER_HPP
|
||||||
|
Reference in New Issue
Block a user