|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r50123 - trunk/boost
From: Alexander.Nasonov_at_[hidden]
Date: 2008-12-04 17:59:28
Author: nasonov
Date: 2008-12-04 17:59:27 EST (Thu, 04 Dec 2008)
New Revision: 50123
URL: http://svn.boost.org/trac/boost/changeset/50123
Log:
Fixes #1220: lexical_cast requires RTTI
Text files modified:
trunk/boost/lexical_cast.hpp | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
Modified: trunk/boost/lexical_cast.hpp
==============================================================================
--- trunk/boost/lexical_cast.hpp (original)
+++ trunk/boost/lexical_cast.hpp 2008-12-04 17:59:27 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