1 #ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
2 #define BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
4 // MS compatible compilers support #pragma once
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
10 // detail/sp_typeinfo.hpp
12 // Copyright 2007 Peter Dimov
14 // Distributed under the Boost Software License, Version 1.0.
15 // See accompanying file LICENSE_1_0.txt or copy at
16 // http://www.boost.org/LICENSE_1_0.txt)
18 #include <boost/config.hpp>
20 #if defined( BOOST_NO_TYPEID )
22 #include <boost/current_function.hpp>
35 sp_typeinfo( sp_typeinfo const& );
36 sp_typeinfo& operator=( sp_typeinfo const& );
42 explicit sp_typeinfo( char const * name ): name_( name )
46 bool operator==( sp_typeinfo const& rhs ) const
51 bool operator!=( sp_typeinfo const& rhs ) const
56 bool before( sp_typeinfo const& rhs ) const
58 return std::less< sp_typeinfo const* >()( this, &rhs );
61 char const* name() const
67 template<class T> struct sp_typeid_
69 static sp_typeinfo ti_;
71 static char const * name()
73 return BOOST_CURRENT_FUNCTION;
77 template<class T> sp_typeinfo sp_typeid_< T >::ti_ = sp_typeid_< T >::name();
79 template<class T> struct sp_typeid_< T & >: sp_typeid_< T >
83 template<class T> struct sp_typeid_< T const >: sp_typeid_< T >
87 template<class T> struct sp_typeid_< T volatile >: sp_typeid_< T >
91 template<class T> struct sp_typeid_< T const volatile >: sp_typeid_< T >
99 #define BOOST_SP_TYPEID(T) (boost::detail::sp_typeid_<T>::ti_)
111 #if defined( BOOST_NO_STD_TYPEINFO )
113 typedef ::type_info sp_typeinfo;
117 typedef std::type_info sp_typeinfo;
121 } // namespace detail
125 #define BOOST_SP_TYPEID(T) typeid(T)
129 #endif // #ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED