fix arity accumulation

This commit is contained in:
ThePhD 2018-08-04 11:00:17 -04:00
parent 2b53d764ed
commit 92fa032ff4

View File

@ -1046,6 +1046,12 @@ namespace sol {
template <typename C, C v, template <typename...> class V, typename T, typename... Args>
struct accumulate<C, v, V, T, Args...> : accumulate<C, v + V<T>::value, V, Args...> {};
template <typename C, C v, template <typename...> class V, typename List>
struct accumulate_list;
template <typename C, C v, template <typename...> class V, typename... Args>
struct accumulate_list<C, v, V, types<Args...>> : accumulate<C, v, V, Args...> {};
} // namespace detail
template <typename T>
@ -1152,9 +1158,9 @@ namespace sol {
public:
typedef std::integral_constant<bool, meta::count_for<is_variadic_arguments, typename base_t::args_list>::value != 0> runtime_variadics_t;
static const std::size_t true_arity = base_t::arity;
static const std::size_t arity = base_t::arity - meta::count_for<is_transparent_argument, typename base_t::args_list>::value;
static const std::size_t arity = detail::accumulate_list<std::size_t, 0, lua_size, typename base_t::args_list>::value - meta::count_for<is_transparent_argument, typename base_t::args_list>::value;
static const std::size_t true_free_arity = base_t::free_arity;
static const std::size_t free_arity = base_t::free_arity - meta::count_for<is_transparent_argument, typename base_t::args_list>::value;
static const std::size_t free_arity = detail::accumulate_list<std::size_t, 0, lua_size, typename base_t::free_args_list>::value - meta::count_for<is_transparent_argument, typename base_t::args_list>::value;
};
template <typename T>