Skip to content

Commit

Permalink
Switched from 'static const string' to 'constexpr string_view'.
Browse files Browse the repository at this point in the history
  • Loading branch information
InsertCreativityHere committed Nov 25, 2024
1 parent 86f2a05 commit 0a6dc57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cpp/src/Slice/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Slice::Metadata::Metadata(string rawMetadata, string file, int line) : GrammarBa
{
// Check if the metadata starts with a language prefix.
// NOTE: It is important that this list is kept in alphabetical order!
static const string languages[] = {"cpp", "cs", "java", "js", "matlab", "php", "python", "ruby", "swift"};
constexpr string_view languages[] = {"cpp", "cs", "java", "js", "matlab", "php", "python", "ruby", "swift"};
string prefix = rawMetadata.substr(0, firstColonPos);
bool hasLangPrefix = binary_search(&languages[0], &languages[sizeof(languages) / sizeof(*languages)], prefix);
if (hasLangPrefix)
Expand Down

0 comments on commit 0a6dc57

Please sign in to comment.