diff --git a/include/chaiscript/dispatchkit/boxed_value.hpp b/include/chaiscript/dispatchkit/boxed_value.hpp index 55cdb61..528c8c7 100644 --- a/include/chaiscript/dispatchkit/boxed_value.hpp +++ b/include/chaiscript/dispatchkit/boxed_value.hpp @@ -326,7 +326,12 @@ namespace dispatchkit { if (ob.is_ref()) { - return boost::cref((boost::any_cast >(ob.get())).get()); + if (!ob.get_type_info().m_is_const) + { + return boost::cref((boost::any_cast >(ob.get())).get()); + } else { + return boost::any_cast >(ob.get()); + } } else { return boost::cref(*(boost::any_cast >(ob.get()))); } @@ -345,7 +350,12 @@ namespace dispatchkit { if (ob.is_ref()) { - return boost::cref((boost::any_cast >(ob.get())).get()); + if (!ob.get_type_info().m_is_const) + { + return boost::cref((boost::any_cast >(ob.get())).get()); + } else { + return boost::any_cast >(ob.get()); + } } else { return boost::cref(*(boost::any_cast >(ob.get()))); } @@ -364,7 +374,12 @@ namespace dispatchkit { if (ob.is_ref()) { - return (boost::any_cast >(ob.get())).get_pointer(); + if (!ob.get_type_info().m_is_const) + { + return (boost::any_cast >(ob.get())).get_pointer(); + } else { + return (boost::any_cast >(ob.get())).get_pointer(); + } } else { return (boost::any_cast >(ob.get())).get(); }