Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50124 - branches/release/boost
From: Alexander.Nasonov_at_[hidden]
Date: 2008-12-04 18:18:51


Author: nasonov
Date: 2008-12-04 18:18:50 EST (Thu, 04 Dec 2008)
New Revision: 50124
URL: http://svn.boost.org/trac/boost/changeset/50124

Log:
Fixes #1220: lexical_cast requires RTTI
Text files modified:
   branches/release/boost/lexical_cast.hpp | 17 ++++++++++++++++-
   1 files changed, 16 insertions(+), 1 deletions(-)

Modified: branches/release/boost/lexical_cast.hpp
==============================================================================
--- branches/release/boost/lexical_cast.hpp (original)
+++ branches/release/boost/lexical_cast.hpp 2008-12-04 18:18:50 EST (Thu, 04 Dec 2008)
@@ -60,15 +60,21 @@
     {
     public:
         bad_lexical_cast() :
- source(&typeid(void)), target(&typeid(void))
+#ifndef BOOST_NO_TYPEID
+ source(&typeid(void)), target(&typeid(void))
+#else
+ source(0), target(0) // this breaks getters
+#endif
         {
         }
+
         bad_lexical_cast(
             const std::type_info &source_type_arg,
             const std::type_info &target_type_arg) :
             source(&source_type_arg), target(&target_type_arg)
         {
         }
+
         const std::type_info &source_type() const
         {
             return *source;
@@ -77,6 +83,7 @@
         {
             return *target;
         }
+
         virtual const char *what() const throw()
         {
             return "bad lexical cast: "
@@ -1144,7 +1151,11 @@
                 if (interpreter >> result)
                     return result;
             }
+#ifndef BOOST_NO_TYPEID
             throw_exception(bad_lexical_cast(typeid(Source), typeid(Target)));
+#else
+ throw_exception(bad_lexical_cast());
+#endif
             return Target(); // normally never reached (throw_exception)
         }
     }
@@ -1183,7 +1194,11 @@
         Target result;
 
         if(!(interpreter << arg && interpreter >> result))
+#ifndef BOOST_NO_TYPEID
             throw_exception(bad_lexical_cast(typeid(Source), typeid(Target)));
+#else
+ throw_exception(bad_lexical_cast());
+#endif
         return result;
     }
 


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