From b6cd6e26ad4e722724056e66cef360e9c04b5a42 Mon Sep 17 00:00:00 2001 From: Minmin Gong Date: Thu, 1 Jun 2017 00:11:06 -0700 Subject: [PATCH 1/3] Adds support for MSVC ARM64 target. --- include/boost/intrusive/detail/ebo_functor_holder.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/intrusive/detail/ebo_functor_holder.hpp b/include/boost/intrusive/detail/ebo_functor_holder.hpp index 31b2f81..27415c1 100644 --- a/include/boost/intrusive/detail/ebo_functor_holder.hpp +++ b/include/boost/intrusive/detail/ebo_functor_holder.hpp @@ -35,7 +35,7 @@ namespace detail { #define BOOST_INTRUSIVE_TT_DECL #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 #endif From db14782f0f7aa72b502b6296f0543ac0457d497e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Thu, 8 Jun 2017 14:02:21 +0200 Subject: [PATCH 2/3] Boost Trac #12698 GitHub Pull #23 GitHub Pull #24 --- doc/intrusive.qbk | 3 + include/boost/intrusive/detail/iterator.hpp | 110 +++++++++++++++++++- test/generic_assoc_test.hpp | 3 +- test/test_container.hpp | 15 +++ 4 files changed, 127 insertions(+), 4 deletions(-) diff --git a/doc/intrusive.qbk b/doc/intrusive.qbk index 82e4e8d..a83c203 100644 --- a/doc/intrusive.qbk +++ b/doc/intrusive.qbk @@ -3869,6 +3869,9 @@ to be inserted in intrusive containers are allocated using `std::vector` or `std * 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/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] diff --git a/include/boost/intrusive/detail/iterator.hpp b/include/boost/intrusive/detail/iterator.hpp index 2ae6abb..74f08cc 100644 --- a/include/boost/intrusive/detail/iterator.hpp +++ b/include/boost/intrusive/detail/iterator.hpp @@ -27,6 +27,24 @@ #include #include +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 +struct iterator_category_with_traversal; + +} //namespace boost{ +} //namespace iterators{ +} //namespace detail{ + namespace boost { namespace intrusive { @@ -45,6 +63,28 @@ struct iterator typedef Reference reference; }; +//////////////////////////////////////// +// iterator_[dis|en]able_if_boost_iterator +//////////////////////////////////////// +template +struct is_boost_iterator +{ + static const bool value = false; +}; + +template +struct is_boost_iterator< boost::iterators::detail::iterator_category_with_traversal > +{ + static const bool value = true; +}; + +template +struct iterator_enable_if_boost_iterator + : ::boost::move_detail::enable_if_c + < is_boost_iterator::iterator_category >::value + , R> +{}; + //////////////////////////////////////// // iterator_[dis|en]able_if_tag //////////////////////////////////////// @@ -68,6 +108,23 @@ struct iterator_disable_if_tag , R> {}; +//////////////////////////////////////// +// iterator_[dis|en]able_if_tag +//////////////////////////////////////// +template +struct iterator_enable_if_convertible_tag + : ::boost::move_detail::enable_if_c + < ::boost::move_detail::is_convertible + < typename boost::intrusive::iterator_traits::iterator_category + , Tag + >::value && + !::boost::move_detail::is_convertible + < typename boost::intrusive::iterator_traits::iterator_category + , Tag2 + >::value + , R> +{}; + //////////////////////////////////////// // iterator_[dis|en]able_if_tag_difference_type //////////////////////////////////////// @@ -84,8 +141,9 @@ struct iterator_disable_if_tag_difference_type //////////////////// // advance //////////////////// + template -typename iterator_enable_if_tag::type +BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag::type iterator_advance(InputIt& it, Distance n) { while(n--) @@ -101,7 +159,7 @@ typename iterator_enable_if_tag::type } template -typename iterator_enable_if_tag::type +BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag::type iterator_advance(InputIt& it, Distance n) { for (; 0 < n; --n) @@ -117,6 +175,54 @@ BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag +BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag + ::type + iterator_advance(InputIt& it, Distance n) +{ + while(n--) + ++it; +} + +template +BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag + ::type + iterator_advance(InputIt& it, Distance n) +{ + while(n--) + ++it; +} + +template +BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag + ::type + iterator_advance(InputIt& it, Distance n) +{ + while(n--) + ++it; +} + +template +BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag + ::type + iterator_advance(InputIt& it, Distance n) +{ + for (; 0 < n; --n) + ++it; + for (; n < 0; ++n) + --it; +} + +class fake{}; + +template +BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag + ::type + iterator_advance(InputIt& it, Distance n) +{ + it += n; +} + //////////////////// // distance //////////////////// diff --git a/test/generic_assoc_test.hpp b/test/generic_assoc_test.hpp index c3d81b6..74b4c5f 100644 --- a/test/generic_assoc_test.hpp +++ b/test/generic_assoc_test.hpp @@ -11,7 +11,6 @@ // ///////////////////////////////////////////////////////////////////////////// #include //vector -#include //sort, random_shuffle #include #include "common_functors.hpp" #include @@ -122,7 +121,7 @@ void test_generic_assoc::test_insert_erase_burst() } TEST_INTRUSIVE_SEQUENCE_EXPECTED(testset, testset.begin()); //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){ testset.erase(testset.iterator_to(*it_vector[i])); testset.check(); diff --git a/test/test_container.hpp b/test/test_container.hpp index b186920..6e98071 100644 --- a/test/test_container.hpp +++ b/test/test_container.hpp @@ -18,9 +18,11 @@ #include #include #include +#include #include #include #include "iterator_test.hpp" +#include namespace boost { namespace intrusive { @@ -552,6 +554,19 @@ template< class Container, class Data > void test_maybe_unique_container(Container & c, Data & d, detail::true_)//!is_unique { test_non_unique_container(c, d); } +template< class RandomIt > +void random_shuffle( RandomIt first, RandomIt last ) +{ + typedef typename boost::intrusive::iterator_traits::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 From ac718c54ed6cf8e605cca52f8890af86ccc92a19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Thu, 8 Jun 2017 21:51:53 +0200 Subject: [PATCH 3/3] Fix call to intrinsic is_convertible with incomplete types in MSVC 14.1 --- include/boost/intrusive/detail/iterator.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/boost/intrusive/detail/iterator.hpp b/include/boost/intrusive/detail/iterator.hpp index 74f08cc..c25be43 100644 --- a/include/boost/intrusive/detail/iterator.hpp +++ b/include/boost/intrusive/detail/iterator.hpp @@ -114,11 +114,11 @@ struct iterator_disable_if_tag template struct iterator_enable_if_convertible_tag : ::boost::move_detail::enable_if_c - < ::boost::move_detail::is_convertible + < ::boost::move_detail::is_same_or_convertible < typename boost::intrusive::iterator_traits::iterator_category , Tag >::value && - !::boost::move_detail::is_convertible + !::boost::move_detail::is_same_or_convertible < typename boost::intrusive::iterator_traits::iterator_category , Tag2 >::value @@ -177,7 +177,7 @@ BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag - ::type + ::type iterator_advance(InputIt& it, Distance n) { while(n--) @@ -186,7 +186,7 @@ BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag template BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag - ::type + ::type iterator_advance(InputIt& it, Distance n) { while(n--) @@ -195,7 +195,7 @@ BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag template BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag - ::type + ::type iterator_advance(InputIt& it, Distance n) { while(n--) @@ -204,7 +204,7 @@ BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag template BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag - ::type + ::type iterator_advance(InputIt& it, Distance n) { for (; 0 < n; --n) @@ -217,7 +217,7 @@ class fake{}; template BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag - ::type + ::type iterator_advance(InputIt& it, Distance n) { it += n;