From d35faaee8b18a7b54fa47ed885c902ed0a427ee5 Mon Sep 17 00:00:00 2001 From: Egor Date: Sun, 8 Feb 2026 02:38:53 +0200 Subject: [PATCH] map: add heterogeneous insertion --- src/admin.cpp | 2 +- src/map.hpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/admin.cpp b/src/admin.cpp index f7f2b27..49ef0c0 100644 --- a/src/admin.cpp +++ b/src/admin.cpp @@ -74,7 +74,7 @@ struct SetRef { return 0; } if constexpr (std::same_as) { - s.add(std::string(key)); // FIXME: + s.add(key); } else if constexpr (std::same_as) { s.add(*(Client **)luaL_checkudata(L, 3, "Client")); } else if constexpr (std::same_as) { diff --git a/src/map.hpp b/src/map.hpp index e437456..939fb23 100644 --- a/src/map.hpp +++ b/src/map.hpp @@ -222,7 +222,8 @@ public: bool has(const K& k) { return m.find(k) != m.end(); } - bool add(const T &v) { + template + bool add(const K &v) { return m.insert(v).second; } template -- 2.56.0