有没有办法在 systemverilog 中使用 'map' 数组?

Is there a way to 'map' arrays in systemverilog?

我正在寻找一种优雅的方式来映射数组中的条目,而不是创建新数组的 for 循环。例如

class A;
  int int_member;
endclass

A class_container[$];
int int_members_only[$];

initial begin
  // Assume class_container is populated

  // 'map' is not an available function 
  int_members_only= class_container.map(x) with (x.int_member);

  // Yes, you can do this but I want to know if there's another way
  foreach (class_container[i_class]) begin
    int_members_only.push_back(class_container[i_class].int_member);
  end
end

SystemVerilog 中没有任何东西可以进行这种映射。与您的示例最接近的功能是流媒体运营商。 (11.4.14 Streaming operators (pack/unpack)),但这仅在 class 中只有一个成员时有效。我认为这不是您需要的一般情况。