Boost logo

Boost-Commit :

From: chris_at_[hidden]
Date: 2008-04-20 21:23:42


Author: chris_kohlhoff
Date: 2008-04-20 21:23:42 EDT (Sun, 20 Apr 2008)
New Revision: 44662
URL: http://svn.boost.org/trac/boost/changeset/44662

Log:
Add ability to disable the uses of the typeid operator by defining
BOOST_NO_TYPEID or BOOST_ASIO_NO_TYPEID.

Text files modified:
   trunk/boost/asio/detail/service_registry.hpp | 10 ++++++++++
   trunk/libs/asio/doc/using.qbk | 7 +++++++
   2 files changed, 17 insertions(+), 0 deletions(-)

Modified: trunk/boost/asio/detail/service_registry.hpp
==============================================================================
--- trunk/boost/asio/detail/service_registry.hpp (original)
+++ trunk/boost/asio/detail/service_registry.hpp 2008-04-20 21:23:42 EDT (Sun, 20 Apr 2008)
@@ -27,6 +27,12 @@
 #include <boost/asio/detail/noncopyable.hpp>
 #include <boost/asio/detail/service_id.hpp>
 
+#if defined(BOOST_NO_TYPEID)
+# if !defined(BOOST_ASIO_NO_TYPEID)
+# define BOOST_ASIO_NO_TYPEID
+# endif // !defined(BOOST_ASIO_NO_TYPEID)
+#endif // defined(BOOST_NO_TYPEID)
+
 namespace boost {
 namespace asio {
 namespace detail {
@@ -157,6 +163,7 @@
     service.id_ = &id;
   }
 
+#if !defined(BOOST_ASIO_NO_TYPEID)
   // Set a service's id.
   template <typename Service>
   void init_service_id(boost::asio::io_service::service& service,
@@ -165,6 +172,7 @@
     service.type_info_ = &typeid(Service);
     service.id_ = 0;
   }
+#endif // !defined(BOOST_ASIO_NO_TYPEID)
 
   // Check if a service matches the given id.
   static bool service_id_matches(
@@ -174,6 +182,7 @@
     return service.id_ == &id;
   }
 
+#if !defined(BOOST_ASIO_NO_TYPEID)
   // Check if a service matches the given id.
   template <typename Service>
   static bool service_id_matches(
@@ -182,6 +191,7 @@
   {
     return service.type_info_ != 0 && *service.type_info_ == typeid(Service);
   }
+#endif // !defined(BOOST_ASIO_NO_TYPEID)
 
   // Mutex to protect access to internal data.
   mutable boost::asio::detail::mutex mutex_;

Modified: trunk/libs/asio/doc/using.qbk
==============================================================================
--- trunk/libs/asio/doc/using.qbk (original)
+++ trunk/libs/asio/doc/using.qbk 2008-04-20 21:23:42 EDT (Sun, 20 Apr 2008)
@@ -255,6 +255,13 @@
         cancel the outstanding operations and close the socket.
     ]
   ]
+ [
+ [`BOOST_ASIO_NO_TYPEID`]
+ [
+ Disables uses of the `typeid` operator in Boost.Asio. Defined
+ automatically if `BOOST_NO_TYPEID` is defined.
+ ]
+ ]
 ]
 
 [endsect]


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