More robust handling of potential class object member types

This commit is contained in:
Jason Turner
2009-11-15 00:37:01 +00:00
parent 9dddb49850
commit ed11f48847
2 changed files with 16 additions and 2 deletions

View File

@@ -83,6 +83,19 @@ namespace chaiscript
}
};
/**
* Used internally for handling a return value from a Proxy_Function call
*/
template<>
struct Handle_Return<const Boxed_Value &>
{
static Boxed_Value handle(const Boxed_Value &r)
{
return r;
}
};
/**
* Used internally for handling a return value from a Proxy_Function call
*/

View File

@@ -442,10 +442,11 @@ namespace chaiscript
if (bv.is_const())
{
const Class *o = boxed_cast<const Class *>(bv);
return Boxed_Value( boost::ref(o->*m_attr) );
return Handle_Return<typename boost::add_const<typename boost::add_reference<T>::type>::type>::handle(o->*m_attr);
} else {
Class *o = boxed_cast<Class *>(bv);
return Boxed_Value( boost::ref(o->*m_attr) );
return Handle_Return<typename boost::add_reference<T>::type>::handle(o->*m_attr);
// return Boxed_Value( boost::ref(o->*m_attr) );
}
} else {
throw arity_error(params.size(), 1);