Is there sample code for having a HashMap, which maps to struct instances on the Heap?

I do find code samples how to map to integers. But in practice it is very likely to map struct instances on the heap. And so is my current problem.

Is there any documentation how to do that? Is there any sample code showing how to do that? Is there sample code, which shows how to do that in a thread-safe way?

If T is the type of your struct, then instead of an integer use T* (the pointer to your struct) as data type.

There is a three part article on Hash Maps that talks about concurrency in the last part.

2 Likes

If T is the type of your struct, then instead of an integer use T* (the pointer to your struct) as data type.

Thank you. I bet that’ll solve the problems I have. I was not able to take this from the documentation.

I will carefully read.