8

I have an std::set, which stores std::pairs of two integers. The std::set is also sorted, by allowing me to pass a helping class. However, I have written many lines of code so far and now, at the last tests, "they" told me something, that actually means that I need to allow possible duplicates in the std::set. Of course this isn't done with std::set. Any alternative that will not make me change the whole-big project?

In short, I use the std::set as an ordered list with data an std::pair of two ints.

David G
  • 94,763
  • 41
  • 167
  • 253
gsamaras
  • 71,951
  • 46
  • 188
  • 305

2 Answers2

14

You can use std::multiset. That should work for what you are describing.

Sardathrion - against SE abuse
  • 17,269
  • 27
  • 101
  • 156
R Sahu
  • 204,454
  • 14
  • 159
  • 270
7

std::multiset is the answer, as suggested by WhozCraig.

gsamaras
  • 71,951
  • 46
  • 188
  • 305