Skip to content

Commit f47d82c

Browse files
committed
unicode : reuse iterator
1 parent 8a533f0 commit f47d82c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

unicode.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#pragma once
1+
#pragma once
22

33
#include <cassert>
44
#include <stdexcept>
@@ -404,7 +404,8 @@ static std::unordered_map<uint32_t, int> codepoint_type_map() {
404404

405405
static int codepoint_type(uint32_t cp) {
406406
static std::unordered_map<uint32_t, int> codepoint_types = codepoint_type_map();
407-
return codepoint_types.find(cp) == codepoint_types.end() ? CODEPOINT_TYPE_UNIDENTIFIED : codepoint_types.at(cp);
407+
const auto it = codepoint_types.find(cp);
408+
return it == codepoint_types.end() ? CODEPOINT_TYPE_UNIDENTIFIED : it->second;
408409
}
409410

410411
static int codepoint_type(const std::string & utf8) {

0 commit comments

Comments
 (0)