summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/intrusive/pointer_traits.hpp')
-rw-r--r--3rdParty/Boost/src/boost/intrusive/pointer_traits.hpp64
1 files changed, 36 insertions, 28 deletions
diff --git a/3rdParty/Boost/src/boost/intrusive/pointer_traits.hpp b/3rdParty/Boost/src/boost/intrusive/pointer_traits.hpp
index 98ca6b9..fe898f6 100644
--- a/3rdParty/Boost/src/boost/intrusive/pointer_traits.hpp
+++ b/3rdParty/Boost/src/boost/intrusive/pointer_traits.hpp
@@ -3,31 +3,32 @@
// (C) Copyright Pablo Halpern 2009. 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)
//
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2011-2013. 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_POINTER_TRAITS_HPP
#define BOOST_INTRUSIVE_POINTER_TRAITS_HPP
-#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+#if defined(_MSC_VER)
# pragma once
#endif
#include <boost/intrusive/detail/config_begin.hpp>
+#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/detail/memory_util.hpp>
-#include <boost/type_traits/integral_constant.hpp>
+#include <boost/intrusive/detail/mpl.hpp>
#include <cstddef>
namespace boost {
namespace intrusive {
//! pointer_traits is the implementation of C++11 std::pointer_traits class with some
@@ -56,52 +57,51 @@ struct pointer_traits
//!more type arguments ; otherwise, the instantiation of rebind is ill-formed.
//!
//!For portable code for C++03 and C++11, <pre>typename rebind_pointer<U>::type</pre>
//!shall be used instead of rebind<U> to obtain a pointer to U.
template <class U> using rebind = unspecified;
- //!Ptr::rebind<U> if such a type exists; otherwise, SomePointer<U, Args> if Ptr is
- //!a class template instantiation of the form SomePointer<T, Args>, where Args is zero or
- //!more type arguments ; otherwise, the instantiation of rebind is ill-formed.
+ //!Ptr::reference if such a type exists (non-standard extension); otherwise, element_type &
//!
typedef element_type &reference;
#else
typedef Ptr pointer;
//
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT
( boost::intrusive::detail::, Ptr, element_type
, boost::intrusive::detail::first_param<Ptr>) element_type;
//
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
(boost::intrusive::detail::, Ptr, difference_type, std::ptrdiff_t) difference_type;
- //
- typedef typename boost::intrusive::detail::unvoid<element_type>::type& reference;
+
+ typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
+ (boost::intrusive::detail::, Ptr, reference, typename boost::intrusive::detail::unvoid_ref<element_type>::type) reference;
//
template <class U> struct rebind_pointer
{
typedef typename boost::intrusive::detail::type_rebinder<Ptr, U>::type type;
};
- #if !defined(BOOST_NO_TEMPLATE_ALIASES)
+ #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template <class U> using rebind = typename boost::intrusive::detail::type_rebinder<Ptr, U>::type;
#endif
- #endif //#if !defined(BOOST_NO_TEMPLATE_ALIASES)
+ #endif //#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
//! <b>Remark</b>: If element_type is (possibly cv-qualified) void, r type is unspecified; otherwise,
//! it is element_type &.
//!
//! <b>Returns</b>: A dereferenceable pointer to r obtained by calling Ptr::pointer_to(r).
//! Non-standard extension: If such function does not exist, returns pointer(addressof(r));
static pointer pointer_to(reference r)
{
//Non-standard extension, it does not require Ptr::pointer_to. If not present
//tries to converts &r to pointer.
const bool value = boost::intrusive::detail::
has_member_function_callable_with_pointer_to
- <Ptr, typename boost::intrusive::detail::unvoid<element_type &>::type>::value;
- ::boost::integral_constant<bool, value> flag;
+ <Ptr, reference>::value;
+ boost::intrusive::detail::bool_<value> flag;
return pointer_traits::priv_pointer_to(flag, r);
}
//! <b>Remark</b>: Non-standard extension.
//!
//! <b>Returns</b>: A dereferenceable pointer to r obtained by calling Ptr::static_cast_from(r).
@@ -109,13 +109,13 @@ struct pointer_traits
template<class UPtr>
static pointer static_cast_from(const UPtr &uptr)
{
const bool value = boost::intrusive::detail::
has_member_function_callable_with_static_cast_from
<Ptr, const UPtr>::value;
- ::boost::integral_constant<bool, value> flag;
+ boost::intrusive::detail::bool_<value> flag;
return pointer_traits::priv_static_cast_from(flag, uptr);
}
//! <b>Remark</b>: Non-standard extension.
//!
//! <b>Returns</b>: A dereferenceable pointer to r obtained by calling Ptr::const_cast_from(r).
@@ -123,13 +123,13 @@ struct pointer_traits
template<class UPtr>
static pointer const_cast_from(const UPtr &uptr)
{
const bool value = boost::intrusive::detail::
has_member_function_callable_with_const_cast_from
<Ptr, const UPtr>::value;
- ::boost::integral_constant<bool, value> flag;
+ boost::intrusive::detail::bool_<value> flag;
return pointer_traits::priv_const_cast_from(flag, uptr);
}
//! <b>Remark</b>: Non-standard extension.
//!
//! <b>Returns</b>: A dereferenceable pointer to r obtained by calling Ptr::dynamic_cast_from(r).
@@ -137,13 +137,13 @@ struct pointer_traits
template<class UPtr>
static pointer dynamic_cast_from(const UPtr &uptr)
{
const bool value = boost::intrusive::detail::
has_member_function_callable_with_dynamic_cast_from
<Ptr, const UPtr>::value;
- ::boost::integral_constant<bool, value> flag;
+ boost::intrusive::detail::bool_<value> flag;
return pointer_traits::priv_dynamic_cast_from(flag, uptr);
}
///@cond
private:
//priv_to_raw_pointer
@@ -154,44 +154,52 @@ struct pointer_traits
template <class Pointer>
static typename pointer_traits<Pointer>::element_type*
to_raw_pointer(const Pointer &p)
{ return pointer_traits::to_raw_pointer(p.operator->()); }
//priv_pointer_to
- static pointer priv_pointer_to(boost::true_type, typename boost::intrusive::detail::unvoid<element_type>::type& r)
- { return Ptr::pointer_to(r); }
+ static pointer priv_pointer_to(boost::intrusive::detail::true_, reference r)
+ { return Ptr::pointer_to(r); }
- static pointer priv_pointer_to(boost::false_type, typename boost::intrusive::detail::unvoid<element_type>::type& r)
- { return pointer(boost::intrusive::detail::addressof(r)); }
+ static pointer priv_pointer_to(boost::intrusive::detail::false_, reference r)
+ { return pointer(boost::intrusive::detail::addressof(r)); }
//priv_static_cast_from
template<class UPtr>
- static pointer priv_static_cast_from(boost::true_type, const UPtr &uptr)
+ static pointer priv_static_cast_from(boost::intrusive::detail::true_, const UPtr &uptr)
{ return Ptr::static_cast_from(uptr); }
template<class UPtr>
- static pointer priv_static_cast_from(boost::false_type, const UPtr &uptr)
+ static pointer priv_static_cast_from(boost::intrusive::detail::false_, const UPtr &uptr)
{ return pointer_to(*static_cast<element_type*>(to_raw_pointer(uptr))); }
//priv_const_cast_from
template<class UPtr>
- static pointer priv_const_cast_from(boost::true_type, const UPtr &uptr)
+ static pointer priv_const_cast_from(boost::intrusive::detail::true_, const UPtr &uptr)
{ return Ptr::const_cast_from(uptr); }
template<class UPtr>
- static pointer priv_const_cast_from(boost::false_type, const UPtr &uptr)
+ static pointer priv_const_cast_from(boost::intrusive::detail::false_, const UPtr &uptr)
{ return pointer_to(const_cast<element_type&>(*uptr)); }
//priv_dynamic_cast_from
template<class UPtr>
- static pointer priv_dynamic_cast_from(boost::true_type, const UPtr &uptr)
+ static pointer priv_dynamic_cast_from(boost::intrusive::detail::true_, const UPtr &uptr)
{ return Ptr::dynamic_cast_from(uptr); }
template<class UPtr>
- static pointer priv_dynamic_cast_from(boost::false_type, const UPtr &uptr)
- { return pointer_to(*dynamic_cast<element_type*>(&*uptr)); }
+ static pointer priv_dynamic_cast_from(boost::intrusive::detail::false_, const UPtr &uptr)
+ {
+ element_type *p = dynamic_cast<element_type*>(&*uptr);
+ if(!p){
+ return pointer();
+ }
+ else{
+ return pointer_to(*p);
+ }
+ }
///@endcond
};
///@cond
// Remove cv qualification from Ptr parameter to pointer_traits:
@@ -221,14 +229,14 @@ struct pointer_traits<T*>
//!typedef for <pre>U *</pre>
//!
//!For portable code for C++03 and C++11, <pre>typename rebind_pointer<U>::type</pre>
//!shall be used instead of rebind<U> to obtain a pointer to U.
template <class U> using rebind = U*;
#else
- typedef typename boost::intrusive::detail::unvoid<element_type>::type& reference;
- #if !defined(BOOST_NO_TEMPLATE_ALIASES)
+ typedef typename boost::intrusive::detail::unvoid_ref<element_type>::type reference;
+ #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template <class U> using rebind = U*;
#endif
#endif
template <class U> struct rebind_pointer
{ typedef U* type; };