Click here to Skip to main content
15,902,777 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questiondictionary, bag ..., what is that? Pin
includeh1012-Jul-02 2:12
includeh1012-Jul-02 2:12 
AnswerRe: dictionary, bag ..., what is that? Pin
Chris Losinger12-Jul-02 3:18
professionalChris Losinger12-Jul-02 3:18 
GeneralRe: dictionary, bag ..., what is that? Pin
includeh1012-Jul-02 3:24
includeh1012-Jul-02 3:24 
GeneralRe: dictionary, bag ..., what is that? Pin
Chris Losinger12-Jul-02 3:26
professionalChris Losinger12-Jul-02 3:26 
AnswerRe: dictionary, bag ..., what is that? Pin
Alexandru Savescu12-Jul-02 6:40
Alexandru Savescu12-Jul-02 6:40 
GeneralCOleDispatchDriver Pin
AJ12312-Jul-02 1:09
AJ12312-Jul-02 1:09 
GeneralRe: COleDispatchDriver Pin
AJ12312-Jul-02 5:47
AJ12312-Jul-02 5:47 
GeneralProblems iterating through a std::map Pin
Alexandru Savescu12-Jul-02 0:46
Alexandru Savescu12-Jul-02 0:46 
I have a class in DLL and a derived class in another dll. The first class contains a std::map <int, CString> that is populated in a method of its class.
After the map is filled, iterating throgh it in the base class works fine.

In the second dll I do this:
1. Call the method from the first class to fill the map. It works fine, I can iterate through the map like for (it = mymap.begin(); it!= mymap.end(); it++)

2. Now I am back in the second dll (of the derived class). And I use the same code to iterate through the map. The first element of the map is displayed correctly. Troubles occour when getting to the second element (i.e. when doing it++)

I have checked to see if the map has not been damaged accross dlls. This is not the case (all the pointers are the same and point to the same data - the _Right, _Left, _Value structures point to the same addresses in the first and second dll.

The problems seems to be in the _Inc member function
void _Inc()
  {if (_Right(_Ptr) != _Nil)
    _Ptr = _Min(_Right(_Ptr));
   else
      {_Nodeptr _P;
         while (_Ptr == _Right(_P = _Parent(_Ptr)))
           _Ptr = _P;
         if (_Right(_Ptr) != _P)
          _Ptr = _P; }}


The first element of the map is a leaf (it's the lowest) in the tree so the execution should go on the else branch, right? Smile | :)

In the first dll, _Right(_Ptr) is different from _Nil and, so the execution goes on the else branch, but in the second dll (of the derived class) it says they have the same value although I have checked _Right (_Ptr) returns the same value in both cases.

Any idea, CG, Joaquin and other STL gurus, please help!!!

Best regards,
Alexandru Savescu
GeneralRe: Problems iterating through a std::map Pin
Christian Graus12-Jul-02 1:06
protectorChristian Graus12-Jul-02 1:06 
GeneralRe: Problems iterating through a std::map Pin
Alexandru Savescu12-Jul-02 1:14
Alexandru Savescu12-Jul-02 1:14 
GeneralRe: Problems iterating through a std::map Pin
Alexandru Savescu12-Jul-02 4:02
Alexandru Savescu12-Jul-02 4:02 
GeneralRe: Problems iterating through a std::map Pin
Christian Graus12-Jul-02 13:01
protectorChristian Graus12-Jul-02 13:01 
GeneralRe: Problems iterating through a std::map Pin
Alexandru Savescu12-Jul-02 5:31
Alexandru Savescu12-Jul-02 5:31 
Generallibrary for printing pdf's Pin
Bernhard12-Jul-02 0:30
Bernhard12-Jul-02 0:30 
GeneralRe: library for printing pdf's Pin
Roger Allen12-Jul-02 1:53
Roger Allen12-Jul-02 1:53 
GeneralRe: library for printing pdf's Pin
Bernhard14-Jul-02 19:21
Bernhard14-Jul-02 19:21 
GeneralProgram icon when minimized app Pin
ViolaCase11-Jul-02 23:20
ViolaCase11-Jul-02 23:20 
GeneralRe: Program icon when minimized app Pin
Nish Nishant12-Jul-02 1:11
sitebuilderNish Nishant12-Jul-02 1:11 
GeneralRe: Program icon when minimized app Pin
Rage12-Jul-02 1:24
professionalRage12-Jul-02 1:24 
GeneralRe: Program icon when minimized app Pin
ViolaCase12-Jul-02 4:15
ViolaCase12-Jul-02 4:15 
GeneralRe: Program icon when minimized app Pin
Nish Nishant12-Jul-02 5:29
sitebuilderNish Nishant12-Jul-02 5:29 
GeneralRe: Program icon when minimized app Pin
Rage12-Jul-02 1:57
professionalRage12-Jul-02 1:57 
Generalcomboboxex with edit vs tooltip Pin
real name11-Jul-02 23:18
sussreal name11-Jul-02 23:18 
GeneralMore on Memory Leak Detectors Pin
LittleYellowBird11-Jul-02 23:01
LittleYellowBird11-Jul-02 23:01 
GeneralRe: More on Memory Leak Detectors Pin
Christian Graus12-Jul-02 1:02
protectorChristian Graus12-Jul-02 1:02 

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.