In C++ 20 we are able let the compiler automatically generate the implementation for operator== for us like this (and all the other default comparasions too, but I'm just interested in operator== here):
#include <compare>
struct Point {
int x;
int y;
bool operator==(const Point&) const = default;
};
Is there a way to archieve the same (automatically generate operator==) but in C++17?
Since libraries are an okay solution I had a look at boost/operators. Would the following be the equivalent as the above?
#include <boost/operators.hpp>
struct Point : boost<equality_comparable<Point, Point>> {
int x;
int y;
bool operator==(const Point&) const; // will this get auto-generated too and do the same as above?
};