Skip to content

Commit

Permalink
fix arity accumulation
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhD committed Aug 4, 2018
1 parent 2b53d76 commit 92fa032
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sol/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit 92fa032

Please sign in to comment.