Update of /cvsroot/luabind/luabind/luabind/luabind/detail
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14830/luabind/detail
Modified Files:
Tag: beta7-devel2
find_best_match.hpp policy.hpp
Log Message:
fixed bug in the const-pointer and const-reference matchers returning perfect matches for some non-matches
Index: find_best_match.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/detail/find_best_match.hpp,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -u -d -r1.5 -r1.5.4.1
--- find_best_match.hpp 14 Jun 2003 21:05:02 -0000 1.5
+++ find_best_match.hpp 25 Oct 2005 22:57:47 -0000 1.5.4.1
@@ -33,16 +33,25 @@
// expects that a match function can be accesed through the iterator
// as int match_fun(lua_State*)
- // returns true if it found a match better than the given. If it finds a better match match_index is
- // updated to contain the new index to the best match (this index now refers to the list given to
- // this call).
- // orep_size is supposed to tell the size of the actual structures that start and end points to
- // ambiguous is set to true if the match was ambiguous
- // min_match should be initialized to the currently best match value (the number of implicit casts
- // to get a perfect match). If there are no previous matches, set min_match to std::numeric_limits<int>::max()
+ // returns true if it found a match better than the given. If it finds a
+ // better match match_index is updated to contain the new index to the best
+ // match (this index now refers to the list given to this call).
+ // orep_size is supposed to tell the size of the actual structures that
+ // start and end points to ambiguous is set to true if the match was
+ // ambiguous min_match should be initialized to the currently best match
+ // value (the number of implicit casts to get a perfect match). If there
+ // are no previous matches, set min_match to
+ // std::numeric_limits<int>::max()
- LUABIND_API bool find_best_match(lua_State* L, const detail::overload_rep_base* start, int num_overloads, size_t orep_size, bool& ambiguous, int& min_match, int& match_index, int num_params);
- LUABIND_API void find_exact_match(lua_State* L, const detail::overload_rep_base* start, int num_overloads, size_t orep_size, int cmp_match, int num_params, std::vector<const overload_rep_base*>& dest);
+ LUABIND_API bool find_best_match(lua_State* L
+ , detail::overload_rep_base const* start, int num_overloads
+ , size_t orep_size, bool& ambiguous, int& min_match, int& match_index
+ , int num_params);
+
+ LUABIND_API void find_exact_match(lua_State* L
+ , detail::overload_rep_base const* start, int num_overloads
+ , size_t orep_size, int cmp_match, int num_params
+ , std::vector<overload_rep_base const*>& dest);
}}
Index: policy.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/detail/policy.hpp,v
retrieving revision 1.50.2.8
retrieving revision 1.50.2.9
diff -u -d -r1.50.2.8 -r1.50.2.9
--- policy.hpp 24 Oct 2005 09:44:00 -0000 1.50.2.8
+++ policy.hpp 25 Oct 2005 22:57:47 -0000 1.50.2.9
@@ -769,7 +769,8 @@
bool const_ = obj->flags() & object_rep::constant;
int d;
- return implicit_cast(obj->crep(), LUABIND_TYPEID(T), d) + !const_;
+ int points = implicit_cast(obj->crep(), LUABIND_TYPEID(T), d);
+ return points == -1 ? -1 : points + !const_;
}
template<class T>
@@ -960,7 +961,8 @@
bool const_ = obj->flags() & object_rep::constant;
int d;
- return implicit_cast(obj->crep(), LUABIND_TYPEID(T), d) + !const_;
+ int points = implicit_cast(obj->crep(), LUABIND_TYPEID(T), d);
+ return points == -1 ? -1 : points + !const_;
}
~const_ref_converter()
|