From f5645833dfc8431118f8dbec32253aa06fb2f789 Mon Sep 17 00:00:00 2001 From: S6066 Date: Wed, 6 Jun 2018 00:25:59 +0200 Subject: [PATCH] Fix unwanted behavior with universal references (#165) * Remove forced template * Remove useless PushInstance overload --- include/Nazara/Lua/LuaState.hpp | 1 - include/Nazara/Lua/LuaState.inl | 13 ++----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/include/Nazara/Lua/LuaState.hpp b/include/Nazara/Lua/LuaState.hpp index 67640925a..47c6d07cf 100644 --- a/include/Nazara/Lua/LuaState.hpp +++ b/include/Nazara/Lua/LuaState.hpp @@ -141,7 +141,6 @@ namespace Nz template void PushFunction(R(*func)(Args...), DefArgs&&... defArgs) const; template void PushGlobal(const char* name, T&& arg); template void PushGlobal(const String& name, T&& arg); - template void PushInstance(const char* tname, const T& instance) const; template void PushInstance(const char* tname, T&& instance) const; template void PushInstance(const char* tname, Args&&... args) const; void PushInteger(long long value) const; diff --git a/include/Nazara/Lua/LuaState.inl b/include/Nazara/Lua/LuaState.inl index 62669d72b..7dcc4e36f 100644 --- a/include/Nazara/Lua/LuaState.inl +++ b/include/Nazara/Lua/LuaState.inl @@ -706,7 +706,7 @@ namespace Nz template void LuaState::PushField(const char* name, T&& arg, int tableIndex) const { - Push(std::forward(arg)); + Push(std::forward(arg)); SetField(name, tableIndex); } @@ -732,7 +732,7 @@ namespace Nz template void LuaState::PushGlobal(const char* name, T&& arg) { - Push(std::forward(arg)); + Push(std::forward(arg)); SetGlobal(name); } @@ -742,15 +742,6 @@ namespace Nz PushGlobal(name.GetConstBuffer(), std::forward(arg)); } - template - void LuaState::PushInstance(const char* tname, const T& instance) const - { - T* userdata = static_cast(PushUserdata(sizeof(T))); - PlacementNew(userdata, instance); - - SetMetatable(tname); - } - template void LuaState::PushInstance(const char* tname, T&& instance) const {