0

I am trying find out solution according to other answer, the following link explained how to merge two key like one key with QHash.

Implementing a QHash-like lookup with multiple keys

But i would want to also get value each of key, for example

m_Lookup.insert(Vehicle(1, 100), 10);
m_Lookup.insert(Vehicle(2, 200), 20);
m_Lookup.insert(Vehicle(3, 300), 30);
m_Lookup.insert(Vehicle(3, 400), 40);
m_Lookup.insert(Vehicle(4, 500), 50);

According to above sample is it possible to get id 3's values?

id 3's values 30 and 40

Community
  • 1
  • 1
Murat
  • 1
  • 2
  • use `insetMulti` instead of `insert` – folibis Aug 04 '14 at 05:41
  • insertMulti it is not inserting multi key, it is inserting multi data related to key. If you check above sample there is two key, i want to add two key and would want to use each key in different condition. I do not want to use fuse two key. Is it clear? – Murat Aug 04 '14 at 06:24
  • Why not loop through the array to get all appropriate values? – folibis Aug 04 '14 at 08:19
  • I do not like use loop, i want to get bunch of data by QList. I know there is solution on boost like boost::multi_index. If i can improve above solution it is more elegant. – Murat Aug 04 '14 at 08:31

0 Answers0