merging intrusive from develop

This commit is contained in:
Ion Gaztañaga
2019-03-06 09:14:35 +01:00
6 changed files with 93 additions and 19 deletions

25
CMakeLists.txt Normal file
View File

@@ -0,0 +1,25 @@
# Copyright 2019 Mike Dev
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
#
# NOTE: CMake support for Boost.Intrusive is currently experimental at best
# and the interface is likely to change in the future
cmake_minimum_required( VERSION 3.5 )
project( Boost.Intrusive LANGUAGES CXX )
add_library (boost_intrusive INTERFACE )
add_library( Boost::intrusive ALIAS boost_intrusive )
target_include_directories( boost_intrusive INTERFACE include )
target_link_libraries( boost_intrusive
INTERFACE
Boost::assert
Boost::config
Boost::container_hash
Boost::core
Boost::move
Boost::static_assert
)

View File

@@ -3885,6 +3885,7 @@ to be inserted in intrusive containers are allocated using `std::vector` or `std
* Fixed bugs:
* [@https://github.com/boostorg/intrusive/pull/33 GitHub Pull #33: ['Fix compilation in case if key is void*, again]]
* [@https://github.com/boostorg/intrusive/issues/34 GitHub Issue #34: ['-Wdeprecated-copy on gcc9]]
* [@https://github.com/boostorg/intrusive/issues/35 GitHub Issue #35: ['key_of_value on treap_set seems to be broken in 1.69]]
* [@https://github.com/boostorg/intrusive/issues/38 GitHub Issue #38: ['treap: Same type for priority and key comparison leads to ambiguous base class error]]
* [@https://github.com/boostorg/intrusive/pull/39 GitHub Pull #39: ['Fix -Wextra-semi clang warnings]]

View File

@@ -171,12 +171,17 @@ class hashtable_iterator
<node_traits>::type >::type slist_impl;
typedef typename slist_impl::iterator siterator;
typedef typename slist_impl::const_iterator const_siterator;
typedef bucket_impl<slist_impl> bucket_type;
typedef bucket_impl<slist_impl> bucket_type;
typedef typename pointer_traits
<pointer>::template rebind_pointer
< const BucketValueTraits >::type const_bucketvaltraits_ptr;
typedef typename slist_impl::size_type size_type;
class nat;
typedef typename
detail::if_c< IsConst
, hashtable_iterator<BucketValueTraits, false>
, nat>::type nonconst_iterator;
BOOST_INTRUSIVE_FORCEINLINE static node_ptr downcast_bucket(typename bucket_type::node_ptr p)
{
@@ -190,12 +195,16 @@ class hashtable_iterator
: slist_it_() //Value initialization to achieve "null iterators" (N3644)
{}
explicit hashtable_iterator(siterator ptr, const BucketValueTraits *cont)
BOOST_INTRUSIVE_FORCEINLINE explicit hashtable_iterator(siterator ptr, const BucketValueTraits *cont)
: slist_it_ (ptr)
, traitsptr_ (cont ? pointer_traits<const_bucketvaltraits_ptr>::pointer_to(*cont) : const_bucketvaltraits_ptr() )
{}
BOOST_INTRUSIVE_FORCEINLINE hashtable_iterator(const hashtable_iterator<BucketValueTraits, false> &other)
BOOST_INTRUSIVE_FORCEINLINE hashtable_iterator(const hashtable_iterator &other)
: slist_it_(other.slist_it()), traitsptr_(other.get_bucket_value_traits())
{}
BOOST_INTRUSIVE_FORCEINLINE hashtable_iterator(const nonconst_iterator &other)
: slist_it_(other.slist_it()), traitsptr_(other.get_bucket_value_traits())
{}
@@ -208,7 +217,10 @@ class hashtable_iterator
BOOST_INTRUSIVE_FORCEINLINE hashtable_iterator& operator++()
{ this->increment(); return *this; }
hashtable_iterator operator++(int)
BOOST_INTRUSIVE_FORCEINLINE hashtable_iterator &operator=(const hashtable_iterator &other)
{ slist_it_ = other.slist_it(); traitsptr_ = other.get_bucket_value_traits(); return *this; }
BOOST_INTRUSIVE_FORCEINLINE hashtable_iterator operator++(int)
{
hashtable_iterator result (*this);
this->increment();

View File

@@ -47,6 +47,11 @@ class list_iterator
typedef typename types_t::node node;
typedef typename types_t::node_ptr node_ptr;
typedef typename types_t::const_value_traits_ptr const_value_traits_ptr;
class nat;
typedef typename
detail::if_c< IsConst
, list_iterator<value_traits, false>
, nat>::type nonconst_iterator;
public:
typedef typename types_t::iterator_type::difference_type difference_type;
@@ -62,15 +67,22 @@ class list_iterator
: members_(nodeptr, traits_ptr)
{}
BOOST_INTRUSIVE_FORCEINLINE list_iterator(list_iterator<ValueTraits, false> const& other)
BOOST_INTRUSIVE_FORCEINLINE list_iterator(const list_iterator &other)
: members_(other.pointed_node(), other.get_value_traits())
{}
BOOST_INTRUSIVE_FORCEINLINE list_iterator(const nonconst_iterator &other)
: members_(other.pointed_node(), other.get_value_traits())
{}
BOOST_INTRUSIVE_FORCEINLINE list_iterator &operator=(const list_iterator &other)
{ members_.nodeptr_ = other.members_.nodeptr_; return *this; }
BOOST_INTRUSIVE_FORCEINLINE node_ptr pointed_node() const
{ return members_.nodeptr_; }
BOOST_INTRUSIVE_FORCEINLINE list_iterator &operator=(const node_ptr &node)
{ members_.nodeptr_ = node; return static_cast<list_iterator&>(*this); }
{ members_.nodeptr_ = node; return *this; }
BOOST_INTRUSIVE_FORCEINLINE const_value_traits_ptr get_value_traits() const
{ return members_.get_ptr(); }
@@ -115,7 +127,7 @@ class list_iterator
BOOST_INTRUSIVE_FORCEINLINE pointer operator->() const
{ return this->operator_arrow(detail::bool_<stateful_value_traits>()); }
list_iterator<ValueTraits, false> unconst() const
BOOST_INTRUSIVE_FORCEINLINE list_iterator<ValueTraits, false> unconst() const
{ return list_iterator<ValueTraits, false>(this->pointed_node(), this->get_value_traits()); }
private:

View File

@@ -49,6 +49,11 @@ class slist_iterator
typedef typename types_t::node node;
typedef typename types_t::node_ptr node_ptr;
typedef typename types_t::const_value_traits_ptr const_value_traits_ptr;
class nat;
typedef typename
detail::if_c< IsConst
, slist_iterator<value_traits, false>
, nat>::type nonconst_iterator;
public:
typedef typename types_t::iterator_type::difference_type difference_type;
@@ -64,10 +69,17 @@ class slist_iterator
: members_(nodeptr, traits_ptr)
{}
BOOST_INTRUSIVE_FORCEINLINE slist_iterator(slist_iterator<ValueTraits, false> const& other)
BOOST_INTRUSIVE_FORCEINLINE slist_iterator(const slist_iterator &other)
: members_(other.pointed_node(), other.get_value_traits())
{}
BOOST_INTRUSIVE_FORCEINLINE slist_iterator(const nonconst_iterator &other)
: members_(other.pointed_node(), other.get_value_traits())
{}
BOOST_INTRUSIVE_FORCEINLINE slist_iterator &operator=(const slist_iterator &other)
{ members_.nodeptr_ = other.members_.nodeptr_; return *this; }
BOOST_INTRUSIVE_FORCEINLINE node_ptr pointed_node() const
{ return members_.nodeptr_; }

View File

@@ -55,6 +55,11 @@ class tree_iterator
void unspecified_bool_type_func() const {}
typedef void (tree_iterator::*unspecified_bool_type)() const;
class nat;
typedef typename
detail::if_c< IsConst
, tree_iterator<value_traits, false>
, nat>::type nonconst_iterator;
public:
typedef typename types_t::iterator_type::difference_type difference_type;
@@ -70,21 +75,28 @@ class tree_iterator
: members_(nodeptr, traits_ptr)
{}
BOOST_INTRUSIVE_FORCEINLINE tree_iterator(tree_iterator<value_traits, false> const& other)
BOOST_INTRUSIVE_FORCEINLINE tree_iterator(const tree_iterator &other)
: members_(other.pointed_node(), other.get_value_traits())
{}
BOOST_INTRUSIVE_FORCEINLINE tree_iterator(const nonconst_iterator &other)
: members_(other.pointed_node(), other.get_value_traits())
{}
BOOST_INTRUSIVE_FORCEINLINE tree_iterator &operator=(const tree_iterator &other)
{ members_.nodeptr_ = other.members_.nodeptr_; return *this; }
BOOST_INTRUSIVE_FORCEINLINE tree_iterator &operator=(const node_ptr &nodeptr)
{ members_.nodeptr_ = nodeptr; return *this; }
BOOST_INTRUSIVE_FORCEINLINE node_ptr pointed_node() const
{ return members_.nodeptr_; }
BOOST_INTRUSIVE_FORCEINLINE tree_iterator &operator=(const node_ptr &nodeptr)
{ members_.nodeptr_ = nodeptr; return static_cast<tree_iterator&>(*this); }
public:
tree_iterator& operator++()
BOOST_INTRUSIVE_FORCEINLINE tree_iterator& operator++()
{
members_.nodeptr_ = node_algorithms::next_node(members_.nodeptr_);
return static_cast<tree_iterator&> (*this);
return *this;
}
tree_iterator operator++(int)
@@ -94,10 +106,10 @@ class tree_iterator
return result;
}
tree_iterator& operator--()
BOOST_INTRUSIVE_FORCEINLINE tree_iterator& operator--()
{
members_.nodeptr_ = node_algorithms::prev_node(members_.nodeptr_);
return static_cast<tree_iterator&> (*this);
return *this;
}
tree_iterator operator--(int)
@@ -110,19 +122,19 @@ class tree_iterator
BOOST_INTRUSIVE_FORCEINLINE tree_iterator& go_left()
{
members_.nodeptr_ = node_traits::get_left(members_.nodeptr_);
return static_cast<tree_iterator&> (*this);
return *this;
}
BOOST_INTRUSIVE_FORCEINLINE tree_iterator& go_right()
{
members_.nodeptr_ = node_traits::get_right(members_.nodeptr_);
return static_cast<tree_iterator&> (*this);
return *this;
}
BOOST_INTRUSIVE_FORCEINLINE tree_iterator& go_parent()
{
members_.nodeptr_ = node_traits::get_parent(members_.nodeptr_);
return static_cast<tree_iterator&> (*this);
return *this;
}
BOOST_INTRUSIVE_FORCEINLINE operator unspecified_bool_type() const