Fix compileation with clang

The operator== must be in the same namespace as the struct for ADL to work proprerly
This commit is contained in:
Olivier Goffart 2020-11-01 16:09:42 +01:00
parent cc85aa818d
commit 356cd8c3ee

View file

@ -579,6 +579,17 @@ Flickable::~Flickable()
sixtyfps_flickable_data_free(&data); sixtyfps_flickable_data_free(&data);
} }
using cbindgen_private::StandardListViewItem;
namespace cbindgen_private {
bool operator==(const StandardListViewItem &a, const StandardListViewItem &b) {
static_assert(sizeof(StandardListViewItem) == sizeof(std::tuple<SharedString>), "must update to cover all fields");
return a.text == b.text;
}
bool operator!=(const StandardListViewItem &a, const StandardListViewItem &b) {
return !(a == b);
}
}
namespace private_api { namespace private_api {
template<int Major, int Minor, int Patch> template<int Major, int Minor, int Patch>
struct VersionCheckHelper struct VersionCheckHelper
@ -586,14 +597,4 @@ struct VersionCheckHelper
}; };
} }
using cbindgen_private::StandardListViewItem;
bool operator==(const StandardListViewItem &a, const StandardListViewItem &b) {
static_assert(sizeof(StandardListViewItem) == sizeof(std::tuple<SharedString>), "This should be updated if there are more fields");
return a.text == b.text;
}
bool operator!=(const StandardListViewItem &a, const StandardListViewItem &b) {
return !(a == b);
}
} // namespace sixtyfps } // namespace sixtyfps