Boost logo

Boost-Commit :

From: pdimov_at_[hidden]
Date: 2007-08-26 16:34:42


Author: pdimov
Date: 2007-08-26 16:34:40 EDT (Sun, 26 Aug 2007)
New Revision: 38976
URL: http://svn.boost.org/trac/boost/changeset/38976

Log:
BOOST_NO_TYPEID support (#1108).
Added:
   trunk/boost/detail/sp_typeinfo.hpp (contents, props changed)
Text files modified:
   trunk/boost/detail/shared_count.hpp | 3 +--
   trunk/boost/detail/sp_counted_base_cw_ppc.hpp | 4 ++--
   trunk/boost/detail/sp_counted_base_cw_x86.hpp | 4 ++--
   trunk/boost/detail/sp_counted_base_gcc_ia64.hpp | 4 ++--
   trunk/boost/detail/sp_counted_base_gcc_ppc.hpp | 4 ++--
   trunk/boost/detail/sp_counted_base_gcc_sparc.hpp | 4 ++--
   trunk/boost/detail/sp_counted_base_gcc_x86.hpp | 4 ++--
   trunk/boost/detail/sp_counted_base_nt.hpp | 4 ++--
   trunk/boost/detail/sp_counted_base_pt.hpp | 4 ++--
   trunk/boost/detail/sp_counted_base_solaris.hpp | 4 ++--
   trunk/boost/detail/sp_counted_base_sync.hpp | 4 ++--
   trunk/boost/detail/sp_counted_base_w32.hpp | 4 ++--
   trunk/boost/detail/sp_counted_impl.hpp | 11 +++++------
   13 files changed, 28 insertions(+), 30 deletions(-)

Modified: trunk/boost/detail/shared_count.hpp
==============================================================================
--- trunk/boost/detail/shared_count.hpp (original)
+++ trunk/boost/detail/shared_count.hpp 2007-08-26 16:34:40 EDT (Sun, 26 Aug 2007)
@@ -32,7 +32,6 @@
 #include <memory> // std::auto_ptr
 #include <functional> // std::less
 #include <new> // std::bad_alloc
-#include <typeinfo> // std::type_info in get_deleter
 
 namespace boost
 {
@@ -259,7 +258,7 @@
         return std::less<sp_counted_base *>()( a.pi_, b.pi_ );
     }
 
- void * get_deleter(std::type_info const & ti) const
+ void * get_deleter( sp_typeinfo const & ti ) const
     {
         return pi_? pi_->get_deleter( ti ): 0;
     }

Modified: trunk/boost/detail/sp_counted_base_cw_ppc.hpp
==============================================================================
--- trunk/boost/detail/sp_counted_base_cw_ppc.hpp (original)
+++ trunk/boost/detail/sp_counted_base_cw_ppc.hpp 2007-08-26 16:34:40 EDT (Sun, 26 Aug 2007)
@@ -24,7 +24,7 @@
 // formulation
 //
 
-#include <typeinfo>
+#include "sp_typeinfo.hpp"
 
 namespace boost
 {
@@ -123,7 +123,7 @@
         delete this;
     }
 
- virtual void * get_deleter( std::type_info const & ti ) = 0;
+ virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
 
     void add_ref_copy()
     {

Modified: trunk/boost/detail/sp_counted_base_cw_x86.hpp
==============================================================================
--- trunk/boost/detail/sp_counted_base_cw_x86.hpp (original)
+++ trunk/boost/detail/sp_counted_base_cw_x86.hpp 2007-08-26 16:34:40 EDT (Sun, 26 Aug 2007)
@@ -25,7 +25,7 @@
 // formulation
 //
 
-#include <typeinfo>
+#include "sp_typeinfo.hpp"
 
 namespace boost
 {
@@ -111,7 +111,7 @@
         delete this;
     }
 
- virtual void * get_deleter( std::type_info const & ti ) = 0;
+ virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
 
     void add_ref_copy()
     {

Modified: trunk/boost/detail/sp_counted_base_gcc_ia64.hpp
==============================================================================
--- trunk/boost/detail/sp_counted_base_gcc_ia64.hpp (original)
+++ trunk/boost/detail/sp_counted_base_gcc_ia64.hpp 2007-08-26 16:34:40 EDT (Sun, 26 Aug 2007)
@@ -16,7 +16,7 @@
 // Lock-free algorithm by Alexander Terekhov
 //
 
-#include <typeinfo>
+#include "sp_typeinfo.hpp"
 
 namespace boost
 {
@@ -110,7 +110,7 @@
         delete this;
     }
 
- virtual void * get_deleter( std::type_info const & ti ) = 0;
+ virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
 
     void add_ref_copy()
     {

Modified: trunk/boost/detail/sp_counted_base_gcc_ppc.hpp
==============================================================================
--- trunk/boost/detail/sp_counted_base_gcc_ppc.hpp (original)
+++ trunk/boost/detail/sp_counted_base_gcc_ppc.hpp 2007-08-26 16:34:40 EDT (Sun, 26 Aug 2007)
@@ -24,7 +24,7 @@
 // formulation
 //
 
-#include <typeinfo>
+#include "sp_typeinfo.hpp"
 
 namespace boost
 {
@@ -134,7 +134,7 @@
         delete this;
     }
 
- virtual void * get_deleter( std::type_info const & ti ) = 0;
+ virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
 
     void add_ref_copy()
     {

Modified: trunk/boost/detail/sp_counted_base_gcc_sparc.hpp
==============================================================================
--- trunk/boost/detail/sp_counted_base_gcc_sparc.hpp (original)
+++ trunk/boost/detail/sp_counted_base_gcc_sparc.hpp 2007-08-26 16:34:40 EDT (Sun, 26 Aug 2007)
@@ -19,7 +19,7 @@
 //
 // Thanks to Michael van der Westhuizen
 
-#include <typeinfo>
+#include "sp_typeinfo.hpp"
 #include <inttypes.h> // int32_t
 
 namespace boost
@@ -119,7 +119,7 @@
         delete this;
     }
 
- virtual void * get_deleter( std::type_info const & ti ) = 0;
+ virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
 
     void add_ref_copy()
     {

Modified: trunk/boost/detail/sp_counted_base_gcc_x86.hpp
==============================================================================
--- trunk/boost/detail/sp_counted_base_gcc_x86.hpp (original)
+++ trunk/boost/detail/sp_counted_base_gcc_x86.hpp 2007-08-26 16:34:40 EDT (Sun, 26 Aug 2007)
@@ -24,7 +24,7 @@
 // formulation
 //
 
-#include <typeinfo>
+#include "sp_typeinfo.hpp"
 
 namespace boost
 {
@@ -126,7 +126,7 @@
         delete this;
     }
 
- virtual void * get_deleter( std::type_info const & ti ) = 0;
+ virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
 
     void add_ref_copy()
     {

Modified: trunk/boost/detail/sp_counted_base_nt.hpp
==============================================================================
--- trunk/boost/detail/sp_counted_base_nt.hpp (original)
+++ trunk/boost/detail/sp_counted_base_nt.hpp 2007-08-26 16:34:40 EDT (Sun, 26 Aug 2007)
@@ -18,7 +18,7 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 //
 
-#include <typeinfo>
+#include "sp_typeinfo.hpp"
 
 namespace boost
 {
@@ -58,7 +58,7 @@
         delete this;
     }
 
- virtual void * get_deleter( std::type_info const & ti ) = 0;
+ virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
 
     void add_ref_copy()
     {

Modified: trunk/boost/detail/sp_counted_base_pt.hpp
==============================================================================
--- trunk/boost/detail/sp_counted_base_pt.hpp (original)
+++ trunk/boost/detail/sp_counted_base_pt.hpp 2007-08-26 16:34:40 EDT (Sun, 26 Aug 2007)
@@ -18,7 +18,7 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 //
 
-#include <typeinfo>
+#include "sp_typeinfo.hpp"
 #include <pthread.h>
 
 namespace boost
@@ -69,7 +69,7 @@
         delete this;
     }
 
- virtual void * get_deleter( std::type_info const & ti ) = 0;
+ virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
 
     void add_ref_copy()
     {

Modified: trunk/boost/detail/sp_counted_base_solaris.hpp
==============================================================================
--- trunk/boost/detail/sp_counted_base_solaris.hpp (original)
+++ trunk/boost/detail/sp_counted_base_solaris.hpp 2007-08-26 16:34:40 EDT (Sun, 26 Aug 2007)
@@ -20,7 +20,7 @@
 // formulation
 //
 
-#include <typeinfo>
+#include "sp_typeinfo.hpp"
 #include <atomic.h>
 
 namespace boost
@@ -61,7 +61,7 @@
         delete this;
     }
 
- virtual void * get_deleter( std::type_info const & ti ) = 0;
+ virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
 
     void add_ref_copy()
     {

Modified: trunk/boost/detail/sp_counted_base_sync.hpp
==============================================================================
--- trunk/boost/detail/sp_counted_base_sync.hpp (original)
+++ trunk/boost/detail/sp_counted_base_sync.hpp 2007-08-26 16:34:40 EDT (Sun, 26 Aug 2007)
@@ -15,7 +15,7 @@
 // See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt
 
-#include <typeinfo>
+#include "sp_typeinfo.hpp"
 #include <limits.h>
 
 namespace boost
@@ -104,7 +104,7 @@
         delete this;
     }
 
- virtual void * get_deleter( std::type_info const & ti ) = 0;
+ virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
 
     void add_ref_copy()
     {

Modified: trunk/boost/detail/sp_counted_base_w32.hpp
==============================================================================
--- trunk/boost/detail/sp_counted_base_w32.hpp (original)
+++ trunk/boost/detail/sp_counted_base_w32.hpp 2007-08-26 16:34:40 EDT (Sun, 26 Aug 2007)
@@ -26,7 +26,7 @@
 
 #include <boost/detail/interlocked.hpp>
 #include <boost/detail/workaround.hpp>
-#include <typeinfo>
+#include "sp_typeinfo.hpp"
 
 namespace boost
 {
@@ -66,7 +66,7 @@
         delete this;
     }
 
- virtual void * get_deleter( std::type_info const & ti ) = 0;
+ virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
 
     void add_ref_copy()
     {

Modified: trunk/boost/detail/sp_counted_impl.hpp
==============================================================================
--- trunk/boost/detail/sp_counted_impl.hpp (original)
+++ trunk/boost/detail/sp_counted_impl.hpp 2007-08-26 16:34:40 EDT (Sun, 26 Aug 2007)
@@ -35,7 +35,6 @@
 #include <memory> // std::allocator
 #endif
 
-#include <typeinfo> // std::type_info in get_deleter
 #include <cstddef> // std::size_t
 
 namespace boost
@@ -79,7 +78,7 @@
         boost::checked_delete( px_ );
     }
 
- virtual void * get_deleter( std::type_info const & )
+ virtual void * get_deleter( detail::sp_typeinfo const & )
     {
         return 0;
     }
@@ -145,9 +144,9 @@
         del( ptr );
     }
 
- virtual void * get_deleter( std::type_info const & ti )
+ virtual void * get_deleter( detail::sp_typeinfo const & ti )
     {
- return ti == typeid(D)? &reinterpret_cast<char&>( del ): 0;
+ return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast<char&>( del ): 0;
     }
 
 #if defined(BOOST_SP_USE_STD_ALLOCATOR)
@@ -215,9 +214,9 @@
         a2.deallocate( this, 1 );
     }
 
- virtual void * get_deleter( std::type_info const & ti )
+ virtual void * get_deleter( detail::sp_typeinfo const & ti )
     {
- return ti == typeid( D )? &reinterpret_cast<char&>( d_ ): 0;
+ return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast<char&>( d_ ): 0;
     }
 };
 

Added: trunk/boost/detail/sp_typeinfo.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/detail/sp_typeinfo.hpp 2007-08-26 16:34:40 EDT (Sun, 26 Aug 2007)
@@ -0,0 +1,83 @@
+#ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
+#define BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+// detail/sp_typeinfo.hpp
+//
+// Copyright 2007 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0.
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/config.hpp>
+
+#if defined( BOOST_NO_TYPEID )
+
+namespace boost
+{
+
+namespace detail
+{
+
+typedef void* sp_typeinfo;
+
+template<class T> struct sp_typeid_
+{
+ static char v_;
+};
+
+template<class T> char sp_typeid_< T >::v_;
+
+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>::v_)
+
+#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


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk