Inspired in https://stackoverflow.com/a/37413361/1734357 I wish to make a string color lookup table of a fixed and known size, so I shouldn't need to template it, but string isn't constexpr
How to go about it?
struct Colors
{
constexpr Colors() : colors()
{
for (size_t i = 0; i < 256; i++)
colors[i] = "0;" + to_string(i) + ";255";
for (size_t i = 0; i < 256; i++)
colors[256 + i] = "0;255;" + to_string(255 - i);
for (size_t i = 0; i < 256; i++)
colors[2 * 256 + i] = to_string(i) + ";255;0";
for (size_t i = 0; i < 256; i++)
colors[3 * 256 + i] = "255;" + to_string(255 - i) + ";0";
}
string colors[4*256];
};