Fix unique_index method on assoc arrays with values differing from the keys (#7616)
Signed-off-by: Pawel Klopotek <pklopotek@internships.antmicro.com>
This commit is contained in:
parent
662cd43348
commit
efdc8d1cbf
|
|
@ -218,6 +218,7 @@ Paul Bowen-Huggett
|
|||
Paul Swirhun
|
||||
Paul Wright
|
||||
Pawel Jewstafjew
|
||||
Pawel Klopotek
|
||||
Pawel Kojma
|
||||
Pawel Sagan
|
||||
Pengcheng Xu
|
||||
|
|
|
|||
|
|
@ -1090,7 +1090,7 @@ public:
|
|||
}
|
||||
VlQueue<T_Key> unique_index() const {
|
||||
VlQueue<T_Key> out;
|
||||
std::set<T_Key> saw;
|
||||
std::set<T_Value> saw;
|
||||
for (const auto& i : m_map) {
|
||||
auto it = saw.find(i.second);
|
||||
if (it == saw.end()) {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ module t;
|
|||
int qv[$]; // Value returns
|
||||
int qi[$]; // Index returns
|
||||
point points_q[int];
|
||||
point points_qe[int]; // Empty points
|
||||
point points_qv[$];
|
||||
int i;
|
||||
bit b;
|
||||
|
|
@ -58,6 +59,12 @@ module t;
|
|||
qi.sort;
|
||||
`checkp(qi, "'{'h0, 'h1, 'h5}");
|
||||
|
||||
qi = points_qe.unique_index();
|
||||
`checkp(qi, "'{}");
|
||||
|
||||
qi = points_q.unique_index();
|
||||
`checkh(qi.size, 3);
|
||||
|
||||
qi = points_q.find_first_index with (item.x == 1);
|
||||
`checkp(qi, "'{'h0}");
|
||||
qi = points_q.find_first_index with (item.x == 10);
|
||||
|
|
|
|||
Loading…
Reference in New Issue