[LLVM] Sparse set

Hi,

are the elements in a SparseSet stored in a contiguous memory region?
Looking at the implementation, seems that each element is pushed back into a SmallVector.
If so, is it possible to retrieve that data as a chunk?
For example, if I have a std::vector underneath I would use v.data().

Thanks.
Simone

Hi,

are the elements in a SparseSet stored in a contiguous memory region?

Yes, the point of the data structure is to have a sparse array for keys and a dense vector for storage.

Looking at the implementation, seems that each element is pushed back into a SmallVector.
If so, is it possible to retrieve that data as a chunk?
For example, if I have a std::vector underneath I would use v.data().

SparseSet exposes begin()/end() on the underlying dense vector. If you have a compelling use case, you could also add an API to return a reference to the dense vector.