Skip to content

A core trait for shallow/pointer equality #4012

Closed
@bstrie

Description

@bstrie
< Dzmitry> I have 2 pointers to a shared structure (@). How do I know it's the
           same structure?
< Dzmitry> comparing this pointers issues a compile error saying that @Eq is not
           implemented for the structure
<@pcwalton> Dzmitry: box::ptr_eq
<@pcwalton> Eq is deep
<@pcwalton> there is a separate method for it
<@pcwalton> "it" == shallow comparison
< Dzmitry> pcwalton: interesting. But what if my pointers are wrapped in
           Option<>, can I compare two options by ptr_eq?
<@pcwalton> no, you can't at the moment
<@pcwalton> probably PtrEq or ShallowEq should be a trait like Eq
<@pcwalton> and then implemented on Option<T>

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.P-lowLow priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions