I’ve been having problems with getting multimap to work. I’ll just show the code and describe the problem:
#include <string>
...
multimap<std::string, pinDelayElement> arcList
pinDelayElement pde;
std:string mystring = "test"
arcList[mystring] = pde;
However, when I compile, the last line gives me the following error:
error C2676: binary ‘[‘ : ‘std::multimap<_Kty,_Ty>’ does not define this operator or a conversion to a type acceptable to the predefined operator
with
[
_Kty=std::string,
_Ty=Psdfwr::pinDelayElement
]
Does anyone know something I might be doing wrong?
The code below is an example of how to do it properly.
As others pointed out, std::multimap doesn’t have the indexing
operator[]because it makes no sense to extract elements out of it — there are multiple values per each index.You must
insertamultimap<...>::value_type.