Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:38

0001 // Copyright David Abrahams 2002.
0002 // Distributed under the Boost Software License, Version 1.0. (See
0003 // accompanying file LICENSE_1_0.txt or copy at
0004 // http://www.boost.org/LICENSE_1_0.txt)
0005 #ifndef MSVC_TYPEINFO_DWA200222_HPP
0006 # define MSVC_TYPEINFO_DWA200222_HPP
0007 
0008 #include <typeinfo>
0009 #include <boost/type.hpp>
0010 
0011 //
0012 // Fix for icc's broken typeid() implementation which doesn't strip
0013 // decoration. This fix doesn't handle cv-qualified array types. It
0014 // could probably be done, but I haven't figured it out yet.
0015 //
0016 
0017 // Note: This file is badly named. It initially was MSVC specific, but was
0018 // extended to cover intel too. Now the old version of MSVC is no longer
0019 // supported, but the intel version is still supported.
0020 
0021 # if defined(BOOST_INTEL_CXX_VERSION) && BOOST_INTEL_CXX_VERSION <= 700
0022 
0023 namespace boost { namespace python { namespace detail { 
0024 
0025 typedef std::type_info const& typeinfo;
0026 
0027 template <class T>
0028 static typeinfo typeid_nonref(T const volatile*) { return typeid(T); }
0029 
0030 template <class T>
0031 inline typeinfo typeid_ref_1(T&(*)())
0032 {
0033     return detail::typeid_nonref((T*)0);
0034 }
0035 
0036 // A non-reference
0037 template <class T>
0038 inline typeinfo typeid_ref(type<T>*, T&(*)(type<T>))
0039 {
0040     return detail::typeid_nonref((T*)0);
0041 }
0042 
0043 // A reference
0044 template <class T>
0045 inline typeinfo typeid_ref(type<T>*, ...)
0046 {
0047     return detail::typeid_ref_1((T(*)())0);
0048 }
0049 
0050 #if defined(BOOST_MSVC) || (defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32))
0051 #   define BOOST_PYTT_DECL __cdecl
0052 #else
0053 #   define BOOST_PYTT_DECL /**/
0054 #endif
0055 
0056 template< typename T > T&(* is_ref_tester1(type<T>) )(type<T>) { return 0; }
0057 inline char BOOST_PYTT_DECL is_ref_tester1(...) { return 0; }
0058 
0059 template <class T>
0060 inline typeinfo msvc_typeid(boost::type<T>*)
0061 {
0062     return detail::typeid_ref(
0063         (boost::type<T>*)0, detail::is_ref_tester1(type<T>())
0064         );
0065 }
0066 
0067 template <>
0068 inline typeinfo msvc_typeid<void>(boost::type<void>*)
0069 {
0070     return typeid(void);
0071 }
0072 
0073 #  ifndef NDEBUG
0074 inline typeinfo assert_array_typeid_compiles()
0075 {
0076     return msvc_typeid((boost::type<char const[3]>*)0)
0077         , msvc_typeid((boost::type<char[3]>*)0);
0078 }
0079 #  endif
0080 
0081 }}} // namespace boost::python::detail
0082 
0083 # endif // BOOST_INTEL_CXX_VERSION
0084 #endif // MSVC_TYPEINFO_DWA200222_HPP