From e90d49bb9dba1b1a8a0978731642784d7d4b22b3 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Sat, 11 Dec 2010 22:38:08 +0000 Subject: [PATCH] Function ordering is working properly now, just need to add a unit test for it. --- include/chaiscript/dispatchkit/bootstrap.hpp | 5 ++-- .../chaiscript/dispatchkit/dispatchkit.hpp | 24 +++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/include/chaiscript/dispatchkit/bootstrap.hpp b/include/chaiscript/dispatchkit/bootstrap.hpp index 2b89ad6..1a16cb8 100644 --- a/include/chaiscript/dispatchkit/bootstrap.hpp +++ b/include/chaiscript/dispatchkit/bootstrap.hpp @@ -385,7 +385,7 @@ namespace chaiscript * Similar to shared_ptr_clone. Used for Proxy_Function. */ template - Boxed_Value ptr_assign(Boxed_Value lhs, const boost::shared_ptr::type> &rhs) + Boxed_Value ptr_assign(Boxed_Value lhs, const boost::shared_ptr &rhs) { if (lhs.is_undef() || (!lhs.get_type_info().is_const() && lhs.get_type_info().bare_equal(chaiscript::detail::Get_Type_Info::get()))) @@ -618,7 +618,8 @@ namespace chaiscript "bind"); m->add(fun(&shared_ptr_unconst_clone), "clone"); - m->add(fun(&ptr_assign), "="); + m->add(fun(&ptr_assign::type>), "="); + m->add(fun(&ptr_assign::type>), "="); m->add(Proxy_Function(new Dynamic_Proxy_Function(boost::bind(&call_exists, _1))), "call_exists"); diff --git a/include/chaiscript/dispatchkit/dispatchkit.hpp b/include/chaiscript/dispatchkit/dispatchkit.hpp index 34f955b..5246747 100644 --- a/include/chaiscript/dispatchkit/dispatchkit.hpp +++ b/include/chaiscript/dispatchkit/dispatchkit.hpp @@ -811,6 +811,10 @@ namespace chaiscript const int lhssize = lhsparamtypes.size(); const int rhssize = rhsparamtypes.size(); + const Type_Info boxed_type = user_type(); + const Type_Info boxed_pod_type = user_type(); + + for (int i = 1; i < lhssize && i < rhssize; ++i) { const Type_Info lt = lhsparamtypes[i]; @@ -824,16 +828,14 @@ namespace chaiscript // const is after non-const for the same type if (lt.bare_equal(rt) && lt.is_const() && !rt.is_const()) { - return true; + return false; } if (lt.bare_equal(rt) && !lt.is_const()) { - return false; + return true; } - const Type_Info boxed_type = user_type(); - // boxed_values are sorted last if (lt.bare_equal(boxed_type)) { @@ -841,6 +843,20 @@ namespace chaiscript } if (rt.bare_equal(boxed_type)) + { + if (lt.bare_equal(boxed_pod_type)) + { + return true; + } + return true; + } + + if (lt.bare_equal(boxed_pod_type)) + { + return false; + } + + if (rt.bare_equal(boxed_pod_type)) { return true; }