diff --git a/src/Library/BaseLibrary.hpp b/src/Library/BaseLibrary.hpp index d730468..399b591 100644 --- a/src/Library/BaseLibrary.hpp +++ b/src/Library/BaseLibrary.hpp @@ -24,8 +24,10 @@ namespace CreatureLib::Library { } inline void Insert(const char* key, const T* value) { _values.insert({Hash(key), value}); } + inline void Insert(const std::string& key, const T* value) { Insert(key.c_str(), value); } inline void Delete(const char* key) { _values.erase(Hash(key)); } + inline void Delete(const std::string& key) { Delete(key.c_str()); } bool TryGet(const char* name, const T*& out) const { auto find = this->_values.find(Hash(name)); @@ -36,14 +38,19 @@ namespace CreatureLib::Library { out = find->second; return true; } + bool TryGet(const std::string& name, const T*& out) const { + return TryGet(name.c_str(), out); + } inline const T* Get(const char* name) const { return _values.at(Hash(name)); } + inline const T* Get(const std::string& name) const { return Get(name.c_str()); } inline const T* operator[](const char* name) const { return Get(name); } + inline const T* operator[](const std::string& name) const { return Get(name.c_str()); } inline const std::unordered_map& GetIterator() const { return _values; } - size_t GetCount() const { return _values.count(); } + size_t GetCount() const { return _values.size(); } }; }