diff --git a/src/utils.cpp b/src/utils.cpp index 1723ab23..22904d20 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -2,6 +2,7 @@ // Copyright (c) 2009-2022, Intel Corporation // written by Andrey Semin and many others +#include #include #include #include @@ -125,18 +126,24 @@ const char * setColor (const char * colorStr) return colorEnabled ? colorStr : ""; } -std::vector colorTable = { - ASCII_GREEN, - ASCII_YELLOW, - ASCII_MAGENTA, - ASCII_CYAN, - ASCII_BRIGHT_GREEN, - ASCII_BRIGHT_YELLOW, - ASCII_BRIGHT_BLUE, - ASCII_BRIGHT_MAGENTA, - ASCII_BRIGHT_CYAN, - ASCII_BRIGHT_WHITE -}; +template +constexpr auto make_array(N&&... args) -> std::array +{ + return {std::forward(args)...}; +} + +constexpr auto colorTable{make_array( + ASCII_GREEN, + ASCII_YELLOW, + ASCII_MAGENTA, + ASCII_CYAN, + ASCII_BRIGHT_GREEN, + ASCII_BRIGHT_YELLOW, + ASCII_BRIGHT_BLUE, + ASCII_BRIGHT_MAGENTA, + ASCII_BRIGHT_CYAN, + ASCII_BRIGHT_WHITE +)}; size_t currentColor = 0; const char * setNextColor()