mirror of
https://github.com/boostorg/type_index.git
synced 2025-07-29 20:07:18 +02:00
Added sp_typeinfo patch
This commit is contained in:
1
patched/detail/README.md
Normal file
1
patched/detail/README.md
Normal file
@ -0,0 +1 @@
|
||||
To be honest sp_typeinfo.hpp won't be required with Boost.TypeIndex, because Boost.TypeIndex is more functional then sp_typeinfo and requires much less macro for usage. sp_typeinfo.patch contains a temporary solution for easy migration. Later sp_typeinfo may be removed and BOOST_SP_TYPEID(T) macro deprecated.
|
132
patched/detail/sp_typeinfo.patch
Normal file
132
patched/detail/sp_typeinfo.patch
Normal file
@ -0,0 +1,132 @@
|
||||
Index: .
|
||||
===================================================================
|
||||
--- . (revision 86532)
|
||||
+++ . (working copy)
|
||||
@@ -15,121 +15,15 @@
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
-#include <boost/config.hpp>
|
||||
+#include <boost/type_index/type_info.hpp>
|
||||
|
||||
-#if defined( BOOST_NO_TYPEID )
|
||||
+namespace boost { namespace detail {
|
||||
|
||||
-#include <boost/current_function.hpp>
|
||||
-#include <functional>
|
||||
+typedef boost::type_info sp_typeinfo;
|
||||
|
||||
-namespace boost
|
||||
-{
|
||||
+}} // namespace boost::detail
|
||||
|
||||
-namespace detail
|
||||
-{
|
||||
+#define BOOST_SP_TYPEID(T) (boost::type_id<T>())
|
||||
|
||||
-class sp_typeinfo
|
||||
-{
|
||||
-private:
|
||||
-
|
||||
- sp_typeinfo( sp_typeinfo const& );
|
||||
- sp_typeinfo& operator=( sp_typeinfo const& );
|
||||
-
|
||||
- char const * name_;
|
||||
-
|
||||
-public:
|
||||
-
|
||||
- explicit sp_typeinfo( char const * name ): name_( name )
|
||||
- {
|
||||
- }
|
||||
-
|
||||
- bool operator==( sp_typeinfo const& rhs ) const
|
||||
- {
|
||||
- return this == &rhs;
|
||||
- }
|
||||
-
|
||||
- bool operator!=( sp_typeinfo const& rhs ) const
|
||||
- {
|
||||
- return this != &rhs;
|
||||
- }
|
||||
-
|
||||
- bool before( sp_typeinfo const& rhs ) const
|
||||
- {
|
||||
- return std::less< sp_typeinfo const* >()( this, &rhs );
|
||||
- }
|
||||
-
|
||||
- char const* name() const
|
||||
- {
|
||||
- return name_;
|
||||
- }
|
||||
-};
|
||||
-
|
||||
-template<class T> struct sp_typeid_
|
||||
-{
|
||||
- static sp_typeinfo ti_;
|
||||
-
|
||||
- static char const * name()
|
||||
- {
|
||||
- return BOOST_CURRENT_FUNCTION;
|
||||
- }
|
||||
-};
|
||||
-
|
||||
-#if defined(__SUNPRO_CC)
|
||||
-// see #4199, the Sun Studio compiler gets confused about static initialization
|
||||
-// constructor arguments. But an assignment works just fine.
|
||||
-template<class T> sp_typeinfo sp_typeid_< T >::ti_ = sp_typeid_< T >::name();
|
||||
-#else
|
||||
-template<class T> sp_typeinfo sp_typeid_< T >::ti_(sp_typeid_< T >::name());
|
||||
-#endif
|
||||
-
|
||||
-template<class T> struct sp_typeid_< T & >: sp_typeid_< T >
|
||||
-{
|
||||
-};
|
||||
-
|
||||
-template<class T> struct sp_typeid_< T const >: sp_typeid_< T >
|
||||
-{
|
||||
-};
|
||||
-
|
||||
-template<class T> struct sp_typeid_< T volatile >: sp_typeid_< T >
|
||||
-{
|
||||
-};
|
||||
-
|
||||
-template<class T> struct sp_typeid_< T const volatile >: sp_typeid_< T >
|
||||
-{
|
||||
-};
|
||||
-
|
||||
-} // namespace detail
|
||||
-
|
||||
-} // namespace boost
|
||||
-
|
||||
-#define BOOST_SP_TYPEID(T) (boost::detail::sp_typeid_<T>::ti_)
|
||||
-
|
||||
-#else
|
||||
-
|
||||
-#include <typeinfo>
|
||||
-
|
||||
-namespace boost
|
||||
-{
|
||||
-
|
||||
-namespace detail
|
||||
-{
|
||||
-
|
||||
-#if defined( BOOST_NO_STD_TYPEINFO )
|
||||
-
|
||||
-typedef ::type_info sp_typeinfo;
|
||||
-
|
||||
-#else
|
||||
-
|
||||
-typedef std::type_info sp_typeinfo;
|
||||
-
|
||||
-#endif
|
||||
-
|
||||
-} // namespace detail
|
||||
-
|
||||
-} // namespace boost
|
||||
-
|
||||
-#define BOOST_SP_TYPEID(T) typeid(T)
|
||||
-
|
||||
-#endif
|
||||
-
|
||||
#endif // #ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
|
||||
+
|
Reference in New Issue
Block a user