From 96fa7af8b5321ee1fc13f645004f12b20329f1a2 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 31 Mar 2020 14:15:06 -0400 Subject: [PATCH] STRG: Convert file-scope std::vector to std::array Eliminates a runtime-static constructor and heap allocation at program start. --- DataSpec/DNAMP1/STRG.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/DataSpec/DNAMP1/STRG.cpp b/DataSpec/DNAMP1/STRG.cpp index 4a52b3b17..6acf994ba 100644 --- a/DataSpec/DNAMP1/STRG.cpp +++ b/DataSpec/DNAMP1/STRG.cpp @@ -1,10 +1,14 @@ #include "STRG.hpp" + +#include + #include "DNAMP1.hpp" namespace DataSpec::DNAMP1 { -const std::vector skLanguages = {FOURCC('ENGL'), FOURCC('FREN'), FOURCC('GERM'), FOURCC('SPAN'), - FOURCC('ITAL'), FOURCC('DUTC'), FOURCC('JAPN')}; +constexpr std::array skLanguages{ + FOURCC('ENGL'), FOURCC('FREN'), FOURCC('GERM'), FOURCC('SPAN'), FOURCC('ITAL'), FOURCC('DUTC'), FOURCC('JAPN'), +}; static uint32_t ParseTag(const char16_t* str) { char parseStr[9];