I'm trying to create a Color class and some constants so I can use them like Color::Red in other parts of my code.
#ifndef COLOR_H
#define COLOR_H
#include <cstdint>
class Color
{
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
public:
Color(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
static constexpr Color Red = Color(255, 0, 0, 255);
};
#endif // COLOR_H
This code give the error:
Type Color is incomplete.
After toying around and doing a bit of researchs, the best I found would be to move Red out of the class, but then I lose the elegance of the Color:: qualifier.
Is there a better solution?
constinside the class and then use constexpr outside class.