diff options
author | Ner'zhul <nerzhul@users.noreply.github.com> | 2016-08-10 12:08:05 +0200 |
---|---|---|
committer | est31 <est31@users.noreply.github.com> | 2016-08-10 12:08:05 +0200 |
commit | 058a869b70072aba8baea47e359c45e82daaf152 (patch) | |
tree | b0dd1820e89975d7172836d4861d9ab2ae2b472d /src/nameidmapping.h | |
parent | 8df89db30e80eff2ebbf30f0331b8ab4906a410e (diff) | |
download | hax-minetest-server-058a869b70072aba8baea47e359c45e82daaf152.tar.gz hax-minetest-server-058a869b70072aba8baea47e359c45e82daaf152.zip |
Permit usage of std::unordered_map & std::unorderered_set on c++11 compilers (#4430)
This fallback to std::map & std::set for older compilers
Use UNORDERED_SET as an example in decoration and ore biome sets
Use UNORDERED_MAP as an example in nameidmapping
Diffstat (limited to 'src/nameidmapping.h')
-rw-r--r-- | src/nameidmapping.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nameidmapping.h b/src/nameidmapping.h index 417c441d2..23838c8ff 100644 --- a/src/nameidmapping.h +++ b/src/nameidmapping.h @@ -23,15 +23,15 @@ with this program; if not, write to the Free Software Foundation, Inc., #include <string> #include <iostream> #include <set> -#include <map> #include "irrlichttypes_bloated.h" +#include "util/cpp11_container.h" class NameIdMapping { public: void serialize(std::ostream &os) const; void deSerialize(std::istream &is); - + void clear(){ m_id_to_name.clear(); m_name_to_id.clear(); @@ -55,7 +55,7 @@ public: m_name_to_id.erase(name); } bool getName(u16 id, std::string &result) const{ - std::map<u16, std::string>::const_iterator i; + UNORDERED_MAP<u16, std::string>::const_iterator i; i = m_id_to_name.find(id); if(i == m_id_to_name.end()) return false; @@ -63,7 +63,7 @@ public: return true; } bool getId(const std::string &name, u16 &result) const{ - std::map<std::string, u16>::const_iterator i; + UNORDERED_MAP<std::string, u16>::const_iterator i; i = m_name_to_id.find(name); if(i == m_name_to_id.end()) return false; @@ -74,8 +74,8 @@ public: return m_id_to_name.size(); } private: - std::map<u16, std::string> m_id_to_name; - std::map<std::string, u16> m_name_to_id; + UNORDERED_MAP<u16, std::string> m_id_to_name; + UNORDERED_MAP<std::string, u16> m_name_to_id; }; #endif |