forked from boostorg/conversion
@@ -60,15 +60,21 @@ namespace boost
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bad_lexical_cast() :
|
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(
|
bad_lexical_cast(
|
||||||
const std::type_info &source_type_arg,
|
const std::type_info &source_type_arg,
|
||||||
const std::type_info &target_type_arg) :
|
const std::type_info &target_type_arg) :
|
||||||
source(&source_type_arg), target(&target_type_arg)
|
source(&source_type_arg), target(&target_type_arg)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::type_info &source_type() const
|
const std::type_info &source_type() const
|
||||||
{
|
{
|
||||||
return *source;
|
return *source;
|
||||||
@@ -77,6 +83,7 @@ namespace boost
|
|||||||
{
|
{
|
||||||
return *target;
|
return *target;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const char *what() const throw()
|
virtual const char *what() const throw()
|
||||||
{
|
{
|
||||||
return "bad lexical cast: "
|
return "bad lexical cast: "
|
||||||
@@ -1144,7 +1151,11 @@ namespace boost
|
|||||||
if (interpreter >> result)
|
if (interpreter >> result)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#ifndef BOOST_NO_TYPEID
|
||||||
throw_exception(bad_lexical_cast(typeid(Source), typeid(Target)));
|
throw_exception(bad_lexical_cast(typeid(Source), typeid(Target)));
|
||||||
|
#else
|
||||||
|
throw_exception(bad_lexical_cast());
|
||||||
|
#endif
|
||||||
return Target(); // normally never reached (throw_exception)
|
return Target(); // normally never reached (throw_exception)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1183,7 +1194,11 @@ namespace boost
|
|||||||
Target result;
|
Target result;
|
||||||
|
|
||||||
if(!(interpreter << arg && interpreter >> result))
|
if(!(interpreter << arg && interpreter >> result))
|
||||||
|
#ifndef BOOST_NO_TYPEID
|
||||||
throw_exception(bad_lexical_cast(typeid(Source), typeid(Target)));
|
throw_exception(bad_lexical_cast(typeid(Source), typeid(Target)));
|
||||||
|
#else
|
||||||
|
throw_exception(bad_lexical_cast());
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user