Lua/LuaInstance: Fix compilation under Clang/GCC
A big thank to gbdivers on this one Former-commit-id: f96a61ef101b7c9512ada719c82b0836aed3738b
This commit is contained in:
parent
688aed0160
commit
11abcc7da4
|
|
@ -174,7 +174,7 @@ namespace Nz
|
|||
{
|
||||
m_methods[name] = method;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
template<typename R, typename P, typename... Args, typename... DefArgs>
|
||||
std::enable_if_t<std::is_base_of<P, T>::value> LuaClass<T>::SetMethod(const String& name, R(P::*func)(Args...), DefArgs... defArgs)
|
||||
|
|
@ -194,7 +194,7 @@ namespace Nz
|
|||
{
|
||||
SetMethod(name, [func, defArgs...] (LuaInstance& instance, T& object) -> int
|
||||
{
|
||||
LuaImplMethodProxy<T, Args...>::Impl<DefArgs...> handler(instance, object, defArgs...);
|
||||
typename LuaImplMethodProxy<T, Args...>::template Impl<DefArgs...> handler(instance, object, defArgs...);
|
||||
handler.ProcessArgs();
|
||||
|
||||
return handler.Invoke(func);
|
||||
|
|
@ -225,7 +225,7 @@ namespace Nz
|
|||
{
|
||||
SetStaticMethod(name, [func, defArgs...] (LuaInstance& instance) -> int
|
||||
{
|
||||
LuaImplFunctionProxy<Args...>::Impl<DefArgs...> handler(instance);
|
||||
typename LuaImplFunctionProxy<Args...>::template Impl<DefArgs...> handler(instance);
|
||||
handler.ProcessArgs();
|
||||
|
||||
return handler.Invoke(func);
|
||||
|
|
|
|||
|
|
@ -196,21 +196,21 @@ namespace Nz
|
|||
return retVal;
|
||||
}
|
||||
|
||||
template<typename hasDefault>
|
||||
template<bool HasDefault>
|
||||
struct LuaImplArgProcesser;
|
||||
|
||||
template<>
|
||||
struct LuaImplArgProcesser<std::true_type>
|
||||
struct LuaImplArgProcesser<true>
|
||||
{
|
||||
template<std::size_t N, std::size_t FirstDefArg, typename ArgType, typename ArgContainer, typename DefArgContainer>
|
||||
static void Process(LuaInstance& instance, ArgContainer& args, DefArgContainer& defArgs)
|
||||
{
|
||||
std::get<N>(args) = std::move(LuaImplQueryArg(instance, N + 1, std::get<N - FirstDefArg>(defArgs), TypeTag<ArgType>()));
|
||||
std::get<N>(args) = std::move(LuaImplQueryArg(instance, N + 1, std::get<std::tuple_size<DefArgContainer>() - N + FirstDefArg - 1>(defArgs), TypeTag<ArgType>()));
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct LuaImplArgProcesser<std::false_type>
|
||||
struct LuaImplArgProcesser<false>
|
||||
{
|
||||
template<std::size_t N, std::size_t FirstDefArg, typename ArgType, typename ArgContainer, typename DefArgContainer>
|
||||
static void Process(LuaInstance& instance, ArgContainer& args, DefArgContainer& defArgs)
|
||||
|
|
@ -272,8 +272,7 @@ namespace Nz
|
|||
template<std::size_t N, typename ArgType>
|
||||
void ProcessArgs()
|
||||
{
|
||||
using CheckDefValue = typename std::integral_constant<bool, N >= FirstDefArg>;
|
||||
LuaImplArgProcesser<CheckDefValue>::Process<N, FirstDefArg, ArgType>(m_instance, m_args, m_defaultArgs);
|
||||
LuaImplArgProcesser<(N >= FirstDefArg)>::template Process<N, FirstDefArg, ArgType>(m_instance, m_args, m_defaultArgs);
|
||||
}
|
||||
|
||||
template<std::size_t N, typename ArgType1, typename ArgType2, typename... Rest>
|
||||
|
|
@ -355,8 +354,7 @@ namespace Nz
|
|||
template<std::size_t N, typename ArgType>
|
||||
void ProcessArgs()
|
||||
{
|
||||
using CheckDefValue = typename std::integral_constant<bool, N >= FirstDefArg>;
|
||||
LuaImplArgProcesser<CheckDefValue>::Process<N, FirstDefArg, ArgType>(m_instance, m_args, m_defaultArgs);
|
||||
LuaImplArgProcesser<(N >= FirstDefArg)>::template Process<N, FirstDefArg, ArgType>(m_instance, m_args, m_defaultArgs);
|
||||
}
|
||||
|
||||
template<std::size_t N, typename ArgType1, typename ArgType2, typename... Rest>
|
||||
|
|
@ -396,7 +394,7 @@ namespace Nz
|
|||
{
|
||||
PushFunction([func, defArgs...](LuaInstance& instance) -> int
|
||||
{
|
||||
LuaImplFunctionProxy<Args...>::Impl<DefArgs...> handler(instance);
|
||||
typename LuaImplFunctionProxy<Args...>::template Impl<DefArgs...> handler(instance, defArgs...);
|
||||
handler.ProcessArgs();
|
||||
|
||||
return handler.Invoke(func);
|
||||
|
|
|
|||
Loading…
Reference in New Issue