From 8d0a8ea52e7f23e29f0a59e5d42a47c5d98ec6b4 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 29 Mar 2020 08:43:15 -0400 Subject: [PATCH] SCAN: Convert file-scope std::vector into constexpr std::array Same behavior, but without any runtime heap allocations at program start. --- DataSpec/DNAMP1/SCAN.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/DataSpec/DNAMP1/SCAN.cpp b/DataSpec/DNAMP1/SCAN.cpp index beabf6a5e..c09371284 100644 --- a/DataSpec/DNAMP1/SCAN.cpp +++ b/DataSpec/DNAMP1/SCAN.cpp @@ -1,12 +1,16 @@ #include "SCAN.hpp" +#include +#include + namespace DataSpec::DNAMP1 { -static const std::vector PaneNames = { - "imagepane_pane0", "imagepane_pane1", "imagepane_pane2", "imagepane_pane3", "imagepane_pane01", - "imagepane_pane12", "imagepane_pane23", "imagepane_pane012", "imagepane_pane123", "imagepane_pane0123", - "imagepane_pane4", "imagepane_pane5", "imagepane_pane6", "imagepane_pane7", "imagepane_pane45", - "imagepane_pane56", "imagepane_pane67", "imagepane_pane456", "imagepane_pane567", "imagepane_pane4567"}; +constexpr std::array PaneNames{ + "imagepane_pane0"sv, "imagepane_pane1"sv, "imagepane_pane2"sv, "imagepane_pane3"sv, "imagepane_pane01"sv, + "imagepane_pane12"sv, "imagepane_pane23"sv, "imagepane_pane012"sv, "imagepane_pane123"sv, "imagepane_pane0123"sv, + "imagepane_pane4"sv, "imagepane_pane5"sv, "imagepane_pane6"sv, "imagepane_pane7"sv, "imagepane_pane45"sv, + "imagepane_pane56"sv, "imagepane_pane67"sv, "imagepane_pane456"sv, "imagepane_pane567"sv, "imagepane_pane4567"sv, +}; template <> void SCAN::Texture::Enumerate(typename Read::StreamT& r) {