Chris@102
|
1 /////////////////////////////////////////////////////////////////////////////
|
Chris@102
|
2 //
|
Chris@102
|
3 // (C) Copyright Ion Gaztanaga 2006-2014
|
Chris@102
|
4 //
|
Chris@102
|
5 // Distributed under the Boost Software License, Version 1.0.
|
Chris@102
|
6 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@102
|
7 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@102
|
8 //
|
Chris@102
|
9 // See http://www.boost.org/libs/intrusive for documentation.
|
Chris@102
|
10 //
|
Chris@102
|
11 /////////////////////////////////////////////////////////////////////////////
|
Chris@102
|
12
|
Chris@102
|
13 #ifndef BOOST_INTRUSIVE_DETAIL_UNCAST_HPP
|
Chris@102
|
14 #define BOOST_INTRUSIVE_DETAIL_UNCAST_HPP
|
Chris@102
|
15
|
Chris@102
|
16 #ifndef BOOST_CONFIG_HPP
|
Chris@102
|
17 # include <boost/config.hpp>
|
Chris@102
|
18 #endif
|
Chris@102
|
19
|
Chris@102
|
20 #if defined(BOOST_HAS_PRAGMA_ONCE)
|
Chris@102
|
21 # pragma once
|
Chris@102
|
22 #endif
|
Chris@102
|
23
|
Chris@102
|
24 #include <boost/intrusive/detail/config_begin.hpp>
|
Chris@102
|
25 #include <boost/intrusive/pointer_traits.hpp>
|
Chris@102
|
26 #include <boost/intrusive/detail/mpl.hpp>
|
Chris@102
|
27
|
Chris@102
|
28 namespace boost {
|
Chris@102
|
29 namespace intrusive {
|
Chris@102
|
30 namespace detail {
|
Chris@102
|
31
|
Chris@102
|
32 template<class ConstNodePtr>
|
Chris@102
|
33 struct uncast_types
|
Chris@102
|
34 {
|
Chris@102
|
35 typedef typename pointer_traits<ConstNodePtr>::element_type element_type;
|
Chris@102
|
36 typedef typename remove_const<element_type>::type non_const_type;
|
Chris@102
|
37 typedef typename pointer_traits<ConstNodePtr>::
|
Chris@102
|
38 template rebind_pointer<non_const_type>::type non_const_pointer;
|
Chris@102
|
39 typedef pointer_traits<non_const_pointer> non_const_traits;
|
Chris@102
|
40 };
|
Chris@102
|
41
|
Chris@102
|
42 template<class ConstNodePtr>
|
Chris@102
|
43 static typename uncast_types<ConstNodePtr>::non_const_pointer
|
Chris@102
|
44 uncast(const ConstNodePtr & ptr)
|
Chris@102
|
45 {
|
Chris@102
|
46 return uncast_types<ConstNodePtr>::non_const_traits::const_cast_from(ptr);
|
Chris@102
|
47 }
|
Chris@102
|
48
|
Chris@102
|
49 } //namespace detail {
|
Chris@102
|
50 } //namespace intrusive
|
Chris@102
|
51 } //namespace boost
|
Chris@102
|
52
|
Chris@102
|
53 #include <boost/intrusive/detail/config_end.hpp>
|
Chris@102
|
54
|
Chris@102
|
55 #endif //BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP
|