Unfortunately have to use tag dispatched types because Clang's a piece of shit.

This commit is contained in:
ThePhD 2016-03-11 18:41:44 -05:00
parent 9dd6c2b095
commit d8bc6c8612
2 changed files with 6 additions and 6 deletions

View File

@ -25,7 +25,7 @@ os.chdir(script_path)
intro = """// The MIT License (MIT)
// Copyright (c) 2013-2015 Rapptz and contributors
// Copyright (c) 2013-2016 Rapptz, ThePhD and contributors
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
@ -47,7 +47,7 @@ intro = """// The MIT License (MIT)
// This file was generated with a script.
// Generated {time} UTC
// This header was generated with sol {version} (revision {revision})
// https://github.com/Rapptz/sol
// https://github.com/ThePhD/sol2
#ifndef {guard}
#define {guard}

View File

@ -430,14 +430,14 @@ struct checker<T*, type::userdata, C> {
if (indextype == type::nil) {
return true;
}
return checker<T, type::userdata, C>{}.check<T*>(L, indextype, index, handler);
return checker<T, type::userdata, C>{}.check(types<T*>(), L, indextype, index, handler);
}
};
template <typename T, typename C>
struct checker<T, type::userdata, C> {
template <typename U = T, typename Handler>
static bool check (lua_State* L, type indextype, int index, const Handler& handler) {
template <typename U, typename Handler>
static bool check (types<U>, lua_State* L, type indextype, int index, const Handler& handler) {
if (indextype != type::userdata) {
handler(L, index, type::userdata, indextype);
return false;
@ -493,7 +493,7 @@ struct checker<T, type::userdata, C> {
template <typename Handler>
static bool check (lua_State* L, int index, const Handler& handler) {
const type indextype = type_of(L, index);
return check(L, indextype, index, handler);
return check(types<T>(), L, indextype, index, handler);
}
};