#include <map>
#include <iostream>
using namespace std;
int main(
int argc,
const char * argv[]
)
{
if( 4 != argc ) {
cerr << "usage: " << endl
<< argv[0] << " index value1 value2" << endl;
exit(1);
}
int index = atoi(argv[1]);
int value1 = atoi(argv[2]);
int value2 = atoi(argv[3]);
multimap<int,in t> mm;
mm.insert( pair<int,int>(i ndex,value1) );
mm.insert( pair<int,int>(i ndex,value2) );
cout << "Am I guaranteed that " << mm.find(index)->second << " == "
<< value1 << "?" << endl;
return 0;
}
I have read the STL docs and I did not see this explicitly stated. 4 3226
There's no guarantee about the order of identical keys in a multimap.
Arg... that is very unfortunate. I might actually have to write some
code :(
Thanks for the info.
In article <11************ *********@g44g2 000cwa.googlegr oups.com>, sa************@ gmail.com wrote: Arg... that is very unfortunate. I might actually have to write some code :( Thanks for the info.
Fwiw, I'm trying to change this, at least partly: http://www.open-std.org/jtc1/sc22/wg...005/n1780.html
If accepted, you would have to use lower_bound instead of find, but
otherwise you would be good to go. But as James said, as it stands
today you're just out of luck as far as the standard goes.
However the above paper contains a survey of several libraries (actually
all of them (current versions) that I'm aware of), and they all
implement "insert without hint" as if they were told to "insert at
upper_bound". So from a practical standpoint you might get away with
use of lower_bound instead of find today.
-Howard
Howard, thanks so much!
This paper does all the hard work. It is sufficient for me to know that
current implementations are stable when inserting without hints. I will
just add additional unit tests to be sure it doesn't bite me when
someone changes the implementation.
Best wishes,
Salem This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jaime Wyant |
last post by:
Will someone explain this to me?
>>> "test".find("")
0
Why is the empty string found at position 0?
Thanks!
jw
|
by: David |
last post by:
Hi,
I want to do a query that displays duplicate records in the database based
on IP address. What syntax should I use in the WHERE********** bit please?
Thanks,
set rsData = con.execute("SELECT formtype, entrydate, ipaddress FROM
formdata WHERE ************ ORDER BY ipaddress")
arData = rsData.getrows
|
by: Galsaba |
last post by:
Anyone knows how I can find a script for "Find a Dealer near you" locator
script?
I prefer to have it in two stages:
1. The customer will enter his address, and then the result will be a list of
dealer in a radius of let's say 20 miles.
2. When the user clicks on the dealer's link, the result will be the exact
Driving distance.
If this is not the right forum to post this message, then, if you know which
|
by: Galsaba |
last post by:
I am trying to find a script to a "dealer locator" or "find a store near you".
I will have two tables. One will include all US and Canada ZIPs including lat
and longtitudes. The other one is a table of our dealers (or store) including
thier ZIP codes.
When the user enters his ZIP code, the application needs to check (based on the
lat and long) if there is a dealer in a 30 miles radious.
After the application finds the list of all the...
|
by: Praveen |
last post by:
In the ISPF editor I am using, for a particullar PO Dataset I am
getting the result of FIND statement narrowed down to the colums
48-56. i.e. if I give "FIND 'TO' ALL", the result I am getting as
"CHARS 'TO' - found 239 times within columns 48 to 56".
Please guide me as to how to make this PDS back to normal so that the
FIND command processes the whole 1 TO 80.
Thank you for the valuable time.
| |
by: Dmitry Jouravlev |
last post by:
Hi,
I have a number of C++ solutions in Visual Studio .NET and when i compile them using "Whole Program Optimization", certain projects report a LNK1171 error saying that c2.dll could not be loaded. The error contains the correct path to c2.dll (and it is definately there).
This only happens on some projects and only when "whole program optimization" option is turned on. If i turn off this option, the problem goes away. I have other...
|
by: Lenonardo |
last post by:
Hi.
I'm writing a VB.Net application to update multiple Excel Worksheets.
I'm using late binding (i.e. all variables are objects + use
createobject)
I develop the application on an XP machine with Excel 2002 (version 10.0)
installed - and the code works fine.
I then test the code on a laptop running Excel 2000 (version 9.0) and it
|
by: OJ |
last post by:
Hi,
I have added code to run on a button click event which adds
usercontrols to an asp:Panel control held in a contentplaceholder
defined by the masterpage.
for (int x = 0; x < (Master.PartyCtrl.Adults ); x++)
{
ASP.usercontrols_passenger_ascx passenger = new
ASP.usercontrols_passenger_ascx();
this.pnlAdults.Controls.Add(passenger);
|
by: Rave |
last post by:
This is a long shot, but I thought I'd try it. I am currently using excel as an inventory tool. I currently have a hand-held scanner plugged into a laptop for reading barcodes. Using the "Find and Replace" fuction, I scan the merchandise which then searches the spreadsheet for the matching inventory number. When it is found, I highlight that cell in yellow. After scanning and coloring all of my inventory I can then see exactly what is...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |