Quiet down some irrelevant warnings in MSVC2008, make dynamic_cast conversions work in msvc across modules by applying a kludge that will probably not work long term, but does work now. This may mean that chaiscript needs to move to being a library?
This commit is contained in:
@@ -36,6 +36,14 @@ namespace chaiscript
|
|||||||
try {
|
try {
|
||||||
return detail::Cast_Helper<Type>::cast(bv);
|
return detail::Cast_Helper<Type>::cast(bv);
|
||||||
} catch (const boost::bad_any_cast &) {
|
} catch (const boost::bad_any_cast &) {
|
||||||
|
|
||||||
|
#ifdef BOOST_MSVC
|
||||||
|
//Thank you MSVC, yes we know that a constant value is being used in the if
|
||||||
|
// statment in THIS VERSION of the template instantiation
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4127)
|
||||||
|
#endif
|
||||||
|
|
||||||
if (boost::is_polymorphic<typename Stripped_Type<Type>::type>::value)
|
if (boost::is_polymorphic<typename Stripped_Type<Type>::type>::value)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -50,6 +58,12 @@ namespace chaiscript
|
|||||||
// attempted dynamic_cast
|
// attempted dynamic_cast
|
||||||
throw bad_boxed_cast(bv.get_type_info(), typeid(Type));
|
throw bad_boxed_cast(bv.get_type_info(), typeid(Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BOOST_MSVC
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -120,7 +120,7 @@ namespace chaiscript
|
|||||||
class Dynamic_Conversions
|
class Dynamic_Conversions
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static Dynamic_Conversions &get()
|
static inline Dynamic_Conversions &get()
|
||||||
{
|
{
|
||||||
static Dynamic_Conversions obj;
|
static Dynamic_Conversions obj;
|
||||||
return obj;
|
return obj;
|
||||||
@@ -129,8 +129,15 @@ namespace chaiscript
|
|||||||
template<typename Base, typename Derived>
|
template<typename Base, typename Derived>
|
||||||
static boost::shared_ptr<Dynamic_Conversion> create()
|
static boost::shared_ptr<Dynamic_Conversion> create()
|
||||||
{
|
{
|
||||||
return boost::shared_ptr<Dynamic_Conversion>(new Dynamic_Conversion_Impl<Base, Derived>());
|
boost::shared_ptr<Dynamic_Conversion> conversion(new Dynamic_Conversion_Impl<Base, Derived>());
|
||||||
|
|
||||||
|
/// \todo this is a hack and a kludge. The idea is to make sure that
|
||||||
|
/// the conversion is registered both in the module's notion of the static conversion object
|
||||||
|
/// and in the global notion of the static conversion object
|
||||||
|
/// someday this will almost certainly have to change. Maybe it is time for ChaiScript
|
||||||
|
/// to become a library?
|
||||||
|
Dynamic_Conversions::get().add_conversion(conversion);
|
||||||
|
return conversion;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename InItr>
|
template<typename InItr>
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
namespace chaiscript
|
namespace chaiscript
|
||||||
{
|
{
|
||||||
class Boxed_POD_Value;
|
struct Boxed_POD_Value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper for building a list of parameters for calling a Proxy_Function
|
* Helper for building a list of parameters for calling a Proxy_Function
|
||||||
|
Reference in New Issue
Block a user