Update of /cvsroot/boost/boost/boost/intrusive/detail
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20331/detail
Modified Files:
config_begin.hpp config_end.hpp hashtable_node.hpp
list_node.hpp parent_from_member.hpp pointer_to_other.hpp
rbtree_node.hpp slist_node.hpp utilities.hpp
Log Message:
Changes to correct regression tests for intel-win-9.1 & cw-9.4
Index: config_begin.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/detail/config_begin.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- config_begin.hpp 4 May 2007 21:22:02 -0000 1.1
+++ config_begin.hpp 12 May 2007 12:52:32 -0000 1.2
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztañaga 2006-2007
+// (C) Copyright Ion Gaztanaga 2006-2007
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -39,10 +39,5 @@
#pragma warning (disable : 4267) //conversion from 'X' to 'Y', possible
loss of data
#endif
-#include <boost/config.hpp>
-#include <boost/detail/workaround.hpp>
-
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
-# pragma warn -8026 // shut up warning "cannot inline function because ..."
-# pragma warn -8027 // shut up warning "cannot inline function because ..."
-#endif
+//#define BOOST_INTRUSIVE_USE_ITERATOR_FACADE
+//#define BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE
Index: config_end.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/detail/config_end.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- config_end.hpp 4 May 2007 21:22:02 -0000 1.1
+++ config_end.hpp 12 May 2007 12:52:32 -0000 1.2
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztañaga 2006-2007
+// (C) Copyright Ion Gaztanaga 2006-2007
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -9,14 +9,7 @@
// See http://www.boost.org/libs/intrusive for documentation.
//
/////////////////////////////////////////////////////////////////////////////
-#include <boost/config.hpp>
-#include <boost/detail/workaround.hpp>
-#if defined _MSC_VER
+#if defined BOOST_MSVC
#pragma warning (pop)
#endif
-
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
-# pragma warn .8026
-# pragma warn .8027
-#endif
Index: hashtable_node.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/detail/hashtable_node.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hashtable_node.hpp 4 May 2007 21:22:02 -0000 1.1
+++ hashtable_node.hpp 12 May 2007 12:52:32 -0000 1.2
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gazta�ga 2007
+// (C) Copyright Ion Gaztanaga 2007
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -16,10 +16,8 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <iterator>
#include <boost/assert.hpp>
-#include <boost/intrusive/detail/pointer_type.hpp>
#include <boost/intrusive/detail/pointer_to_other.hpp>
#include <boost/intrusive/circular_list_algorithms.hpp>
-#include <boost/get_pointer.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_convertible.hpp>
@@ -169,7 +167,6 @@
void increment()
{
- using boost::get_pointer;
size_type buckets_len = bucket_info_->buckets_len_;
const_bucket_ptr buckets = bucket_info_->buckets_;
const_local_iterator first =
bucket_type::bucket_to_slist(buckets[0]).cend();
Index: list_node.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/detail/list_node.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- list_node.hpp 4 May 2007 21:22:02 -0000 1.1
+++ list_node.hpp 12 May 2007 12:52:32 -0000 1.2
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztañaga 2006-2007
+// (C) Copyright Ion Gaztanaga 2006-2007
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -17,13 +17,15 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <iterator>
#include <boost/assert.hpp>
-#include <boost/intrusive/detail/pointer_type.hpp>
#include <boost/intrusive/detail/pointer_to_other.hpp>
#include <boost/intrusive/circular_list_algorithms.hpp>
-#include <boost/get_pointer.hpp>
+#ifdef BOOST_INTRUSIVE_USE_ITERATOR_FACADE
#include <boost/iterator/iterator_facade.hpp>
+#endif
+#ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_convertible.hpp>
+#endif
#include <cstddef>
namespace boost {
@@ -60,6 +62,8 @@
{ n->next_ = next; }
};
+#ifdef BOOST_INTRUSIVE_USE_ITERATOR_FACADE
+
// list_iterator provides some basic functions for a
// node oriented forward iterator:
template<class T, class ValueTraits>
@@ -123,6 +127,102 @@
node_ptr node_;
};
+#else //BOOST_INTRUSIVE_USE_ITERATOR_FACADE
+
+// list_iterator provides some basic functions for a
+// node oriented bidirectional iterator:
+template<class T, class ValueTraits>
+class list_iterator
+ : public std::iterator<std::bidirectional_iterator_tag, T>
+{
+ struct enabler{};
+ protected:
+ typedef typename ValueTraits::node_traits node_traits;
+ typedef typename node_traits::node node;
+ typedef typename node_traits::node_ptr node_ptr;
+
+ public:
+ typedef T & reference;
+ typedef T * pointer;
+
+ list_iterator()
+ : node_ (0)
+ {}
+
+ explicit list_iterator(node_ptr node)
+ : node_ (node)
+ {}
+ #ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE
+ template <class OtherValue>
+ list_iterator(list_iterator<OtherValue, ValueTraits> const& other
+ ,typename boost::enable_if<
+ boost::is_convertible<OtherValue*,T*>
+ , enabler
+ >::type = enabler()
+ )
+ : node_(other.pointed_node())
+ {}
+ #else
+ template <class OtherValue>
+ list_iterator(list_iterator<OtherValue, ValueTraits> const& other,
+ typename enable_if<
+ is_convertible<OtherValue*,T*>
+ >::type* = 0)
+ : node_(other.pointed_node())
+ {}
+ #endif
+
+ const node_ptr &pointed_node() const
+ { return node_; }
+
+ list_iterator &operator=(const node_ptr &node)
+ { node_ = node; return static_cast<list_iterator&>(*this); }
+
+ public:
+ list_iterator& operator++()
+ {
+ node_ = node_traits::get_next(node_);
+ return static_cast<list_iterator&> (*this);
+ }
+
+ list_iterator operator++(int)
+ {
+ list_iterator result (node_);
+ node_ = node_traits::get_next(node_);
+ return result;
+ }
+
+ list_iterator& operator--()
+ {
+ node_ = node_traits::get_previous(node_);
+ return static_cast<list_iterator&> (*this);
+ }
+
+ list_iterator operator--(int)
+ {
+ list_iterator result (node_);
+ node_ = node_traits::get_previous(node_);
+ return result;
+ }
+
+ bool operator== (const list_iterator& i) const
+ { return node_ == i.pointed_node(); }
+
+ bool operator!= (const list_iterator& i) const
+ { return !operator== (i); }
+
+ T& operator*() const
+ { return *ValueTraits::to_value_ptr(node_); }
+
+ pointer operator->() const
+ { return detail::get_pointer(ValueTraits::to_value_ptr(node_)); }
+
+ private:
+ node_ptr node_;
+};
+
+#endif
+
} //namespace detail
} //namespace intrusive
} //namespace boost
Index: parent_from_member.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/detail/parent_from_member.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- parent_from_member.hpp 4 May 2007 21:22:02 -0000 1.1
+++ parent_from_member.hpp 12 May 2007 12:52:32 -0000 1.2
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztañaga 2007
+// (C) Copyright Ion Gaztanaga 2007
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -12,6 +12,8 @@
#ifndef BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP
#define BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP
+#include <boost/intrusive/detail/config_begin.hpp>
+
namespace boost {
namespace intrusive {
namespace detail {
@@ -20,9 +22,12 @@
std::size_t offset_from_pointer_to_member(const Member Parent::* ptr_to_member)
{
//This works with gcc and msvc
+ //The implementation of a pointer to member is compiler dependent.
+ #if defined(BOOST_MSVC) || defined(__GNUC__) || defined(BOOST_INTEL)
return *(const std::size_t*)(const void*)&ptr_to_member;
- //Other compilers might need other transformation, depending how a
- //pointer to data member is implemented.
+ #else //CW 9.4
+ return *(const std::size_t*)(const void*)&ptr_to_member - 1;
+ #endif
}
template<class Parent, class Member>
@@ -43,4 +48,6 @@
} //namespace intrusive {
} //namespace boost {
+#include <boost/intrusive/detail/config_end.hpp>
+
#endif //#ifndef BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP
Index: pointer_to_other.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/detail/pointer_to_other.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- pointer_to_other.hpp 4 May 2007 21:22:02 -0000 1.1
+++ pointer_to_other.hpp 12 May 2007 12:52:32 -0000 1.2
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztañaga 2006. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2006. 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)
//
Index: rbtree_node.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/detail/rbtree_node.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- rbtree_node.hpp 4 May 2007 21:22:02 -0000 1.1
+++ rbtree_node.hpp 12 May 2007 12:52:32 -0000 1.2
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztañaga 2006-2007.
+// (C) Copyright Ion Gaztanaga 2006-2007.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -17,16 +17,18 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <iterator>
#include <boost/assert.hpp>
-#include <boost/intrusive/detail/pointer_type.hpp>
#include <boost/intrusive/detail/pointer_to_other.hpp>
#include <boost/intrusive/rbtree_algorithms.hpp>
-#include <boost/get_pointer.hpp>
#include <boost/type_traits/alignment_of.hpp>
#include <cstddef>
#include <boost/detail/no_exceptions_support.hpp>
+#ifdef BOOST_INTRUSIVE_USE_ITERATOR_FACADE
#include <boost/iterator/iterator_facade.hpp>
+#endif
+#ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_convertible.hpp>
+#endif
#include <boost/intrusive/pointer_plus_bit.hpp>
namespace boost {
@@ -186,6 +188,8 @@
// //
/////////////////////////////////////////////////////////////////////////////
+#ifdef BOOST_INTRUSIVE_USE_ITERATOR_FACADE
+
template<class T, class ValueTraits>
class rbtree_iterator
: public boost::iterator_facade
@@ -248,6 +252,104 @@
node_ptr node_;
};
+#else
+
+// rbtree_iterator provides some basic functions for a
+// node oriented bidirectional iterator:
+template<class T, class ValueTraits>
+class rbtree_iterator
+ : public std::iterator<std::bidirectional_iterator_tag, T>
+{
+ struct enabler{};
+ protected:
+ typedef typename ValueTraits::node_traits node_traits;
+ typedef typename node_traits::node node;
+ typedef typename node_traits::node_ptr node_ptr;
+ typedef rbtree_algorithms<node_traits> node_algorithms;
+
+ public:
+ typedef T & reference;
+ typedef T * pointer;
+
+ rbtree_iterator()
+ : node_ (0)
+ {}
+
+ explicit rbtree_iterator(node_ptr node)
+ : node_ (node)
+ {}
+
+ #ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE
+ template <class OtherValue>
+ rbtree_iterator(rbtree_iterator<OtherValue, ValueTraits> const& other
+ ,typename boost::enable_if<
+ boost::is_convertible<OtherValue*,T*>
+ , enabler
+ >::type = enabler()
+ )
+ : node_(other.pointed_node())
+ {}
+ #else
+ template <class OtherValue>
+ rbtree_iterator(rbtree_iterator<OtherValue, ValueTraits> const& other,
+ typename enable_if<
+ is_convertible<OtherValue*,T*>
+ >::type* = 0)
+ : node_(other.pointed_node())
+ {}
+ #endif
+
+ const node_ptr &pointed_node() const
+ { return node_; }
+
+ rbtree_iterator &operator=(const node_ptr &node)
+ { node_ = node; return static_cast<rbtree_iterator&>(*this); }
+
+ public:
+ rbtree_iterator& operator++()
+ {
+ node_ = node_algorithms::next_node(node_);
+ return static_cast<rbtree_iterator&> (*this);
+ }
+
+ rbtree_iterator operator++(int)
+ {
+ rbtree_iterator result (node_);
+ node_ = node_algorithms::next_node(node_);
+ return result;
+ }
+
+ rbtree_iterator& operator--()
+ {
+ node_ = node_algorithms::prev_node(node_);
+ return static_cast<rbtree_iterator&> (*this);
+ }
+
+ rbtree_iterator operator--(int)
+ {
+ rbtree_iterator result (node_);
+ node_ = node_algorithms::prev_node(node_);
+ return result;
+ }
+
+ bool operator== (const rbtree_iterator& i) const
+ { return node_ == i.pointed_node(); }
+
+ bool operator!= (const rbtree_iterator& i) const
+ { return !operator== (i); }
+
+ T& operator*() const
+ { return *ValueTraits::to_value_ptr(node_); }
+
+ pointer operator->() const
+ { return detail::get_pointer(ValueTraits::to_value_ptr(node_)); }
+
+ private:
+ node_ptr node_;
+};
+
+#endif
+
} //namespace detail
} //namespace intrusive
} //namespace boost
Index: slist_node.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/detail/slist_node.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- slist_node.hpp 4 May 2007 21:22:02 -0000 1.1
+++ slist_node.hpp 12 May 2007 12:52:32 -0000 1.2
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztañaga 2006-2007
+// (C) Copyright Ion Gaztanaga 2006-2007
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -17,13 +17,15 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <iterator>
#include <boost/assert.hpp>
-#include <boost/intrusive/detail/pointer_type.hpp>
#include <boost/intrusive/detail/pointer_to_other.hpp>
#include <boost/intrusive/circular_slist_algorithms.hpp>
-#include <boost/get_pointer.hpp>
+#ifdef BOOST_INTRUSIVE_USE_ITERATOR_FACADE
#include <boost/iterator/iterator_facade.hpp>
+#endif
+#ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_convertible.hpp>
+#endif
#include <cstddef>
namespace boost {
@@ -55,6 +57,7 @@
{ n->next_ = next; }
};
+#ifdef BOOST_INTRUSIVE_USE_ITERATOR_FACADE
// slist_iterator provides some basic functions for a
// node oriented forward iterator:
@@ -86,6 +89,7 @@
: node_ (node)
{}
+ #ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE
template <class OtherValue>
slist_iterator(slist_iterator<OtherValue, ValueTraits> const& other
,typename boost::enable_if<
@@ -95,6 +99,15 @@
)
: node_(other.pointed_node())
{}
+ #else
+ template <class OtherValue>
+ slist_iterator(slist_iterator<OtherValue, ValueTraits> const& other,
+ typename enable_if<
+ is_convertible<OtherValue*,T*>
+ >::type* = 0)
+ : node_(other.pointed_node())
+ {}
+ #endif
const node_ptr &pointed_node() const
{ return node_; }
@@ -116,6 +129,85 @@
node_ptr node_;
};
+#else
+
+// slist_iterator provides some basic functions for a
+// node oriented bidirectional iterator:
+template<class T, class ValueTraits>
+class slist_iterator
+ : public std::iterator<std::forward_iterator_tag, T>
+{
+ struct enabler{};
+ protected:
+ typedef typename ValueTraits::node_traits node_traits;
+ typedef typename node_traits::node node;
+ typedef typename node_traits::node_ptr node_ptr;
+
+ public:
+ typedef T & reference;
+ typedef T * pointer;
+
+ slist_iterator()
+ : node_ (0)
+ {}
+
+ explicit slist_iterator(node_ptr node)
+ : node_ (node)
+ {}
+/*
+ template <class OtherValue>
+ slist_iterator(slist_iterator<OtherValue, ValueTraits> const& other
+ ,typename boost::enable_if<
+ boost::is_convertible<OtherValue*,T*>
+ , enabler
+ >::type = enabler()
+ )
+ : node_(other.pointed_node())
+ {}
+*/
+ template <class OtherValue>
+ slist_iterator(slist_iterator<OtherValue, ValueTraits> const& other)
+ : node_(other.pointed_node())
+ {}
+
+ const node_ptr &pointed_node() const
+ { return node_; }
+
+ slist_iterator &operator=(const node_ptr &node)
+ { node_ = node; return static_cast<slist_iterator&>(*this); }
+
+ public:
+ slist_iterator& operator++()
+ {
+ node_ = node_traits::get_next(node_);
+ return static_cast<slist_iterator&> (*this);
+ }
+
+ slist_iterator operator++(int)
+ {
+ slist_iterator result (node_);
+ node_ = node_traits::get_next(node_);
+ return result;
+ }
+
+ bool operator== (const slist_iterator& i) const
+ { return node_ == i.pointed_node(); }
+
+ bool operator!= (const slist_iterator& i) const
+ { return !operator== (i); }
+
+ T& operator*() const
+ { return *ValueTraits::to_value_ptr(node_); }
+
+ pointer operator->() const
+ { return detail::get_pointer(ValueTraits::to_value_ptr(node_)); }
+
+ private:
+ node_ptr node_;
+};
+
+#endif
+
} //namespace detail
} //namespace intrusive
} //namespace boost
Index: utilities.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/detail/utilities.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- utilities.hpp 4 May 2007 21:22:02 -0000 1.1
+++ utilities.hpp 12 May 2007 12:52:32 -0000 1.2
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztañaga 2006-2007
+// (C) Copyright Ion Gaztanaga 2006-2007
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -14,18 +14,41 @@
#define BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP
#include <boost/intrusive/detail/config_begin.hpp>
-#include <boost/intrusive/detail/pointer_type.hpp>
#include <boost/intrusive/detail/pointer_to_other.hpp>
#include <boost/intrusive/detail/parent_from_member.hpp>
#include <boost/intrusive/detail/ebo_holder.hpp>
#include <boost/intrusive/linking_policy.hpp>
-#include <boost/get_pointer.hpp>
#include <cstddef>
namespace boost {
namespace intrusive {
namespace detail {
+template<class SmartPtr>
+struct smart_ptr_type
+{
+ typedef typename SmartPtr::value_type value_type;
+ typedef value_type *pointer;
+ static pointer get (const SmartPtr &smartptr)
+ { return smartptr.get();}
+};
+
+template<class T>
+struct smart_ptr_type<T*>
+{
+ typedef T value_type;
+ typedef value_type *pointer;
+ static pointer get (pointer ptr)
+ { return ptr;}
+};
+
+//!Overload for smart pointers to avoid ADL problems with get_pointer
+template<class Ptr>
+inline typename smart_ptr_type<Ptr>::pointer
+get_pointer(const Ptr &ptr)
+{ return smart_ptr_type<Ptr>::get(ptr); }
+//{ using boost::get_pointer; return get_pointer(ptr); }
+
//This functor compares a stored value
//and the one passed as an argument
template<class ConstReference>
@@ -112,14 +135,12 @@
static pointer to_value_ptr(node_ptr n)
{
- using boost::get_pointer;
- return static_cast<T*>(get_pointer(DerivationHookType::to_hook_ptr(n)));
+ return
static_cast<T*>(detail::get_pointer(DerivationHookType::to_hook_ptr(n)));
}
static const_pointer to_value_ptr(const_node_ptr n)
{
- using boost::get_pointer;
- return static_cast<const
T*>(get_pointer(DerivationHookType::to_hook_ptr(n)));
+ return static_cast<const
T*>(detail::get_pointer(DerivationHookType::to_hook_ptr(n)));
}
};
@@ -158,27 +179,14 @@
//the needed bytes.
static pointer to_value_ptr(node_ptr n)
{
- using boost::get_pointer;
- return pointer(parent_from_member((MemberHookType*)get_pointer(n), P));
+ return pointer(parent_from_member<value_type, MemberHookType>
+ ((MemberHookType*)detail::get_pointer(n), P));
}
static const_pointer to_value_ptr(const_node_ptr n)
{
- using boost::get_pointer;
- const_pointer(parent_from_member<value_type>((const
MemberHookType*)get_pointer(n), P));
- }
-
- private:
- //This function converts a pointer to data member into an offset.
- //This function is not standard and it's compiler-dependent.
- static std::size_t value_to_node_offset()
- {
- const MemberHookType T::* const p = P;
- return *(const std::size_t*)(const void *)(&p);
-// using boost::get_pointer;
-// const typename node_traits::node *np =
-// get_pointer((((const value_type
*)get_pointer(n))->*P).to_node_ptr());
-// return ((const char*)np - (const char*)(const value_type
*)get_pointer(n));
+ const_pointer(parent_from_member<value_type, MemberHookType>
+ ((const MemberHookType*)detail::get_pointer(n), P));
}
};
@@ -207,7 +215,6 @@
}
};
-
template<class F, class ValueTraits>
struct value_to_node_cloner
: private detail::ebo_holder<F>
@@ -243,14 +250,14 @@
template<class Container>
void destructor_impl(Container &cont, dispatcher<safe_link>)
-{ BOOST_ASSERT(!cont.is_linked()); }
+{ (void)cont; BOOST_ASSERT(!cont.is_linked()); }
template<class Container>
void destructor_impl(Container &cont, dispatcher<auto_unlink>)
{ cont.unlink(); }
template<class Container>
-void destructor_impl(Container &cont, dispatcher<normal_link>)
+void destructor_impl(Container &, dispatcher<normal_link>)
{}
template<class Node, class MaybeClass>
@@ -283,6 +290,32 @@
{ return static_cast<const node_plus_pred*>(n); }
};
+#ifndef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE
+
+template <bool B, class T = void>
+struct enable_if_c {
+ typedef T type;
+};
+
+template <class T>
+struct enable_if_c<false, T> {};
+
+template <class Cond, class T = void>
+struct enable_if : public enable_if_c<Cond::value, T> {};
+
+template <class T, class U>
+class is_convertible
+{
+ typedef char true_t;
+ class false_t { char dummy[2]; };
+ static true_t dispatch(U);
+ static false_t dispatch(...);
+ static T trigger();
+ public:
+ enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) };
+};
+
+#endif //#ifndef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE
} //namespace detail
} //namespace intrusive
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs