I'm trying to test at compile time whether two types are equality-comparable, and I've defined operator== for them so they should be. yet, the following code does not compile:
#include <string_view>
struct A { int n; };
bool operator==(const A& a, const std::string_view s) { return a.n == s.size(); }
static_assert(std::equality_comparable_with<A, std::string_view>);
(godbolt)
I've even tried defining operator== for the opposite order as well, and for A with itself, but it won't work either.
of course, something like the following works just fine
static_assert(std::equality_comparable_with<std::string, std::string_view>);
what am I missing here?