I am trying to overload == and != inside a struct called vector2:
struct vector2
{
    float x, y;
    vector2(float newX, float newY)
        : x(newX), y(newY) {}
    bool operator==(const vector2& other) const
    {
        return (*this == other);
    }
    bool operator!=(const vector2& other) const
    {
        return !(*this == other);
    }
};
void main()
{
    vector2 position(5.0, 7.6);
    vector2 speed(1.1, 3.2);
    std::cout << (position == speed) << std::endl;
}
The == overload doesn't compile and I get unhandled exception error.
Unhandled exception at 0x00898E79 in ConsoleApplication1.exe: 0xC00000FD: Stack overflow (parameters: 0x00000001, 0x01082FDC).
User contributions licensed under CC BY-SA 3.0