1 | ///////////////////////////////////////////////////////////////////////////// |
---|---|
2 | // |
3 | // (C) Copyright Ion Gaztanaga 2006-2014 |
4 | // |
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) |
8 | // |
9 | // See http://www.boost.org/libs/intrusive for documentation. |
10 | // |
11 | ///////////////////////////////////////////////////////////////////////////// |
12 | |
13 | #ifndef BOOST_INTRUSIVE_DETAIL_UNCAST_HPP |
14 | #define BOOST_INTRUSIVE_DETAIL_UNCAST_HPP |
15 | |
16 | #ifndef BOOST_CONFIG_HPP |
17 | # include <boost/config.hpp> |
18 | #endif |
19 | |
20 | #if defined(BOOST_HAS_PRAGMA_ONCE) |
21 | # pragma once |
22 | #endif |
23 | |
24 | #include <boost/intrusive/detail/config_begin.hpp> |
25 | #include <boost/intrusive/pointer_traits.hpp> |
26 | #include <boost/intrusive/detail/mpl.hpp> |
27 | |
28 | namespace boost { |
29 | namespace intrusive { |
30 | namespace detail { |
31 | |
32 | template<class ConstNodePtr> |
33 | struct uncast_types |
34 | { |
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; |
40 | }; |
41 | |
42 | template<class ConstNodePtr> |
43 | static typename uncast_types<ConstNodePtr>::non_const_pointer |
44 | uncast(const ConstNodePtr & ptr) |
45 | { |
46 | return uncast_types<ConstNodePtr>::non_const_traits::const_cast_from(ptr); |
47 | } |
48 | |
49 | } //namespace detail { |
50 | } //namespace intrusive |
51 | } //namespace boost |
52 | |
53 | #include <boost/intrusive/detail/config_end.hpp> |
54 | |
55 | #endif //BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP |
56 |