How to find all indices of an associative array

In reply to dave_59:

I get compile error, if I declare


warp_id_t          index_q[$];

Incompatible complex type assignment
  Type of source expression is incompatible with type of target expression. 
  Mismatching types cannot be used in assignments, initializations and 
  instantiations. The type of the target is 'bit[3:0]$[$]', while the type of 
  the source is 'int$[$]'.
  Source Expression: in_use.unique

on the other hand, if i change the declaration to,


int          index_q[$];

I get a different result than what is expected,

size of index_q : 1
Listing elements in index_q[0] : 1

Now, what I don’t understand the reason for the compile error as returned indices is of type warp_id_t, and it does work with your earlier proposed solution of find_index with (1).

after changing the type to int, the result doesn’t make sense.

can you please explain ?