diff options
Diffstat (limited to 'boost/intrusive/detail/hashtable_node.hpp')
-rw-r--r-- | boost/intrusive/detail/hashtable_node.hpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/boost/intrusive/detail/hashtable_node.hpp b/boost/intrusive/detail/hashtable_node.hpp index d3b11d1b22..913c38da70 100644 --- a/boost/intrusive/detail/hashtable_node.hpp +++ b/boost/intrusive/detail/hashtable_node.hpp @@ -34,7 +34,6 @@ namespace boost { namespace intrusive { -namespace detail { template <class Slist> struct bucket_impl : public Slist @@ -149,8 +148,6 @@ struct get_slist_impl {}; }; -} //namespace detail { - template<class BucketValueTraits, bool IsConst> class hashtable_iterator { @@ -169,17 +166,22 @@ class hashtable_iterator private: typedef typename value_traits::node_traits node_traits; typedef typename node_traits::node_ptr node_ptr; - typedef typename detail::get_slist_impl - < typename detail::reduced_slist_node_traits + typedef typename get_slist_impl + < typename reduced_slist_node_traits <node_traits>::type >::type slist_impl; typedef typename slist_impl::iterator siterator; typedef typename slist_impl::const_iterator const_siterator; - typedef detail::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) { @@ -193,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()) {} @@ -211,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(); |