Use directly boost::movelib::pointer_element/to_raw_pointer

This commit is contained in:
Ion Gaztañaga
2017-04-07 16:05:44 +02:00
parent db15ff6c08
commit 018a39c433
14 changed files with 34 additions and 115 deletions

View File

@ -255,7 +255,8 @@ struct get_key_of_value<void, T>
template<class ValuePtr, class VoidOrKeyOfValue, class VoidOrKeyComp>
struct bst_key_types
{
typedef typename pointer_element<ValuePtr>::type value_type;
typedef typename
boost::movelib::pointer_element<ValuePtr>::type value_type;
typedef typename get_key_of_value
< VoidOrKeyOfValue, value_type>::type key_of_value;
typedef typename key_of_value::type key_type;

View File

@ -23,7 +23,7 @@
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/to_raw_pointer.hpp>
#include <boost/move/detail/to_raw_pointer.hpp>
namespace boost {
namespace intrusive {
@ -48,7 +48,7 @@ struct default_header_holder : public NodeTraits::node
// (unsafe) downcast used to implement container-from-iterator
BOOST_INTRUSIVE_FORCEINLINE static default_header_holder* get_holder(const node_ptr &p)
{ return static_cast< default_header_holder* >(boost::intrusive::detail::to_raw_pointer(p)); }
{ return static_cast< default_header_holder* >(boost::movelib::to_raw_pointer(p)); }
};
// type function producing the header node holder

View File

@ -246,7 +246,7 @@ class hashtable_iterator
void increment()
{
const bucket_traits &rbuck_traits = this->priv_bucket_traits();
bucket_type* const buckets = boost::intrusive::detail::to_raw_pointer(rbuck_traits.bucket_begin());
bucket_type* const buckets = boost::movelib::to_raw_pointer(rbuck_traits.bucket_begin());
const size_type buckets_len = rbuck_traits.bucket_count();
++slist_it_;

View File

@ -26,7 +26,7 @@
#include <boost/intrusive/detail/parent_from_member.hpp>
#include <boost/intrusive/link_mode.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/detail/to_raw_pointer.hpp>
#include <boost/move/detail/to_raw_pointer.hpp>
#include <boost/intrusive/detail/node_holder.hpp>
namespace boost {
@ -128,14 +128,14 @@ struct mhtraits
{
return pointer_traits<pointer>::pointer_to
(*detail::parent_from_member<T, Hook>
(static_cast<Hook*>(boost::intrusive::detail::to_raw_pointer(n)), P));
(static_cast<Hook*>(boost::movelib::to_raw_pointer(n)), P));
}
BOOST_INTRUSIVE_FORCEINLINE static const_pointer to_value_ptr(const const_node_ptr & n)
{
return pointer_traits<const_pointer>::pointer_to
(*detail::parent_from_member<T, Hook>
(static_cast<const Hook*>(boost::intrusive::detail::to_raw_pointer(n)), P));
(static_cast<const Hook*>(boost::movelib::to_raw_pointer(n)), P));
}
};
@ -161,10 +161,10 @@ struct fhtraits
static const link_mode_type link_mode = hook_type::hooktags::link_mode;
static node_ptr to_node_ptr(reference value)
{ return static_cast<node*>(boost::intrusive::detail::to_raw_pointer(Functor::to_hook_ptr(value))); }
{ return static_cast<node*>(boost::movelib::to_raw_pointer(Functor::to_hook_ptr(value))); }
static const_node_ptr to_node_ptr(const_reference value)
{ return static_cast<const node*>(boost::intrusive::detail::to_raw_pointer(Functor::to_hook_ptr(value))); }
{ return static_cast<const node*>(boost::movelib::to_raw_pointer(Functor::to_hook_ptr(value))); }
static pointer to_value_ptr(const node_ptr & n)
{ return Functor::to_value_ptr(to_hook_ptr(n)); }

View File

@ -59,7 +59,7 @@ struct constptr
{}
const void *get_ptr() const
{ return boost::intrusive::detail::to_raw_pointer(const_void_ptr_); }
{ return boost::movelib::to_raw_pointer(const_void_ptr_); }
ConstVoidPtr const_void_ptr_;
};

