Click here to Skip to main content
15,914,642 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: CreateThread / CloseHandle cleanly Pin
Paul Farry22-Aug-02 5:29
professionalPaul Farry22-Aug-02 5:29 
Generalset compiler error Pin
_Magnus_22-Aug-02 3:43
_Magnus_22-Aug-02 3:43 
GeneralRe: set compiler error Pin
Michael Dunn25-Aug-02 21:32
sitebuilderMichael Dunn25-Aug-02 21:32 
GeneralSTL Container of classes Pin
[James Pullicino]21-Aug-02 21:39
[James Pullicino]21-Aug-02 21:39 
GeneralRe: STL Container of classes Pin
Anonymous21-Aug-02 22:07
Anonymous21-Aug-02 22:07 
GeneralRe: STL Container of classes Pin
Neville Franks21-Aug-02 22:40
Neville Franks21-Aug-02 22:40 
GeneralRe: STL Container of classes Pin
[James Pullicino]21-Aug-02 23:08
[James Pullicino]21-Aug-02 23:08 
GeneralRe: STL Container of classes Pin
peterchen27-Aug-02 20:32
peterchen27-Aug-02 20:32 
both the default CTor and the 2 copies come from the insertion of a default value, if the requested key is not found. So if you use:

tmap::iterator it = map.find(key);

if (it != map.end())
   // it->second is a ref to the value, you can use, or assign it
else
   // key is not found - what do you want to do?


Frankly, map is my single most used STL class, and I find myself always coding around the operator[].

The two copies come from
1) creating a temp pair<const key,="" value=""> that is passed to insert, and
2) copying the pair<const key,="" value=""> into the map
(frankly, a good library design would not need one of the copies)

You can ignore that if you have classes with "cheap" Copy-CTor's for default-constructed classes, and do complex construction after inserting a default, like this:

value & v = map[10];
v.ReadDataFromHugeFileAndKeepIt();

the same is true for classes that hold System resources (like HANDLE's that are closed in the DTor) and have no acceptable copy contructor.

Peter


One day I might find it quite amusing how touching tongues make life so confusing  Anne Clark again   [sighist]
GeneralRe: STL Container of classes Pin
[James Pullicino]29-Aug-02 23:38
[James Pullicino]29-Aug-02 23:38 
GeneralRegular Expression Template Archive Pin
Idefix21-Aug-02 5:30
Idefix21-Aug-02 5:30 
GeneralRe: Regular Expression Template Archive Pin
Neville Franks21-Aug-02 23:06
Neville Franks21-Aug-02 23:06 
QuestionActivex which itself a control container? Pin
tomer dror21-Aug-02 4:36
tomer dror21-Aug-02 4:36 
AnswerRe: Activex which itself a control container? Pin
Rashid Thadha21-Aug-02 6:11
Rashid Thadha21-Aug-02 6:11 
GeneralOLEMISC_SIMPLEFRAMESITE? Pin
tomer dror21-Aug-02 6:18
tomer dror21-Aug-02 6:18 
GeneralRe: OLEMISC_SIMPLEFRAMESITE? Pin
Rashid Thadha21-Aug-02 6:39
Rashid Thadha21-Aug-02 6:39 
GeneralRe: OLEMISC_SIMPLEFRAMESITE? Pin
tomer dror21-Aug-02 7:09
tomer dror21-Aug-02 7:09 
GeneralATL remove Apply button on Properties... Pin
Braulio Dez20-Aug-02 0:06
Braulio Dez20-Aug-02 0:06 
GeneralWTL 7 MTPad Example Errors Pin
Ancient Dragon15-Aug-02 19:39
Ancient Dragon15-Aug-02 19:39 
GeneralRe: WTL 7 MTPad Example Errors Pin
Paul M Watt15-Aug-02 19:58
mentorPaul M Watt15-Aug-02 19:58 
GeneralRe: WTL 7 MTPad Example Errors Pin
Stuart Dootson15-Aug-02 20:51
professionalStuart Dootson15-Aug-02 20:51 
GeneralRe: WTL 7 MTPad Example Errors Pin
Ed Gadziemski19-Aug-02 12:07
professionalEd Gadziemski19-Aug-02 12:07 
Generalowner-draw menu Pin
Gabriel.P.G13-Aug-02 12:57
Gabriel.P.G13-Aug-02 12:57 
GeneralRe: owner-draw menu Pin
Michael Dunn13-Aug-02 13:13
sitebuilderMichael Dunn13-Aug-02 13:13 
GeneralATL Service and hidden windows Pin
Michael P Butler13-Aug-02 1:09
Michael P Butler13-Aug-02 1:09 
GeneralRe: ATL Service and hidden windows Pin
Michael Dunn13-Aug-02 13:14
sitebuilderMichael Dunn13-Aug-02 13:14 

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.