From 076646c00d9e1e832efaed9a1506ead228d59c0a Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Fri, 10 Sep 2021 15:54:22 +0200 Subject: [PATCH] SCRIPT: Get ride of some templated function for gcc to be happy about the code that it must compile --- src/Lib/Script/CRTPLuaScriptObject.hh | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/Lib/Script/CRTPLuaScriptObject.hh b/src/Lib/Script/CRTPLuaScriptObject.hh index 6772bb5a..d90a5fb8 100644 --- a/src/Lib/Script/CRTPLuaScriptObject.hh +++ b/src/Lib/Script/CRTPLuaScriptObject.hh @@ -21,11 +21,8 @@ namespace Vivy::Script #define script_class(theClassName) \ class theClassName final : public CRTPLuaScriptObject<theClassName> -#define LUA_DECL_GETTER(type, luaName, value) \ - static int luaName(lua_State *const L) noexcept \ - { \ - return luaPushValue<type>(L, CHECK(L, 1)->value); \ - } +#define LUA_DECL_GETTER(type, luaName, value) \ + static int luaName(lua_State *const L) noexcept { return luaPushValue(L, CHECK(L, 1)->value); } #define LUA_SCRIPTABLE_CLASS_MANUAL_CTOR(theClassName) \ VIVY_UNMOVABLE_OBJECT(theClassName) \ @@ -68,24 +65,22 @@ protected: } // Push something onto the stack, must be specialized - template <typename T> static int luaPushValue(lua_State *const L, const T &thing) noexcept; using std_str = std::string; using std_strv = std::string_view; - template <> static int luaPushValue<int>(lua_State *const L, const int &thing) noexcept + static int luaPushValue(lua_State *const L, const int &thing) noexcept { lua_pushinteger(L, thing); return 1; } - template <> - static int luaPushValue<std_strv>(lua_State *const L, const std_strv &thing) noexcept + static int luaPushValue(lua_State *const L, const std_strv &thing) noexcept { lua_pushlstring(L, thing.data(), thing.size()); return 1; } - template <> static int luaPushValue<std_str>(lua_State *const L, const std_str &thing) noexcept + static int luaPushValue(lua_State *const L, const std_str &thing) noexcept { lua_pushstring(L, thing.c_str()); return 1; -- GitLab