mirror of https://github.com/orefkov/simstr.git
Исправлен тип возвращаемого значения в hashStrMap::at
This commit is contained in:
parent
8cff9ea543
commit
b61296939c
|
|
@ -5631,17 +5631,17 @@ public:
|
||||||
return try_emplace(std::forward<Key>(key)).first->second;
|
return try_emplace(std::forward<Key>(key)).first->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto at(const StoreType<K>& key) {
|
decltype(auto) at(const StoreType<K>& key) {
|
||||||
return hash_t::at(key);
|
return hash_t::at(key);
|
||||||
}
|
}
|
||||||
auto at(const StoreType<K>& key) const {
|
decltype(auto) at(const StoreType<K>& key) const {
|
||||||
return hash_t::at(key);
|
return hash_t::at(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto at(simple_str<K> key) {
|
decltype(auto) at(simple_str<K> key) {
|
||||||
return hash_t::at(toStoreType(key));
|
return hash_t::at(toStoreType(key));
|
||||||
}
|
}
|
||||||
auto at(simple_str<K> key) const {
|
decltype(auto) at(simple_str<K> key) const {
|
||||||
return hash_t::at(toStoreType(key));
|
return hash_t::at(toStoreType(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1751,4 +1751,13 @@ TEST(SimStr, InitFromLValueStdStrings) {
|
||||||
EXPECT_EQ(ssa(get_string_cref()), "str");
|
EXPECT_EQ(ssa(get_string_cref()), "str");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(SimStr, HashStrMapAt) {
|
||||||
|
hashStrMapA<int> test = {
|
||||||
|
{"Test"_h, 1}
|
||||||
|
};
|
||||||
|
EXPECT_EQ(test.find("Test")->second, 1);
|
||||||
|
test.at("Test") = 2;
|
||||||
|
EXPECT_EQ(test.find("Test")->second, 2);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace simstr::tests
|
} // namespace simstr::tests
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue