473,545 Members | 2,115 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

multimap insert survey

I recently asked for a survey of multimap insert with hint behavior, in
support of a paper I'm writing concerning lwg issue 233. My sincere
thanks to Beman Dawes, Raoul Gough, Russell Hind, Bronek Kozicki, Nicola
Musatti, John Potter and Maxim Yegorushkin for helping with that survey.

Since I started work on this paper at least two people I respect very
much have expressed interest in nailing down the "insert without hint"
function a little better. And so in the interest of addressing this
concern, I would like to conduct yet another survey. And thanks again
for any assistance you can provide. I would like to know what the
following program produces for various std::lib implementations :

#include <map>
#include <string>
#include <iostream>
#include <utility>

template <class Map>
void
display(const Map& m)
{
for (typename Map::const_iter ator i = m.begin(), e = m.end(); i !=
e; ++i)
std::cout << '(' << i->first << ", " << i->second << ") ";
std::cout << '\n';
}

int main()
{
typedef std::multimap<i nt, std::string> Map;
typedef std::pair<int, std::string> value_type;
Map m;
m.insert(value_ type(3, "three"));
m.insert(value_ type(3, "threE"));
m.insert(value_ type(3, "thrEe"));
m.insert(value_ type(3, "thrEE"));
m.insert(value_ type(3, "thRee"));
m.insert(value_ type(3, "thReE"));
m.insert(value_ type(3, "thREe"));
m.insert(value_ type(3, "thREE"));
m.insert(value_ type(3, "tHree"));
m.insert(value_ type(3, "tHreE"));
m.insert(value_ type(3, "tHrEe"));
m.insert(value_ type(3, "tHrEE"));
m.insert(value_ type(3, "tHRee"));
m.insert(value_ type(3, "tHReE"));
m.insert(value_ type(3, "tHREe"));
m.insert(value_ type(3, "tHREE"));
m.insert(value_ type(3, "Three"));
m.insert(value_ type(3, "ThreE"));
m.insert(value_ type(3, "ThrEe"));
m.insert(value_ type(3, "ThrEE"));
m.insert(value_ type(3, "ThRee"));
m.insert(value_ type(3, "ThReE"));
m.insert(value_ type(3, "ThREe"));
m.insert(value_ type(3, "ThREE"));
m.insert(value_ type(3, "THree"));
m.insert(value_ type(3, "THreE"));
m.insert(value_ type(3, "THrEe"));
m.insert(value_ type(3, "THrEE"));
m.insert(value_ type(3, "THRee"));
m.insert(value_ type(3, "THReE"));
m.insert(value_ type(3, "THREe"));
m.insert(value_ type(3, "THREE"));
display(m);
}

Metrowerks produces:

(3, three) (3, threE) (3, thrEe) (3, thrEE) (3, thRee) (3, thReE) (3,
thREe) (3, thREE) (3, tHree) (3, tHreE) (3, tHrEe) (3, tHrEE) (3, tHRee)
(3, tHReE) (3, tHREe) (3, tHREE) (3, Three) (3, ThreE) (3, ThrEe) (3,
ThrEE) (3, ThRee) (3, ThReE) (3, ThREe) (3, ThREE) (3, THree) (3, THreE)
(3, THrEe) (3, THrEE) (3, THRee) (3, THReE) (3, THREe) (3, THREE)

Thanks,
Howard
Jul 23 '05 #1
3 2503
Howard Hinnant wrote:

[ ... ]
I would like to know what the following program produces for various
std::lib implementations :


[ code elided ... ]

VC++ 7.1 stock library:

(3, three) (3, threE) (3, thrEe) (3, thrEE) (3, thRee) (3, thReE)
(3, thREe) (3, thREE) (3, tHree) (3, tHreE) (3, tHrEe) (3, tHrEE)
(3, tHRee) (3, tHReE) (3, tHREe) (3, tHREE) (3, Three) (3, ThreE)
(3, ThrEe) (3, ThrEE) (3, ThRee) (3, ThReE) (3, ThREe) (3, ThREE)
(3, THree) (3, THreE) (3, THrEe) (3, THrEE) (3, THRee) (3, THReE)
(3, THREe) (3, THREE)

