Status & Roadmap
Authors & License
Funding Ultimate++
Search on this site
Search in forums

SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » C++ language problems and code snippets » STL multimap
STL multimap [message #17438] Fri, 15 August 2008 00:40 Go to next message
Indio is currently offline  Indio
Messages: 8
Registered: January 2008
Location: Hungary
Promising Member

First of all, I'm using the version upp-mingw-712-dev1. I know that is not the latest, but I guess the thing, I ask about here should work there too.

I have to use STL and not NTL for a reason.

I want to use multimap. If I do the usual stuff:
#include <map>
std::multimap<int, double> mm;

This is a simple insert operation:
mm.insert( pair<int, double>(5, 5.0) );

Then I receive the following error message:
D:\MyApps\skeleton\MainWindow.cpp:386: error: `pair' undeclared (first use this function)
D:\MyApps\skeleton\MainWindow.cpp:386: error: (Each undeclared identifier is reported only once for each function it
	 appears in.)
D:\MyApps\skeleton\MainWindow.cpp:386: error: expected primary-expression before "int"
D:\MyApps\skeleton\MainWindow.cpp:386: error: expected primary-expression before "double"

It should work. Syntactically it is good. I tested it under MSVS2008. But what can be problem here?
Thx in advance!
Re: STL multimap [message #17439 is a reply to message #17438] Fri, 15 August 2008 00:47 Go to previous message
cbpporter is currently offline  cbpporter
Messages: 1400
Registered: September 2007
Ultimate Contributor
Try using std::pair:
mm.insert( std::pair<int, double>(5, 5.0) );
Previous Topic: THISBACK and function-overloading
Next Topic: Time for little quiz!
Goto Forum:

Current Time: Thu Jan 28 02:34:45 CET 2021

Total time taken to generate the page: 0.01288 seconds