Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using MSVC, collections always require their element type to be comparable #405

Open
Marc-Aldorasi-Imprivata opened this issue Dec 5, 2023 · 0 comments

Comments

@Marc-Aldorasi-Imprivata
Copy link

struct elem;
//bool operator==(const elem &, const elem &);
struct container {
    const elem *begin() const;
    const elem *end() const;
};
bool operator==(const container &, const container &);
std::ostream &operator<<(std::ostream &, const container &);

void foo(container &c)
{
    BOOST_TEST(c == c);
}

This fails to compile in MSVC unless the operator== declaration on the second line is uncommented. That operator does not need to be defined because it is never actually used, but MSVC will complain about its absence if it is not declared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant