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 MSVC_TYPEINFO_DWA200222_HPP
6 # define MSVC_TYPEINFO_DWA200222_HPP
9 #include <boost/type.hpp>
12 // Fix for icc's broken typeid() implementation which doesn't strip
13 // decoration. This fix doesn't handle cv-qualified array types. It
14 // could probably be done, but I haven't figured it out yet.
17 // Note: This file is badly named. It initially was MSVC specific, but was
18 // extended to cover intel too. Now the old version of MSVC is no longer
19 // supported, but the intel version is still supported.
21 # if defined(BOOST_INTEL_CXX_VERSION) && BOOST_INTEL_CXX_VERSION <= 700
23 namespace boost { namespace python { namespace detail {
25 typedef std::type_info const& typeinfo;
28 static typeinfo typeid_nonref(T const volatile*) { return typeid(T); }
31 inline typeinfo typeid_ref_1(T&(*)())
33 return detail::typeid_nonref((T*)0);
38 inline typeinfo typeid_ref(type<T>*, T&(*)(type<T>))
40 return detail::typeid_nonref((T*)0);
45 inline typeinfo typeid_ref(type<T>*, ...)
47 return detail::typeid_ref_1((T(*)())0);
50 #if defined(BOOST_MSVC) || (defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32))
51 # define BOOST_PYTT_DECL __cdecl
53 # define BOOST_PYTT_DECL /**/
56 template< typename T > T&(* is_ref_tester1(type<T>) )(type<T>) { return 0; }
57 inline char BOOST_PYTT_DECL is_ref_tester1(...) { return 0; }
60 inline typeinfo msvc_typeid(boost::type<T>*)
62 return detail::typeid_ref(
63 (boost::type<T>*)0, detail::is_ref_tester1(type<T>())
68 inline typeinfo msvc_typeid<void>(boost::type<void>*)
74 inline typeinfo assert_array_typeid_compiles()
76 return msvc_typeid((boost::type<char const[3]>*)0)
77 , msvc_typeid((boost::type<char[3]>*)0);
81 }}} // namespace boost::python::detail
83 # endif // BOOST_INTEL_CXX_VERSION
84 #endif // MSVC_TYPEINFO_DWA200222_HPP