mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
std::size_t for life.
Clang's silly tautological error can die in a fire. D:<
This commit is contained in:
parent
a11faabb5c
commit
1e3466d173
|
@ -247,7 +247,7 @@ struct base_function {
|
|||
return base_gc(L, *pudata);
|
||||
}
|
||||
|
||||
template<int I>
|
||||
template<std::size_t I>
|
||||
struct userdata {
|
||||
static int call(lua_State* L) {
|
||||
// Zero-based template parameter, but upvalues start at 1
|
||||
|
@ -258,14 +258,25 @@ struct base_function {
|
|||
return ref_base_call(L, stack::get<upvalue_t>(L, I + 1));
|
||||
}
|
||||
|
||||
static int gc(lua_State* L) {
|
||||
for(int i = 0; i < I; ++i) {
|
||||
template <std::size_t limit>
|
||||
static void func_gc (std::true_type, lua_State* L) {
|
||||
|
||||
}
|
||||
|
||||
template <std::size_t limit>
|
||||
static void func_gc (std::false_type, lua_State* L) {
|
||||
// Shut up clang tautological error without throwing out std::size_t
|
||||
for(std::size_t i = 0; i < limit; ++i) {
|
||||
upvalue_t up = stack::get<upvalue_t>(L, i + 1);
|
||||
base_function* obj = static_cast<base_function*>(up.value);
|
||||
std::allocator<base_function> alloc{};
|
||||
alloc.destroy(obj);
|
||||
alloc.deallocate(obj, 1);
|
||||
}
|
||||
}
|
||||
|
||||
static int gc(lua_State* L) {
|
||||
func_gc<I>(std::integral_constant<bool, (I < 1)>(), L);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user