View File

@ -1,42 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2014-2014. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/intrusive for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTRUSIVE_DETAIL_POINTER_ELEMENT_HPP
#define BOOST_INTRUSIVE_DETAIL_POINTER_ELEMENT_HPP
#ifndef BOOST_CONFIG_HPP
# include <boost/config.hpp>
#endif
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#ifndef BOOST_INTRUSIVE_DETAIL_WORKAROUND_HPP
#include <boost/intrusive/detail/workaround.hpp>
#endif //BOOST_INTRUSIVE_DETAIL_WORKAROUND_HPP
#include <boost/move/detail/pointer_element.hpp>
namespace boost {
namespace intrusive {
using ::boost::movelib::pointer_element;
namespace detail {
using ::boost::movelib::detail::first_param;
}
} //namespace intrusive {
} //namespace boost {
#endif // defined(BOOST_INTRUSIVE_DETAIL_POINTER_ELEMENT_HPP)

View File

@ -1,40 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2014-2014
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/intrusive for documentation.
//
/////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTRUSIVE_DETAIL_TO_RAW_POINTER_HPP
#define BOOST_INTRUSIVE_DETAIL_TO_RAW_POINTER_HPP
#ifndef BOOST_CONFIG_HPP
# include <boost/config.hpp>
#endif
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/move/detail/to_raw_pointer.hpp>
namespace boost {
namespace intrusive {
namespace detail {
using ::boost::movelib::to_raw_pointer;
} //namespace detail
} //namespace intrusive
} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
#endif //BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP

View File

