Multimap Question

Hello World question in cplusplus.com
I am trying to create some sort of
multimap (int, pair <string, string>);
I succeed
I wish to know how to multimap.insert an element
cplusplus.com/reference has a good example how to use multimap::insert, but not for my data structure
Can you help please?

typedef pair<string, string> strpair;
typedef pair<node, strpair> intstrpair;

int main()
{
list <intstrpair> blist;
blist.insert(blist.begin(), intstrpair(2, strpair("s", "d")));

multimap <int, intstrpair > dmap;
dmap.insert ( intstrpair <node,strpair>(2,strpair("s", "d")) );

return 0;
}

The blist.insert works well
But dmap polymorphism has different function argtypes
I tried compiling it different formats, but all lead to different errors
Thanks for helping
Last edited on
There's no polymorphism here, just the complex C++ type system.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <map>
#include <string>

int main()
{
	std::multimap<int, std::pair<std::string, std::string> > dmap;

	dmap.insert(
		std::pair<int, std::pair<std::string, std::string> >(
			25,
			std::pair<std::string, std::string>("s", "d")));

	return 0;
}

Thanks
That helped faster than expected!
Topic archived. No new replies allowed.