VC++ 8.0 Beta 1 stock library:

(3, three) (3, threE) (3, thrEe) (3, thrEE) (3, thRee) (3, thReE)
(3, thREe) (3, thREE) (3, tHree) (3, tHreE) (3, tHrEe) (3, tHrEE)
(3, tHRee) (3, tHReE) (3, tHREe) (3, tHREE) (3, Three) (3, ThreE)
(3, ThrEe) (3, ThrEE) (3, ThRee) (3, ThReE) (3, ThREe) (3, ThREE)
(3, THree) (3, THreE) (3, THrEe) (3, THrEE) (3, THRee) (3, THReE)
(3, THREe) (3, THREE)

libcomo V31 (with Comaeu 4.3.3):

(3, three) (3, threE) (3, thrEe) (3, thrEE) (3, thRee) (3, thReE)
(3, thREe) (3, thREE) (3, tHree) (3, tHreE) (3, tHrEe) (3, tHrEE)
(3, tHRee) (3, tHReE) (3, tHREe) (3, tHREE) (3, Three) (3, ThreE)
(3, ThrEe) (3, ThrEE) (3, ThRee) (3, ThReE) (3, ThREe) (3, ThREE)
(3, THree) (3, THreE) (3, THrEe) (3, THrEE) (3, THRee) (3, THReE)
(3, THREe) (3, THREE)

The stock library for Borland C++ 5.5:

(3, three) (3, threE) (3, thrEe) (3, thrEE) (3, thRee) (3, thReE)
(3, thREe) (3, thREE) (3, tHree) (3, tHreE) (3, tHrEe) (3, tHrEE)
(3, tHRee) (3, tHReE) (3, tHREe) (3, tHREE) (3, Three) (3, ThreE)
(3, ThrEe) (3, ThrEE) (3, ThRee) (3, ThReE) (3, ThREe) (3, ThREE)
(3, THree) (3, THreE) (3, THrEe) (3, THrEE) (3, THRee) (3, THReE)
(3, THREe) (3, THREE)

STLPort 4.5.3 (with BCC 5.5):

(3, three) (3, threE) (3, thrEe) (3, thrEE) (3, thRee) (3, thReE)
(3, thREe) (3, thREE) (3, tHree) (3, tHreE) (3, tHrEe) (3, tHrEE)
(3, tHRee) (3, tHReE) (3, tHREe) (3, tHREE) (3, Three) (3, ThreE)
(3, ThrEe) (3, ThrEE) (3, ThRee) (3, ThReE) (3, ThREe) (3, ThREE)
(3, THree) (3, THreE) (3, THrEe) (3, THrEE) (3, THRee) (3, THReE)
(3, THREe) (3, THREE)

The stock library for MinGW 3.4.2:

(3, three) (3, threE) (3, thrEe) (3, thrEE) (3, thRee) (3, thReE)
(3, thREe) (3, thREE) (3, tHree) (3, tHreE) (3, tHrEe) (3, tHrEE)
(3, tHRee) (3, tHReE) (3, tHREe) (3, tHREE) (3, Three) (3, ThreE)
(3, ThrEe) (3, ThrEE) (3, ThRee) (3, ThReE) (3, ThREe) (3, ThREE)
(3, THree) (3, THreE) (3, THrEe) (3, THrEE) (3, THRee) (3, THReE)
(3, THREe) (3, THREE)

--
Later,
Jerry.

The universe is a figment of its own imagination.

Jul 23 '05 #2
In article <hi************ *************** @syrcnyrdrs-03-ge0.nyroc.rr.co m>,
Howard Hinnant <hi*****@metrow erks.com> wrote:
Metrowerks produces:

(3, three) (3, threE) (3, thrEe) (3, thrEE) (3, thRee) (3, thReE) (3,
thREe) (3, thREE) (3, tHree) (3, tHreE) (3, tHrEe) (3, tHrEE) (3, tHRee)
(3, tHReE) (3, tHREe) (3, tHREE) (3, Three) (3, ThreE) (3, ThrEe) (3,
ThrEE) (3, ThRee) (3, ThReE) (3, ThREe) (3, ThREE) (3, THree) (3, THreE)
(3, THrEe) (3, THrEE) (3, THRee) (3, THReE) (3, THREe) (3, THREE)


