boost_detail_sp_typeinfo.patch 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. From b77c0af6af8bc4797defc3627878acc3cf7a6f39 Mon Sep 17 00:00:00 2001
  2. From: Antony Polukhin <antoshkka@gmail.com>
  3. Date: Thu, 20 Feb 2014 17:57:24 +0400
  4. Subject: [PATCH] detail/sp_typeinfo.hpp now uses TypeIndex
  5. ---
  6. include/boost/detail/sp_typeinfo.hpp | 123 +++--------------------------------
  7. 1 file changed, 8 insertions(+), 115 deletions(-)
  8. diff --git a/include/boost/detail/sp_typeinfo.hpp b/include/boost/detail/sp_typeinfo.hpp
  9. index 43fae78..fbdf86d 100644
  10. --- a/include/boost/detail/sp_typeinfo.hpp
  11. +++ b/include/boost/detail/sp_typeinfo.hpp
  12. @@ -10,126 +10,19 @@
  13. // detail/sp_typeinfo.hpp
  14. //
  15. // Copyright 2007 Peter Dimov
  16. +// Copyright 2014 Antony Polukhin
  17. //
  18. // Distributed under the Boost Software License, Version 1.0.
  19. // See accompanying file LICENSE_1_0.txt or copy at
  20. // http://www.boost.org/LICENSE_1_0.txt)
  21. -#include <boost/config.hpp>
  22. +#include <boost/type_index.hpp>
  23. +namespace boost { namespace detail {
  24. +
  25. +typedef boost::typeind::type_info sp_typeinfo;
  26. +
  27. +}} // namespace boost::detail
  28. -#if defined( BOOST_NO_TYPEID )
  29. -
  30. -#include <boost/current_function.hpp>
  31. -#include <functional>
  32. -
  33. -namespace boost
  34. -{
  35. -
  36. -namespace detail
  37. -{
  38. -
  39. -class sp_typeinfo
  40. -{
  41. -private:
  42. -
  43. - sp_typeinfo( sp_typeinfo const& );
  44. - sp_typeinfo& operator=( sp_typeinfo const& );
  45. -
  46. - char const * name_;
  47. -
  48. -public:
  49. -
  50. - explicit sp_typeinfo( char const * name ): name_( name )
  51. - {
  52. - }
  53. -
  54. - bool operator==( sp_typeinfo const& rhs ) const
  55. - {
  56. - return this == &rhs;
  57. - }
  58. -
  59. - bool operator!=( sp_typeinfo const& rhs ) const
  60. - {
  61. - return this != &rhs;
  62. - }
  63. -
  64. - bool before( sp_typeinfo const& rhs ) const
  65. - {
  66. - return std::less< sp_typeinfo const* >()( this, &rhs );
  67. - }
  68. -
  69. - char const* name() const
  70. - {
  71. - return name_;
  72. - }
  73. -};
  74. -
  75. -template<class T> struct sp_typeid_
  76. -{
  77. - static sp_typeinfo ti_;
  78. -
  79. - static char const * name()
  80. - {
  81. - return BOOST_CURRENT_FUNCTION;
  82. - }
  83. -};
  84. -
  85. -#if defined(__SUNPRO_CC)
  86. -// see #4199, the Sun Studio compiler gets confused about static initialization
  87. -// constructor arguments. But an assignment works just fine.
  88. -template<class T> sp_typeinfo sp_typeid_< T >::ti_ = sp_typeid_< T >::name();
  89. -#else
  90. -template<class T> sp_typeinfo sp_typeid_< T >::ti_(sp_typeid_< T >::name());
  91. -#endif
  92. -
  93. -template<class T> struct sp_typeid_< T & >: sp_typeid_< T >
  94. -{
  95. -};
  96. -
  97. -template<class T> struct sp_typeid_< T const >: sp_typeid_< T >
  98. -{
  99. -};
  100. -
  101. -template<class T> struct sp_typeid_< T volatile >: sp_typeid_< T >
  102. -{
  103. -};
  104. -
  105. -template<class T> struct sp_typeid_< T const volatile >: sp_typeid_< T >
  106. -{
  107. -};
  108. -
  109. -} // namespace detail
  110. -
  111. -} // namespace boost
  112. -
  113. -#define BOOST_SP_TYPEID(T) (boost::detail::sp_typeid_<T>::ti_)
  114. -
  115. -#else
  116. -
  117. -#include <typeinfo>
  118. -
  119. -namespace boost
  120. -{
  121. -
  122. -namespace detail
  123. -{
  124. -
  125. -#if defined( BOOST_NO_STD_TYPEINFO )
  126. -
  127. -typedef ::type_info sp_typeinfo;
  128. -
  129. -#else
  130. -
  131. -typedef std::type_info sp_typeinfo;
  132. -
  133. -#endif
  134. -
  135. -} // namespace detail
  136. -
  137. -} // namespace boost
  138. -
  139. -#define BOOST_SP_TYPEID(T) typeid(T)
  140. -
  141. -#endif
  142. +#define BOOST_SP_TYPEID(T) (boost::typeind::type_id<T>().type_info())
  143. #endif // #ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
  144. --
  145. 1.8.5.3