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
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
);
34 if (conversion_policy::has_arg
)
37 int next
= compute_score_aux(
40 , typename
mpl::next
<Idx
>::type()
41 , typename
mpl::next
<Iter
>::type()
52 template <class Idx
, class End
, class Policies
>
53 int compute_score_aux(lua_State
*, int, Idx
, End
, End
, Policies
const&)
58 template <class Signature
, class Policies
>
59 int compute_score(lua_State
* L
, Signature
, Policies
const& policies
)
61 return compute_score_aux(
65 , typename
mpl::next
<typename
mpl::begin
<Signature
>::type
>::type()
66 , typename
mpl::end
<Signature
>::type()
71 }} // namespace luabind::detail
73 #endif // LUABIND_COMPUTE_RANK_081006_HPP