Skip to content

Add Set Algebra iterators to trait Set: Intersection, Difference, Sym. Diff, Union. #8154

Closed
@bluss

Description

@bluss

These methods exist (or used to exist) in the Set trait, and should be reintroduced when we can express methods returning iterators in a trait.

/* These are the old methods */
/// Visit the values representing the difference
fn difference(&self, other: &Self, f: &fn(&T) -> bool) -> bool;

/// Visit the values representing the symmetric difference
fn symmetric_difference(&self, other: &Self, f: &fn(&T) -> bool) -> bool;

/// Visit the values representing the intersection
fn intersection(&self, other: &Self, f: &fn(&T) -> bool) -> bool;

/// Visit the values representing the union
fn union(&self, other: &Self, f: &fn(&T) -> bool) -> bool;

Bonus points for: Allow operations across two sets with matching element types but generic Set impl.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions