Questions tagged [multimap]

A container similar to a map but allowing duplicate keys

Use this tag for questions about associative arrays with non-unique keys, such as the std::multimap container in the C++ standard library, or scala.collection.mutable.MultiMap in Scala.

See the Wikipedia article for more information.

773 questions
0
votes
1 answer

Multi map insert

I am trying to pass 6 values instead of a value. //function that contains the value siteNEVObjectdic::siteNEVObjectdic(double iLat1, double iLong1, double iLat2, double iLong2, double iLat3, double iLong3) { Lat1=iLat1; Long1=iLong1; …
0
votes
1 answer

How do you create a vector of pairs from a subset of a multimap?

I have a pair of iterators returned from a multimap equal_range call. I wish to use these to create a subset in the form of a vector of pairs. Can this be done elegantly please? The reason I want it as a vector is so I can more easily extract data…
pingu
  • 8,719
  • 12
  • 50
  • 84
0
votes
1 answer

Evaluate rules against a multimap using MVEL

Just wondering how can I evaluate rules against a multimap using MVEL. I.e: rule-> "foo" == "200" Possible values of foo in the context [100, 200, 300]. I don't know which are going to be the possible values so I can't include them as part of the…
cnunezre
  • 1
  • 3
0
votes
1 answer

How to accumulate struct as value type in multimap?

I have a multimap with string as key and Cnode struct as the value: struct Cnode { Cnode() : wtA(0), wtC(0), wtG(0), wtT(0) { } Cnode(int newA, int newC, int newG, int newT) : wtA(newA), wtC(newC), wtG(newG), wtT(newT) { } int…
snazziii
  • 471
  • 2
  • 10
  • 23
0
votes
3 answers

c++ hash_multimap how to get the values

This is probably really simple, but I can't find a simple example for it. I understand that with a hash_multimap you can have several values mapped to a single key. But how exactly would I access those values. All the examples I stumbled across…
Taura J Greig
  • 105
  • 2
  • 7
0
votes
1 answer

Filter strange C++ multimap values

I have this multimap in my code: multimap noteList; // notes are added with this method. measureNumber is minimum `1` and doesn't go very high void Track::addNote(Note ¬e) { long key = note.measureNumber * 1000000 +…
user393964
0
votes
2 answers

C++ multimap causing slow program exit?

I have a program that reads data from a .csv and creates a multimap. I've pasted a simple version below. It works fine, but runs really slowly on exit (i.e., once the program prints out the output and gets to return 0;. I'm working relatively big…
rjf
  • 1,007
  • 3
  • 13
  • 19
0
votes
1 answer

Getting values in Multimaps - Guava

I use Guava library. Is there any way to get in Multimap in each value? For example, The value is 1=[stack], 2=[over, flow], 3=[com] in Multimap. If Multimap name is map and key is 2, map.get("2") will appear [over, flow]. I want to get only "flow".…
pamiers
  • 355
  • 1
  • 3
  • 11
0
votes
4 answers

multimap::erase() standard behaviour?

I've been comparing documentation for the multimap::erase function. After checking out Josuttis and cplusplus.com, it looks as though there are three overloads: void erase(iterator position); size_type erase(const key_type& x); void erase(iterator…
WalderFrey
  • 575
  • 2
  • 17
0
votes
2 answers

Insertion into pair that is mapped value in multimap in C++

Found this Multimap containing pairs?, but it is not much help How would I insert two strings into pair? Below, my two failed attempts. multimap > mymm; mymm["Alex"] = std::pair<"000","000">;…
newprint
  • 6,936
  • 13
  • 67
  • 109
0
votes
3 answers

Stl multimap - how to get the list of values of all keys in the multimap

Possible Duplicate: stl::multimap - how do i get groups of data? What i want to do is to compute the list of values of every key stored in the multimap.
Marco Masci
  • 818
  • 10
  • 22
0
votes
1 answer

Equal keys function in boost::unordered_multimap: Is the query key guaranteed to be the first arg?

I have a boost::unordered_multimap< std::vector, float>. The keys that I use to query the multimap may contain additional 0 ints that I'd like to ignore (but the keys inserted in the map never contain 0). Example: int main() { typedef…
Frank
  • 64,140
  • 93
  • 237
  • 324
0
votes
2 answers

std::multimap error when calling end()

How can I check if an element of a multimap exists? With this code: typedef std::multimap TagVal; TagVal tv; //... add values to tv ... TagVal::const_iterator it = tv.find("abc"); if(it == TagVal::end()) // <--- ERROR …
Pietro
  • 12,086
  • 26
  • 100
  • 193
0
votes
1 answer

Inserting values into a vector of multimap

I have this structure based multimap and a vector for this structure: typedef std::multimap tr; vector transitions; I want to fill the array with values ​​like: 0 0 a 0 1 a 1 1 b 1 2 c 1 3 c which represent the transitions of an…
franvergara66
  • 10,524
  • 20
  • 59
  • 101
-1
votes
1 answer

Why can't IDE find the map I declared already in Guava Multimap using Enum?

English is not my first language. Sorry in advance if there's something unclear. I'm working on a college assignment using Enum and Google Guava Multimap. In my previous assignment(which is almost the same as the one I'm working on), I wrote down a…
Jun
  • 13
  • 5