Click here to Skip to main content
15,894,825 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: How to start the exe server in hide mode or another desktop? Pin
«_Superman_»7-Dec-09 9:27
professional«_Superman_»7-Dec-09 9:27 
GeneralRe: How to start the exe server in hide mode or another desktop? Pin
kcynic7-Dec-09 14:14
kcynic7-Dec-09 14:14 
QuestionHow to get full path of sepcied file Pin
am 20095-Dec-09 19:44
am 20095-Dec-09 19:44 
AnswerRe: How to get full path of sepcied file Pin
Jonathan Davies6-Dec-09 8:23
Jonathan Davies6-Dec-09 8:23 
QuestionI need to Resize ATL dialog based on the screen resolution Pin
Member 33037924-Dec-09 1:08
Member 33037924-Dec-09 1:08 
AnswerRe: I need to Resize ATL dialog based on the screen resolution Pin
Alain Rist21-Dec-09 13:00
Alain Rist21-Dec-09 13:00 
QuestionCreating sidebar for windows media player (similar to iTunes) Pin
smitha s4-Dec-09 0:27
smitha s4-Dec-09 0:27 
Questionre: probelms erasing a multimap entry Pin
Alan Kurlansky2-Dec-09 11:08
Alan Kurlansky2-Dec-09 11:08 
I originally posted this on the C/C++/MFC forum but should have posted it here.

This program runs fine except when I try to delete/remove/erase an item as indicated below. No matter what I've tried with erase the program crashes.
Could someone please help here.
Thanks
Alan Kurlansky

PS. When I cut and pasted some characters got changed. I hope I fixed alll of them. I didn't see the options available below.
This program runs fine except when I try to delete/remove/erase an item as indicated below.
Thanks
Alan Kurlansky

PS. When I cut and pasted some characters got changed. I hope I fixed alll of them.

// MultiMap.cpp : Defines the entry point for the console application.
//


#include <windows.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <map>
using namespace std;

void testmultimap();
#include <tchar.h>


struct ASK {
               int ival;
               string      key;
};

      multimap<string, ASK *> mymm2;
      multimap<string, ASK *>::iterator iter;
      pair<multimap<string, ASK> ::iterator,multimap<string, ASK *>::iterator> ret;

int _tmain(int argc, _TCHAR* argv[])
{
      testmultimap();
     
      return 0;
}

//----------------------------------------------------------------------------------------------------------------
void testmultimap()
{     
      string key;
     
      key.clear();
      key.append("a");
      ASK * Iptr = new ASK;     
      Iptr->ival = 10;
      Iptr->key.clear();
      Iptr->key.append(key);

      mymm2.insert(pair<string,ASK *>(key, Iptr));

      key.clear();
      key.append("a");
      Iptr = new ASK;     
      Iptr->ival = 20;
      Iptr->key.clear();
      Iptr->key.append(key);
     
      mymm2.insert(pair<string,ASK *>(key, Iptr));

      key.clear();
      key.append("b");
      Iptr = new ASK;     
      Iptr->ival = 30;
      Iptr->key.clear();
      Iptr->key.append(key);
     
      mymm2.insert(pair<string,ASK *>(key, Iptr));


     
      key.clear();
      key.append("a");
      ret = mymm2.equal_range(key);
     
      int cnt(0);
      for (iter=ret.first; iter!=ret.second; ++iter) {           
               printf("ival:%d key:[%s]\n", (*iter).second->ival,   (*iter).second->key.c_str() );           
                              // delete this single entry
                              //   mymm2.erase(????);
      }     

     
         printf("\n");

      printf("2nd pass after 'a' erase\n");
      ret = mymm2.equal_range(key);
      for (iter=ret.first; iter!=ret.second; ++iter) {
               printf("ival:%d key:[%s]\n", (*iter).second->ival,   (*iter).second->key.c_str() );     
      }
         printf("\n");


      key.clear();
      key.append("b");
      ret = mymm2.equal_range(key);
      for (iter=ret.first; iter!=ret.second; ++iter) {
               printf("ival:%d key:[%s]\n", (*iter).second->ival,   (*iter).second->key.c_str() );     
      }
         printf("\n");

}
//----------------------------------------------------------------------------------------------------------------
AnswerRe: re: probelms erasing a multimap entry [modified] Pin
kcynic2-Dec-09 18:42
kcynic2-Dec-09 18:42 
QuestionAdd event handler functions from ActiveX to VC++6.0 ATL Project Pin
jensreichert1-Dec-09 23:44
jensreichert1-Dec-09 23:44 
AnswerRe: Add event handler functions from ActiveX to VC++6.0 ATL Project Pin
Garth J Lancaster2-Dec-09 0:28
professionalGarth J Lancaster2-Dec-09 0:28 
AnswerRe: Add event handler functions from ActiveX to VC++6.0 ATL Project Pin
Garth J Lancaster2-Dec-09 0:34
professionalGarth J Lancaster2-Dec-09 0:34 
GeneralRe: Add event handler functions from ActiveX to VC++6.0 ATL Project Pin
MESCO2-Mar-10 20:26
MESCO2-Mar-10 20:26 
Questionsorting an STL list of =references= to objects Pin
kerchunk1-Dec-09 12:39
kerchunk1-Dec-09 12:39 
AnswerRe: sorting an STL list of =references= to objects Pin
kerchunk1-Dec-09 14:44
kerchunk1-Dec-09 14:44 
GeneralRe: sorting an STL list of =references= to objects Pin
Simple Inheritance1-Dec-09 16:48
Simple Inheritance1-Dec-09 16:48 
GeneralRe: sorting an STL list of =references= to objects Pin
kerchunk1-Dec-09 20:56
kerchunk1-Dec-09 20:56 
GeneralRe: sorting an STL list of =references= to objects Pin
kerchunk2-Dec-09 10:02
kerchunk2-Dec-09 10:02 
GeneralRe: sorting an STL list of =references= to objects [modified] Pin
Simple Inheritance2-Dec-09 10:48
Simple Inheritance2-Dec-09 10:48 
GeneralRe: sorting an STL list of =references= to objects Pin
kerchunk3-Dec-09 19:42
kerchunk3-Dec-09 19:42 
GeneralRe: sorting an STL list of =references= to objects Pin
Simple Inheritance4-Dec-09 10:38
Simple Inheritance4-Dec-09 10:38 
GeneralRe: sorting an STL list of =references= to objects Pin
kerchunk6-Dec-09 9:03
kerchunk6-Dec-09 9:03 
QuestionHow to get clipping region of windowless activex? Pin
smalti1-Dec-09 9:15
smalti1-Dec-09 9:15 
QuestionError on using BMP image in LoadBitmap Pin
am 200926-Nov-09 0:47
am 200926-Nov-09 0:47 
AnswerRe: Error on using BMP image in LoadBitmap Pin
KingsGambit29-Nov-09 19:16
KingsGambit29-Nov-09 19:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.