Example:
std::array<float, 3> vec;
We can do ...
vec = {1.1, 1.2, 1.3};
Why can't we also do the following, for comparison?
vec == {1.1, 1.2, 1.3}
Instead, it appears that we have to do ...
vec == std::array<float, 3>({1.1, 1.2, 1.3})
... or something similar.
Typedef'ing allows me to do something like ...
typedef std::array<float, 3> vector;
vec == vector({1.1, 1.2, 1.3})
But is there a way to just do ... ?
vec == {1.1, 1.2, 1.3}
Can I overload operator==
to accomplish this? It would seem that the compiler should know to interpret {1.1, 1.2, 1.3}
as whatever is on the left side of the ==
. It does it for =
. Why not for ==
?