Skip to content

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

Open
@Marc-Aldorasi-Imprivata

Description

@Marc-Aldorasi-Imprivata
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions