I would like to define the size of a multidimensional array as a constant. What would be the best way to do this please? In the example below, MY_CONSTANT would be equal to 2. Can this constant be determined before run time?
#define MY_CONSTANT <what goes here?>
std::string myArray[][3] = {
{"test", "test", "test"},
{"test", "test", "test"}
};
const std::size_t array_size = 2;? BTW, preferstd::arraywhen you have constant size array, elsestd::vector(orstd::deque).constvariables to#define. They can be used as compile-time constants, and also respect scope.