]> PatchyGit - patchyircd.git/commitdiff
map: add heterogeneous insertion
authorEgor <egor@patchysicp.xyz>
Sun, 8 Feb 2026 00:38:53 +0000 (02:38 +0200)
committerEgor <egor@patchysicp.xyz>
Sun, 8 Feb 2026 00:38:53 +0000 (02:38 +0200)
src/admin.cpp
src/map.hpp

index f7f2b27..49ef0c0 100644 (file)
@@ -74,7 +74,7 @@ struct SetRef {
                        return 0;
                }
                if constexpr (std::same_as<T, std::string>) {
-                       s.add(std::string(key)); // FIXME:
+                       s.add(key);
                } else if constexpr (std::same_as<T, Client*>) {
                        s.add(*(Client **)luaL_checkudata(L, 3, "Client"));
                } else if constexpr (std::same_as<T, Channel*>) {
index e437456..939fb23 100644 (file)
@@ -222,7 +222,8 @@ public:
        bool has(const K& k) {
                return m.find(k) != m.end();
        }
-       bool add(const T &v) {
+       template<typename K>
+       bool add(const K &v) {
                return m.insert(v).second;
        }
        template<typename K>