Prev: Testing Framework for MFC
Next: Crash in CFileDailog when called from hook procedure (OFNHookProc)
From: Joseph M. Newcomer on 11 May 2010 19:27 Whichi s one of the reasons I moved to std::map. It is more efficient, and doesn't require the overloaded static method. And you have to actually generate CONTENT of that HashKey function, and if you get it wrong, you get awful performance. joe On Tue, 11 May 2010 11:53:08 -0400, "RB" <NoMail(a)NoSpam> wrote: > > >>> CMap<CStrng, CString&, CPoint, CPoint&> MyMap2; //error C2065: 'CStrng' : undeclared identifier > >> Did you see the error message CStrng' : undeclared identifier >> You have to type CString :) > >Thanks I am slowly beginning to beginning to decphier logic of STL. >I did some more searching and found that for the above to work I >would have had to override the HashKey with a CString type. > > > Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Joseph M. Newcomer on 11 May 2010 19:32 Mostly I work from the VS2005 and VS2008 docs. VS6 had a LOT of problems with STL, mostly caused by the fact that the language it compiled was not C++ as specified, but some language that vaguely resembled it. Templates, in particular, had serious problems with respect to proper compilation of STL structures. joe On Tue, 11 May 2010 12:01:01 -0400, "RB" <NoMail(a)NoSpam> wrote: > >> If you use std::map, you have to specify only two template arguments instead >> of four: just the key type and the value type: >> >> #include <map> // Use STL map container >> >> std::map< CString, CPoint > MyMap; >> MyMap[ _T("Vertex1") ] = CPoint(0, 0); > >Thanks Giovanni >Yes, I also remember you suggesting std::vector over CArray which I did want >to do buy the VC 6 help docs don't have much on std::stuff. Maybe VS2005 >will. My biggest problem in this area is my incompetence in STL. >Recomend any one good book on it ? > Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Cholo Lennon on 12 May 2010 09:14 On 11/05/2010 12:44, RB wrote: > Joe I filed notes on your input. > If I wanted to buy one book on STL that was on a beginners > level but still offered excellent material. Do you know of such > a Title ? > > A "must have" book about the C++ standard library (which includes the containers library, aka STL) is the following: "The C++ Standard Library A Tutorial and Reference", Nicolai Josuttis, Addison Wesley. Regards -- Cholo Lennon Bs.As. ARG
From: RB on 12 May 2010 10:59 Thanks that was Giovanni's suggestion also. Does it also have code examples of the containers library ?
From: Cholo Lennon on 12 May 2010 13:24
On 12/05/2010 11:59, RB wrote: > Thanks that was Giovanni's suggestion also. Ups, you're right Does it also have > code examples of the containers library ? > Yes, the book has usage examples for every container :-) -- Cholo Lennon Bs.As. ARG |