summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2020-09-26 15:47:58 +0200
committerLéo Lam <leo@leolam.fr>2020-09-26 15:48:18 +0200
commitcdf27ca63c7a3450e4de44764cce40cecb7c062a (patch)
treeda79e4afbfbf486d7e23ef65365c22b67bc80c3b /src
parentcb1b70bb039f9d5a8a22c30697dfe61565552511 (diff)
ksys/util: Add StrTreeMapKey(const SafeString&) for convenience
Diffstat (limited to 'src')
-rw-r--r--src/KingSystem/Utils/StrTreeMap.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/KingSystem/Utils/StrTreeMap.h b/src/KingSystem/Utils/StrTreeMap.h
index 458e7eab..f333e74b 100644
--- a/src/KingSystem/Utils/StrTreeMap.h
+++ b/src/KingSystem/Utils/StrTreeMap.h
@@ -10,12 +10,12 @@ class StrTreeMapKey {
public:
StrTreeMapKey() = default;
StrTreeMapKey(u32 key_hash, const sead::SafeString& key) : mKeyHash(key_hash), mKey(key) {}
+ explicit StrTreeMapKey(const sead::SafeString& key)
+ : StrTreeMapKey(sead::HashCRC32::calcStringHash(key.cstr()), key) {}
const sead::SafeString& key() const { return mKey; }
- void setKey(const sead::SafeString& key) {
- *this = {sead::HashCRC32::calcStringHash(key.cstr()), key};
- }
+ void setKey(const sead::SafeString& key) { *this = StrTreeMapKey{key}; }
s32 compare(const StrTreeMapKey& rhs) const {
if (mKeyHash < rhs.mKeyHash)