1 // Copyright David Abrahams 2002.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef POINTER_TYPE_ID_DWA2002222_HPP
6 # define POINTER_TYPE_ID_DWA2002222_HPP
8 # include <boost/python/type_id.hpp>
9 # include <boost/type_traits/composite_traits.hpp>
11 namespace boost { namespace python { namespace converter {
15 template <bool is_ref = false>
16 struct pointer_typeid_select
19 static inline type_info execute(T*(*)() = 0)
26 struct pointer_typeid_select<true>
29 static inline type_info execute(T* const volatile&(*)() = 0)
35 static inline type_info execute(T*volatile&(*)() = 0)
41 static inline type_info execute(T*const&(*)() = 0)
47 static inline type_info execute(T*&(*)() = 0)
54 // Usage: pointer_type_id<T>()
56 // Returns a type_info associated with the type pointed
57 // to by T, which may be a pointer or a reference to a pointer.
59 type_info pointer_type_id(T(*)() = 0)
61 return detail::pointer_typeid_select<
62 is_reference<T>::value
63 >::execute((T(*)())0);
66 }}} // namespace boost::python::converter
68 #endif // POINTER_TYPE_ID_DWA2002222_HPP