From 0a6dc5758a0b286d1f98052881eb1334f1287063 Mon Sep 17 00:00:00 2001 From: Austin Henriksen Date: Mon, 25 Nov 2024 10:29:54 -0500 Subject: [PATCH] Switched from 'static const string' to 'constexpr string_view'. --- cpp/src/Slice/Parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index d216ef0ca21..72b74655a79 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -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)