Imagine I have to instantiate a bunch of values at compile time that will be used to instantiate a class template, for example:
constexpr static std::array ints { 1, 2, 3, 4, 5 }; constexpr static std::array bools { true, false, true, false }; template<std::array, std::array> class MyClass; If I would want to optimize the usage of the MyClass template with regards to compile time, would it be better for me to use constexpr static arrays or constexpr arrays? Is there a difference in output code size or compile time depending on whether or not the arrays are declared static?
staticexplicitly, the arrays will be automatically static. See Difference between constexpr and static constexpr global variableinline constexprif their definition is to be visible from multiple files.