I have the following two unions:
union rgb_color
{
  struct {
    float red;
    float green;
    float blue;
  };
  float raw[3];
};
union hsv_color
{
  struct {
    float hue;
    float saturation;
    float value;
  };
  float raw[3];
}
I'd like to add operator hsv_color() to rgb_color union, and operator rgb_color() to hsv_color union. Is there a way to do it? If I forward-declare hsv_color, the compiler throws the following error:
error: return type 'union hsv_color' is incomplete
The more I'm trying to implement this, the more I'm thinking I should just create two functions for conversion instead of using implicit cast operators. Still, I'd like to know if this is possible. Any suggestions?
 
     
     
    