How can I resolve the ambiguous call between these two in C++?
Color(int, int, int)
Color(float, float, float)
It is both ambiguous when the values are hardcoded i.e. Color(1, 2, 3)
and when they are variables Color(r, g, b)
. Why wouldn't the compiler resolve according to data type? In variable form?
EDIT: Sorry, too much C++ makes me forget there's a other languages. And there is not much "full code" that was all about it.
float x, y, z;
int r, g, b;
Color(1, 2, 3); // ambiguous
Color(1.0, 2.0, 3.0); // ambiguous
Color(r, g, b); // ambiguous <--- this one is a real pain
Color((int)r, (int)g, (int)b); // ambiguous
Color(x, y, z); //OK
Color(1u, 2u, 3u); //OK
Color(1.0f, 2.0f, 3.0f); //OK