Remove compute_arity(). This isn't used any more.
[luabind.git] / luabind / detail / compute_score.hpp
blobc9a7e9ea1308f034660079aa82d5d6dfdc3e63bc
1 // Copyright Daniel Wallin 2008. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef LUABIND_COMPUTE_RANK_081006_HPP
6 # define LUABIND_COMPUTE_RANK_081006_HPP
8 # include <luabind/config.hpp>
9 # include <luabind/detail/policy.hpp>
10 # include <boost/mpl/apply_wrap.hpp>
11 # include <boost/mpl/begin_end.hpp>
12 # include <boost/mpl/int.hpp>
13 # include <boost/mpl/next.hpp>
15 namespace luabind { namespace detail {
17 namespace mpl = boost::mpl;
19 template <class Idx, class Iter, class End, class Policies>
20 int compute_score_aux(
21 lua_State*L, int index, Idx, Iter, End end, Policies const& policies)
23 typedef typename Iter::type arg_type;
24 typedef typename find_conversion_policy<Idx::value, Policies>::type
25 conversion_policy;
26 typedef typename mpl::apply_wrap2<
27 conversion_policy, arg_type, lua_to_cpp>::type converter;
29 int score = converter::match(L, LUABIND_DECORATE_TYPE(arg_type), index);
31 if (score < 0)
32 return score;
34 if (conversion_policy::has_arg)
35 ++index;
37 int next = compute_score_aux(
39 , index
40 , typename mpl::next<Idx>::type()
41 , typename mpl::next<Iter>::type()
42 , end
43 , policies
46 if (next < 0)
47 return next;
49 return score + next;
52 template <class Idx, class End, class Policies>
53 int compute_score_aux(lua_State*, int, Idx, End, End, Policies const&)
55 return 0;
58 template <class Signature, class Policies>
59 int compute_score(lua_State* L, Signature, Policies const& policies)
61 return compute_score_aux(
63 , 1
64 , mpl::int_<1>()
65 , typename mpl::next<typename mpl::begin<Signature>::type>::type()
66 , typename mpl::end<Signature>::type()
67 , policies
71 }} // namespace luabind::detail
73 #endif // LUABIND_COMPUTE_RANK_081006_HPP