1
2// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
3// Use, modification and distribution are subject to the Boost Software License,
4// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt).
6//
7// See http://www.boost.org/libs/type_traits for most recent version including documentation.
8
9#ifndef BOOST_TT_REMOVE_POINTER_HPP_INCLUDED
10#define BOOST_TT_REMOVE_POINTER_HPP_INCLUDED
11
12#include <boost/config.hpp>
13#include <boost/detail/workaround.hpp>
14
15#if defined(BOOST_MSVC)
16#include <boost/type_traits/remove_cv.hpp>
17#include <boost/type_traits/is_pointer.hpp>
18#endif
19
20// should be the last #include
21#include <boost/type_traits/detail/type_trait_def.hpp>
22
23namespace boost {
24
25#ifdef BOOST_MSVC
26
27namespace detail{
28
29 //
30 // We need all this crazy indirection because a type such as:
31 //
32 // T (*const)(U)
33 //
34 // Does not bind to a <T*> or <T*const> partial specialization with VC10 and earlier
35 //
36 template <class T>
37 struct remove_pointer_imp
38 {
39 typedef T type;
40 };
41
42 template <class T>
43 struct remove_pointer_imp<T*>
44 {
45 typedef T type;
46 };
47
48 template <class T, bool b>
49 struct remove_pointer_imp3
50 {
51 typedef typename remove_pointer_imp<typename boost::remove_cv<T>::type>::type type;
52 };
53
54 template <class T>
55 struct remove_pointer_imp3<T, false>
56 {
57 typedef T type;
58 };
59
60 template <class T>
61 struct remove_pointer_imp2
62 {
63 typedef typename remove_pointer_imp3<T, ::boost::is_pointer<T>::value>::type type;
64 };
65}
66
67BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,typename boost::detail::remove_pointer_imp2<T>::type)
68
69#else
70
71BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,T)
72BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T*,T)
73BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* const,T)
74BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* volatile,T)
75BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* const volatile,T)
76
77#endif
78
79} // namespace boost
80
81#include <boost/type_traits/detail/type_trait_undef.hpp>
82
83#endif // BOOST_TT_REMOVE_POINTER_HPP_INCLUDED
84