Skip to content

Commit 6e7801b

Browse files
committed
Use std::unordered_set for better performance
1 parent 7271d18 commit 6e7801b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/code.l

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ typedef yyguts_t *yyscan_t;
3434
#include <memory>
3535
#include <algorithm>
3636
#include <unordered_map>
37+
#include <unordered_set>
3738
#include <stack>
3839
#include <vector>
3940
#include <string>
@@ -3731,12 +3732,12 @@ static QCString escapeComment(yyscan_t yyscanner,const char *s)
37313732
static bool skipLanguageSpecificKeyword(yyscan_t yyscanner,const char *keyword)
37323733
{
37333734
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3734-
static std::vector<std::string> non_cpp_keywords = {
3735+
static std::unordered_set<std::string> non_cpp_keywords = {
37353736
"__assume", "__super", "abstract", "function",
37363737
"gcnew", "gcroot", "generic", "get",
37373738
"internal", "null", "pin_ptr", "raise",
37383739
"remove", "self", "set", "transient"};
3739-
return yyextra->lang==SrcLangExt_Cpp && (std::find(non_cpp_keywords.begin(), non_cpp_keywords.end(), keyword) != non_cpp_keywords.end());
3740+
return yyextra->lang==SrcLangExt_Cpp && (non_cpp_keywords.find(keyword) != non_cpp_keywords.end());
37403741
}
37413742

37423743
static bool isCastKeyword(const char *keyword)

0 commit comments

Comments
 (0)