Eradicate global base_class registrations to prevent problems with threading and general memory management issues with knowing how and when to clean them up.

This commit is contained in:
Jason Turner
2013-02-25 11:00:14 -07:00
parent 1858885010
commit 2afc09dad4
16 changed files with 308 additions and 314 deletions

View File

@@ -68,10 +68,10 @@ namespace chaiscript
/// assert(i == 5);
/// \endcode
template<typename Type>
typename detail::Cast_Helper<Type>::Result_Type boxed_cast(const Boxed_Value &bv)
typename detail::Cast_Helper<Type>::Result_Type boxed_cast(const Boxed_Value &bv, const Dynamic_Cast_Conversions &t_conversions = Dynamic_Cast_Conversions())
{
try {
return detail::Cast_Helper<Type>::cast(bv);
return detail::Cast_Helper<Type>::cast(bv, t_conversions);
} catch (const boost::bad_any_cast &) {
#ifdef BOOST_MSVC
@@ -86,7 +86,7 @@ namespace chaiscript
try {
// We will not catch any bad_boxed_dynamic_cast that is thrown, let the user get it
// either way, we are not responsible if it doesn't work
return detail::Cast_Helper<Type>::cast(detail::boxed_dynamic_cast<Type>(bv));
return detail::Cast_Helper<Type>::cast(t_conversions.boxed_dynamic_cast<Type>(bv), t_conversions);
} catch (const boost::bad_any_cast &) {
throw exception::bad_boxed_cast(bv.get_type_info(), typeid(Type));
}