1

I need to refer to a value after inserting it into set. However after inserting the container becomes the owner of the element and I can no longer refer to it. Is this achievable without updating the containers API?

Ideally I'm looking for some function with the following signature:

fn insert_referring<A>(set: &mut HashSet<A>, element: A) -> &A
Nikita Volkov
  • 42,792
  • 11
  • 94
  • 169

0 Answers0