diff options
author | Georgi Gerganov <ggerganov@gmail.com> | 2024-02-26 14:02:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-26 14:02:12 +0200 |
commit | 67fd33132fab93e6c2087bd6fa656a8a57419efa (patch) | |
tree | 4aa30bb2abb5fa788a47672c67a6d99142fd5b4b | |
parent | 4804215cb833841ffb15a710a16b77ca0a29eb4b (diff) |
unicode : reuse iterator (#5726)
-rw-r--r-- | unicode.h | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -404,7 +404,8 @@ static std::unordered_map<uint32_t, int> codepoint_type_map() { static int codepoint_type(uint32_t cp) { static std::unordered_map<uint32_t, int> codepoint_types = codepoint_type_map(); - return codepoint_types.find(cp) == codepoint_types.end() ? CODEPOINT_TYPE_UNIDENTIFIED : codepoint_types.at(cp); + const auto it = codepoint_types.find(cp); + return it == codepoint_types.end() ? CODEPOINT_TYPE_UNIDENTIFIED : it->second; } static int codepoint_type(const std::string & utf8) { |