Skip to content

FuzzyNum example in std::cmp documentation seems to violate PartialEq requirements #24173

Closed
@niconii

Description

@niconii

In the documentation for PartialEq, it mentions that the equality must be symmetric (a == b implies b == a) and transitive (a == b and b == c implies a == c) to satisfy the partial equivalence relation.

However, in std::cmp's documentation, it gives a PartialEq example for a FuzzyNum struct, but this does not appear to be transitive. For example, the fuzzy numbers 20 and 24 are equal, 24 and 28 are equal, but 20 and 28 are not equal.

Is there something I'm missing here, or should the example be rewritten?

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