Skip to content

Implement AsRef for casting to superclasses #592

Open
@adetaylor

Description

@adetaylor

If you have a reference b_ref: &B, and B is a subclass of A, it would sometimes be useful to have an &A in order to pass into APIs which expect a &A. Experiments suggest that this is ergonomic using AsRef, at least for constant references (not so much for pinned mutable references).

Metadata

Metadata

Assignees

No one assigned

    Labels

    cpp-featureC++ feature not yet supported

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions