Click here to Skip to main content
15,900,667 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: Directory only dialog box Pin
tareqsiraj15-Oct-03 18:23
tareqsiraj15-Oct-03 18:23 
GeneralWidth and Height property Pin
El'Cachubrey15-Oct-03 0:17
El'Cachubrey15-Oct-03 0:17 
Generalmap erase issue Pin
Yu Zhiquan12-Oct-03 23:55
Yu Zhiquan12-Oct-03 23:55 
GeneralRe: map erase issue Pin
Abebe13-Oct-03 0:46
Abebe13-Oct-03 0:46 
GeneralRe: map erase issue Pin
Michael Dunn13-Oct-03 6:36
sitebuilderMichael Dunn13-Oct-03 6:36 
GeneralRe: map erase issue Pin
Joaquín M López Muñoz13-Oct-03 9:17
Joaquín M López Muñoz13-Oct-03 9:17 
GeneralRe: map erase issue Pin
miropl14-Oct-03 9:38
miropl14-Oct-03 9:38 
GeneralRe: map erase issue Pin
Joaquín M López Muñoz14-Oct-03 10:11
Joaquín M López Muñoz14-Oct-03 10:11 
I didn't see the declaration of STRING2INT, as the original poster forgot to tick the "Do not treat <'s as HTML tags" checkbox Smile | :)

Now that you have revealed the definition of STRING2INT to the world, another subtler flaw comes to light. The type
map< char*, int >
does not guarantee the behavior one would assume at first sight. Even worse, it can seem to work until less expected. The problem is that what's being used as a key are pointers to chars, and pointing to equivalent contents does not imply pointer equality. Consider:
typedef map< char*, int > STRING2INT;
STRING2INT m;
m["January"]=1; // #1
cout<<m["January"]<<endl; // #2
No guarantee is made that the first pointer in #1 is the same as that in #2. Usually, this equality happens to work because the compiler is smart enough not to duplicate literals, but the following will fail for sure
m["January"]=1;
string str="January";
cout<<m[str.c_str()]<<endl;
Of course, the simple solution is to define STRING2INT as a map< string, int >. Regards,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
GeneralRe: map erase issue Pin
miropl15-Oct-03 7:15
miropl15-Oct-03 7:15 
GeneralRe: map erase issue Pin
ZoogieZork15-Oct-03 8:03
ZoogieZork15-Oct-03 8:03 
GeneralRe: map erase issue Pin
souldog15-Oct-03 21:39
souldog15-Oct-03 21:39 
GeneralRe: map erase issue Pin
f229-Jun-06 20:49
f229-Jun-06 20:49 
GeneralactiveX message handler Pin
Mr_Byte10-Oct-03 22:19
Mr_Byte10-Oct-03 22:19 
Generaltroubles with boost::regex and STLport Pin
Andreas Saurwein10-Oct-03 6:11
Andreas Saurwein10-Oct-03 6:11 
GeneralWTL trouble with Common Controls Manifest Pin
BubbleGum8-Oct-03 23:23
BubbleGum8-Oct-03 23:23 
GeneralRe: WTL trouble with Common Controls Manifest Pin
Steve S9-Oct-03 0:53
Steve S9-Oct-03 0:53 
GeneralRe: WTL trouble with Common Controls Manifest Pin
BubbleGum9-Oct-03 3:41
BubbleGum9-Oct-03 3:41 
GeneralRe: WTL trouble with Common Controls Manifest Pin
umeca7410-Oct-03 1:48
umeca7410-Oct-03 1:48 
QuestionATL Edit field validation? Pin
bryces8-Oct-03 21:32
bryces8-Oct-03 21:32 
AnswerRe: ATL Edit field validation? Pin
Steve S8-Oct-03 21:54
Steve S8-Oct-03 21:54 
GeneralRe: ATL Edit field validation? Pin
Anonymous9-Oct-03 1:45
Anonymous9-Oct-03 1:45 
GeneralRe: ATL Edit field validation? Pin
bryces9-Oct-03 1:52
bryces9-Oct-03 1:52 
GeneralRe: ATL Edit field validation? Pin
Steve S9-Oct-03 2:13
Steve S9-Oct-03 2:13 
GeneralEvent notification from checkbox within TreeControl (from WTL) Pin
shivonkar8-Oct-03 2:20
shivonkar8-Oct-03 2:20 
GeneralRe: Event notification from checkbox within TreeControl (from WTL) Pin
algol14-Oct-03 21:15
algol14-Oct-03 21:15 

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.