From 8dbb43f45f2cf786346d68da6eda691b50902517 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Wed, 15 Jul 2009 23:36:10 +0000 Subject: [PATCH] Clean up last bug fix with full support for const & (and presumably some support for const *) contained types. --- .../chaiscript/dispatchkit/boxed_value.hpp | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) 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(); }