@ -37,7 +37,8 @@ struct disable_if_smartref_to
|| detail::is_same
<From, typename pointer_traits
< typename pointer_rebind
<ValuePtr, const typename pointer_element<ValuePtr>::type>::type>
< ValuePtr
, const typename boost::movelib::pointer_element<ValuePtr>::type>::type>
::reference>::value
>
{};
@ -45,11 +46,13 @@ struct disable_if_smartref_to
//This function object takes a KeyCompare function object
//and compares values that contains keys using KeyOfValue
template< class ValuePtr, class KeyCompare, class KeyOfValue
, bool = boost::intrusive::detail::is_same<typename pointer_element<ValuePtr>::type, typename KeyOfValue::type>::value >
, bool = boost::intrusive::detail::is_same
<typename boost::movelib::pointer_element<ValuePtr>::type, typename KeyOfValue::type>::value >
struct tree_value_compare
: public boost::intrusive::detail::ebo_functor_holder<KeyCompare>
{
typedef typename pointer_element<ValuePtr>::type value_type;
typedef typename
boost::movelib::pointer_element<ValuePtr>::type value_type;
typedef KeyCompare key_compare;
typedef KeyOfValue key_of_value;
typedef typename KeyOfValue::type key_type;
@ -114,7 +117,8 @@ template<class ValuePtr, class KeyCompare, class KeyOfValue>
struct tree_value_compare<ValuePtr, KeyCompare, KeyOfValue, true>
: public boost::intrusive::detail::ebo_functor_holder<KeyCompare>
{
typedef typename pointer_element<ValuePtr>::type value_type;
typedef typename
boost::movelib::pointer_element<ValuePtr>::type value_type;
typedef KeyCompare key_compare;
typedef KeyOfValue key_of_value;
typedef typename KeyOfValue::type key_type;

View File

@ -1910,7 +1910,7 @@ class hashtable_impl
}
else{
size_type bucket_cnt = this->bucket_count();
const bucket_type *b = boost::intrusive::detail::to_raw_pointer(this->priv_bucket_pointer());
const bucket_type *b = boost::movelib::to_raw_pointer(this->priv_bucket_pointer());
for (size_type n = 0; n < bucket_cnt; ++n, ++b){
if(!b->empty()){
return false;
@ -1933,7 +1933,7 @@ class hashtable_impl
else{
size_type len = 0;
size_type bucket_cnt = this->bucket_count();
const bucket_type *b = boost::intrusive::detail::to_raw_pointer(this->priv_bucket_pointer());
const bucket_type *b = boost::movelib::to_raw_pointer(this->priv_bucket_pointer());
for (size_type n = 0; n < bucket_cnt; ++n, ++b){
len += b->size();
}

View File

@ -18,7 +18,7 @@
#include <boost/intrusive/link_mode.hpp>
#include <boost/intrusive/detail/parent_from_member.hpp>
#include <boost/intrusive/detail/to_raw_pointer.hpp>
#include <boost/move/detail/to_raw_pointer.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#if defined(BOOST_HAS_PRAGMA_ONCE)
@ -66,13 +66,13 @@ struct member_value_traits
BOOST_INTRUSIVE_FORCEINLINE static pointer to_value_ptr(const node_ptr &n)
{
return pointer_traits<pointer>::pointer_to(*detail::parent_from_member<value_type, node>
(boost::intrusive::detail::to_raw_pointer(n), PtrToMember));
(boost::movelib::to_raw_pointer(n), PtrToMember));
}
BOOST_INTRUSIVE_FORCEINLINE static const_pointer to_value_ptr(const const_node_ptr &n)
{
return pointer_traits<const_pointer>::pointer_to(*detail::parent_from_member<value_type, node>
(boost::intrusive::detail::to_raw_pointer(n), PtrToMember));
(boost::movelib::to_raw_pointer(n), PtrToMember));
}
};

View File

@ -20,7 +20,7 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/pointer_rebind.hpp>
#include <boost/intrusive/detail/pointer_element.hpp>
#include <boost/move/detail/pointer_element.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <cstddef>
@ -97,7 +97,7 @@ struct pointer_traits
//
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT
( boost::intrusive::detail::, Ptr, element_type
, boost::intrusive::detail::first_param<Ptr>) element_type;
, boost::movelib::detail::first_param<Ptr>) element_type;
//
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
(boost::intrusive::detail::, Ptr, difference_type, std::ptrdiff_t) difference_type;

View File

@ -337,9 +337,6 @@
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\parent_from_member.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\pointer_element.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\rbtree_node.hpp">
</File>
@ -361,9 +358,6 @@
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\std_fwd.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\to_raw_pointer.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\transform_iterator.hpp">
</File>

View File

@ -16,6 +16,7 @@
#include<boost/intrusive/detail/iterator.hpp>
#include<boost/intrusive/detail/mpl.hpp>
#include<boost/static_assert.hpp>
#include<boost/move/detail/to_raw_pointer.hpp>
namespace boost {
namespace intrusive {
@ -30,7 +31,7 @@ class delete_disposer
{
typedef typename boost::intrusive::iterator_traits<Pointer>::value_type value_type;
BOOST_STATIC_ASSERT(( detail::is_same<T, value_type>::value ));
delete boost::intrusive::detail::to_raw_pointer(p);
delete boost::movelib::to_raw_pointer(p);
}
};

View File

@ -15,11 +15,12 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/static_assert.hpp>
#include <boost/intrusive/detail/to_raw_pointer.hpp>
#include <boost/intrusive/detail/parent_from_member.hpp>
#include <boost/move/detail/to_raw_pointer.hpp>
#include <boost/static_assert.hpp>
#include <boost/detail/lightweight_test.hpp>
namespace boost{
namespace intrusive{
@ -103,14 +104,14 @@ struct nonhook_node_member_value_traits
{
return pointer_traits<pointer>::pointer_to
(*detail::parent_from_member<T, NonHook_Member>
(static_cast<NonHook_Member*>(boost::intrusive::detail::to_raw_pointer(n)), P));
(static_cast<NonHook_Member*>(boost::movelib::to_raw_pointer(n)), P));
}
static const_pointer to_value_ptr(const_node_ptr n)
{
return pointer_traits<const_pointer>::pointer_to
(*detail::parent_from_member<T, NonHook_Member>
(static_cast<const NonHook_Member*>(boost::intrusive::detail::to_raw_pointer(n)), P));
(static_cast<const NonHook_Member*>(boost::movelib::to_raw_pointer(n)), P));
}
};