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:
@@ -17,6 +17,8 @@
|
||||
|
||||
namespace chaiscript
|
||||
{
|
||||
class Dynamic_Cast_Conversions;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// Cast_Helper_Inner helper classes
|
||||
@@ -29,7 +31,7 @@ namespace chaiscript
|
||||
{
|
||||
typedef typename boost::reference_wrapper<typename boost::add_const<Result>::type > Result_Type;
|
||||
|
||||
static Result_Type cast(const Boxed_Value &ob)
|
||||
static Result_Type cast(const Boxed_Value &ob, const Dynamic_Cast_Conversions &)
|
||||
{
|
||||
if (ob.is_ref())
|
||||
{
|
||||
@@ -71,7 +73,7 @@ namespace chaiscript
|
||||
{
|
||||
typedef const Result * Result_Type;
|
||||
|
||||
static Result_Type cast(const Boxed_Value &ob)
|
||||
static Result_Type cast(const Boxed_Value &ob, const Dynamic_Cast_Conversions &)
|
||||
{
|
||||
if (ob.is_ref())
|
||||
{
|
||||
@@ -100,7 +102,7 @@ namespace chaiscript
|
||||
{
|
||||
typedef Result * Result_Type;
|
||||
|
||||
static Result_Type cast(const Boxed_Value &ob)
|
||||
static Result_Type cast(const Boxed_Value &ob, const Dynamic_Cast_Conversions &)
|
||||
{
|
||||
if (ob.is_ref())
|
||||
{
|
||||
@@ -119,7 +121,7 @@ namespace chaiscript
|
||||
{
|
||||
typedef typename boost::reference_wrapper<Result> Result_Type;
|
||||
|
||||
static Result_Type cast(const Boxed_Value &ob)
|
||||
static Result_Type cast(const Boxed_Value &ob, const Dynamic_Cast_Conversions &)
|
||||
{
|
||||
if (ob.is_ref())
|
||||
{
|
||||
@@ -138,7 +140,7 @@ namespace chaiscript
|
||||
{
|
||||
typedef typename boost::shared_ptr<Result> Result_Type;
|
||||
|
||||
static Result_Type cast(const Boxed_Value &ob)
|
||||
static Result_Type cast(const Boxed_Value &ob, const Dynamic_Cast_Conversions &)
|
||||
{
|
||||
return boost::any_cast<boost::shared_ptr<Result> >(ob.get());
|
||||
}
|
||||
@@ -152,7 +154,7 @@ namespace chaiscript
|
||||
{
|
||||
typedef typename boost::shared_ptr<const Result> Result_Type;
|
||||
|
||||
static Result_Type cast(const Boxed_Value &ob)
|
||||
static Result_Type cast(const Boxed_Value &ob, const Dynamic_Cast_Conversions &)
|
||||
{
|
||||
if (!ob.get_type_info().is_const())
|
||||
{
|
||||
@@ -200,7 +202,7 @@ namespace chaiscript
|
||||
{
|
||||
typedef const Boxed_Value & Result_Type;
|
||||
|
||||
static Result_Type cast(const Boxed_Value &ob)
|
||||
static Result_Type cast(const Boxed_Value &ob, const Dynamic_Cast_Conversions &)
|
||||
{
|
||||
return ob;
|
||||
}
|
||||
@@ -261,9 +263,9 @@ namespace chaiscript
|
||||
{
|
||||
typedef typename Cast_Helper_Inner<T>::Result_Type Result_Type;
|
||||
|
||||
static Result_Type cast(const Boxed_Value &ob)
|
||||
static Result_Type cast(const Boxed_Value &ob, const Dynamic_Cast_Conversions &t_conversions)
|
||||
{
|
||||
return Cast_Helper_Inner<T>::cast(ob);
|
||||
return Cast_Helper_Inner<T>::cast(ob, t_conversions);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user