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).
7 // See http://www.boost.org/libs/type_traits for most recent version including documentation.
9 #ifndef BOOST_TT_REMOVE_POINTER_HPP_INCLUDED
10 #define BOOST_TT_REMOVE_POINTER_HPP_INCLUDED
12 #include <boost/config.hpp>
14 #if defined(BOOST_MSVC)
15 #include <boost/type_traits/remove_cv.hpp>
16 #include <boost/type_traits/is_pointer.hpp>
21 #if BOOST_WORKAROUND(BOOST_MSVC, < 1900)
26 // We need all this crazy indirection because a type such as:
30 // Does not bind to a <T*> or <T*const> partial specialization with VC10 and earlier
33 struct remove_pointer_imp
39 struct remove_pointer_imp<T*>
44 template <class T, bool b>
45 struct remove_pointer_imp3
47 typedef typename remove_pointer_imp<typename boost::remove_cv<T>::type>::type type;
51 struct remove_pointer_imp3<T, false>
57 struct remove_pointer_imp2
59 typedef typename remove_pointer_imp3<T, ::boost::is_pointer<T>::value>::type type;
63 template <class T> struct remove_pointer{ typedef typename boost::detail::remove_pointer_imp2<T>::type type; };
67 template <class T> struct remove_pointer{ typedef T type; };
68 template <class T> struct remove_pointer<T*>{ typedef T type; };
69 template <class T> struct remove_pointer<T*const>{ typedef T type; };
70 template <class T> struct remove_pointer<T*volatile>{ typedef T type; };
71 template <class T> struct remove_pointer<T*const volatile>{ typedef T type; };
75 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
77 template <class T> using remove_pointer_t = typename remove_pointer<T>::type;
83 #endif // BOOST_TT_REMOVE_POINTER_HPP_INCLUDED