In C++, to have a tidier code, I want to declare a set of values as constants in my header file, example :
constexpr float SIZE_SMALL = 1.5f;
constexpr float SIZE_MEDIUM = 2.5f;
constexpr std::string COLOR_RED = "RED";
constexpr std::string MATERIAL_SILK = "SILK";
...etc
But this is getting too long and clumsy. Also, some constants can be grouped together because they describe different values of the same property e.g. SIZE_SMALL
and SIZE_MEDIUM
.
What is the best way to write this in my header file? I thought about structs e.g.
struct SIZE
{
float SMALL;
float MEDIUM;
}
but then I have to declare and define a variable in my .cpp and that kinda beats the purpose of all this.