From e47aebcec5a0103f8ed836f1bcba50c5f198f47c Mon Sep 17 00:00:00 2001 From: Arnaud VERSINI Date: Fri, 27 Dec 2024 14:03:08 +0100 Subject: [PATCH] tools : use constexpr array instead of std::vector Change-Id: Ifade95457b4b7c614a4ec83857c822d349a9f88d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179444 Reviewed-by: Noel Grandin Tested-by: Jenkins Reviewed-by: Arnaud Versini --- tools/source/stream/GenericTypeSerializer.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/source/stream/GenericTypeSerializer.cxx b/tools/source/stream/GenericTypeSerializer.cxx index 3eefb008ea67..c946e310e6b5 100644 --- a/tools/source/stream/GenericTypeSerializer.cxx +++ b/tools/source/stream/GenericTypeSerializer.cxx @@ -48,7 +48,7 @@ void GenericTypeSerializer::readColor(Color& rColor) } else { - static const std::vector staticColorArray = { + static constexpr Color staticColorArray[] = { COL_BLACK, // COL_BLACK COL_BLUE, // COL_BLUE COL_GREEN, // COL_GREEN @@ -82,7 +82,7 @@ void GenericTypeSerializer::readColor(Color& rColor) COL_BLACK // COL_FIELDTEXT }; - if (nColorNameID < staticColorArray.size()) + if (nColorNameID < std::size(staticColorArray)) rColor = staticColorArray[nColorNameID]; else rColor = COL_BLACK;