Sun Studio 10, compiled with -library=stlport 4 produces:

(3, three) (3, threE) (3, thrEe) (3, thrEE) (3, thRee) (3, thReE) (3, thREe) (3, thREE) (3, tHree) (3, tHreE) (3, tHrEe) (3, tHrEE) (3, tHRee) (3, tHReE) (3, tHREe) (3, tHREE) (3, Three) (3, ThreE) (3, ThrEe) (3, ThrEE) (3, ThRee) (3, ThReE) (3, ThREe) (3, ThREE) (3, THree) (3, THreE) (3, THrEe) (3, THrEE) (3, THRee) (3, THReE) (3, THREe) (3, THREE)
Jul 23 '05 #3
Howard Hinnant wrote:
<snip>
for any assistance you can provide. I would like to know what the
following program produces for various std::lib implementations :

<snip>

Linux (SuSE Pro v9.2 32 bit)
GNU g++ (GCC) 3.3.4 (pre 3.3.5 20040809)
GNU libstdc++-3.3.4-11

(3, three) (3, threE) (3, thrEe) (3, thrEE) (3, thRee) (3, thReE)
(3, thREe) (3, thREE) (3, tHree) (3, tHreE) (3, tHrEe) (3, tHrEE)
(3, tHRee) (3, tHReE) (3, tHREe) (3, tHREE) (3, Three) (3, ThreE)
(3, ThrEe) (3, ThrEE) (3, ThRee) (3, ThReE) (3, ThREe) (3, ThREE)
(3, THree) (3, THreE) (3, THrEe) (3, THrEE) (3, THRee) (3, THReE)
(3, THREe) (3, THREE)

Regards,
Larry

--
Anti-spam address, change each 'X' to '.' to reply directly.
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
13428
by: Tanguy Fautré | last post by:
Hello, does std::multimap make any guarantee about the insertion order? for example: int main() { std::multimap<int, int> Map;
9
7855
by: Dennis Jones | last post by:
Hi, Is there a way to iterate through a multimap in such a way as to encounter only the unique keys? In other words, since a multimap allows duplicate keys, I would like to iterate through the entire multimap, and if a particular key has duplicates, only see one of them. I don't think I care about which of the duplicate entries I see,...
3
6288
by: He Shiming | last post by:
Hi Folks, Happy holidays! I have a question regarding STL multimap. Basically, the current multimap<int,int> look like this: key=>value 1=>10, 1=>20, 1=>30,
4
3219
by: salem.ganzhorn | last post by:
#include <map> #include <iostream> using namespace std; int main( int argc, const char * argv ) {
3
8164
by: francois.chartrand | last post by:
Hi, I would like to know if there is a way to locate a specific pair in a multimap ? Example: std::multimap<int,int> myMap; std::multimap<int,int>::iterator myMapIterator;
4
4488
by: Nick Keighley | last post by:
Hi, I've checked out various documentation for multimap but can't find anywhere it explicitly stated that insert() invalidates multimap iterators. consider this pseudo code:- int DataItem::genDerived () {
6
9005
by: reppisch | last post by:
Hi Ng, I have a multiset for keeping elements sorted in a container but key values may also be equal. Is there any guaranteed traversal order within the duplicate keys of a multimap? When inserting duplicate keys to the multiset i need output order to be in insert order.
1
2697
by: Saile | last post by:
I want to give an array the values from the specific multimap's key's values. multimap<string,int> mymultimap; multimap<string,int>::iterator it; pair<multimap<string,int>::iterator,multimap<string,int>::iterator> ret; mymultimap.insert (pair<string,int>("test",10)); mymultimap.insert (pair<string,int>("test",20)); mymultimap.insert...
1
2219
by: ambarish.mitra | last post by:
Hi all, I have a multimap, where key is an int and the value is a class. I can insert into the multimap, but finding it difficult to retrieve the value when keys match. I can do this with primitive types (int/char etc). Example: class A {
0
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7808
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5329
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4945
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3443
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1884
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1014
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
704
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.