1 /////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2006-2014
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // See http://www.boost.org/libs/intrusive for documentation.
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef BOOST_INTRUSIVE_DETAIL_UNCAST_HPP
14 #define BOOST_INTRUSIVE_DETAIL_UNCAST_HPP
16 #ifndef BOOST_CONFIG_HPP
17 # include <boost/config.hpp>
20 #if defined(BOOST_HAS_PRAGMA_ONCE)
24 #include <boost/intrusive/detail/config_begin.hpp>
25 #include <boost/intrusive/pointer_traits.hpp>
26 #include <boost/intrusive/detail/mpl.hpp>
32 template<class ConstNodePtr>
35 typedef typename pointer_traits<ConstNodePtr>::element_type element_type;
36 typedef typename remove_const<element_type>::type non_const_type;
37 typedef typename pointer_traits<ConstNodePtr>::
38 template rebind_pointer<non_const_type>::type non_const_pointer;
39 typedef pointer_traits<non_const_pointer> non_const_traits;
42 template<class ConstNodePtr>
43 static typename uncast_types<ConstNodePtr>::non_const_pointer
44 uncast(const ConstNodePtr & ptr)
46 return uncast_types<ConstNodePtr>::non_const_traits::const_cast_from(ptr);
49 } //namespace detail {
50 } //namespace intrusive
53 #include <boost/intrusive/detail/config_end.hpp>
55 #endif //BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP