Click here to Skip to main content
15,897,334 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: ContextMenu HWND in a Shell Extension Dll Pin
Michael Dunn6-Jan-08 11:22
sitebuilderMichael Dunn6-Jan-08 11:22 
QuestionC++ String split Pin
Mustafa Ismail Mustafa30-Nov-07 0:22
Mustafa Ismail Mustafa30-Nov-07 0:22 
AnswerRe: C++ String split Pin
Stuart Dootson30-Nov-07 3:36
professionalStuart Dootson30-Nov-07 3:36 
JokeRe: C++ String split Pin
Florin Crişan30-Nov-07 4:00
Florin Crişan30-Nov-07 4:00 
GeneralRe: C++ String split Pin
Mustafa Ismail Mustafa30-Nov-07 7:25
Mustafa Ismail Mustafa30-Nov-07 7:25 
AnswerRe: C++ String split Pin
Florin Crişan5-Dec-07 5:59
Florin Crişan5-Dec-07 5:59 
GeneralRe: C++ String split Pin
Mustafa Ismail Mustafa5-Dec-07 9:38
Mustafa Ismail Mustafa5-Dec-07 9:38 
GeneralRe: C++ String split Pin
Stuart Dootson5-Dec-07 20:19
professionalStuart Dootson5-Dec-07 20:19 
Mustafa Ismail Mustafa wrote:
But I still don't understand, why a reference has to be returned?

Like here:

Florin Crisan wrote:
const list & ListOfElements(void) const



instead of a plain

list ListOfElements(void) const

?


Because you'll return a *copy* of the list every time if you return by value rather than reference. This means that two calls to ListOfElements return different lists, so (as you've already found) their iterators won't be compatible. In addition, returning a new copy every time is expensive in time and memory - you don't want to copy!

Returning by reference is equivalent to what C# does when you return an object from a method - objects are only ever passed around by reference in C# as all objects are heap allocated and garbage collected - that's not true for C++.
GeneralRe: C++ String split Pin
Mustafa Ismail Mustafa5-Dec-07 23:49
Mustafa Ismail Mustafa5-Dec-07 23:49 
AnswerRe: C++ String split Pin
Florin Crişan6-Dec-07 3:11
Florin Crişan6-Dec-07 3:11 
AnswerRe: C++ String split Pin
Florin Crişan30-Nov-07 3:46
Florin Crişan30-Nov-07 3:46 
QuestionWTL Web Scrapper Pin
Kuryn27-Nov-07 9:50
Kuryn27-Nov-07 9:50 
AnswerRe: WTL Web Scrapper Pin
Michael Dunn27-Nov-07 16:39
sitebuilderMichael Dunn27-Nov-07 16:39 
QuestionInclude ActiveX in a ATL service using .Net Pin
Alpa Agarwal26-Nov-07 2:53
Alpa Agarwal26-Nov-07 2:53 
Questionhow to get class name from an object of CSnapInItem Object Pin
alien888825-Nov-07 18:26
alien888825-Nov-07 18:26 
AnswerRe: how to get class name from an object of CSnapInItem Object Pin
Florin Crişan26-Nov-07 5:34
Florin Crişan26-Nov-07 5:34 
AnswerRe: how to get class name from an object of CSnapInItem Object Pin
Florin Crişan26-Nov-07 5:43
Florin Crişan26-Nov-07 5:43 
GeneralRe: how to get class name from an object of CSnapInItem Object Pin
alien888826-Nov-07 18:59
alien888826-Nov-07 18:59 
QuestionIncluding is an error? [modified] Pin
Mustafa Ismail Mustafa23-Nov-07 1:04
Mustafa Ismail Mustafa23-Nov-07 1:04 
AnswerNever happened Pin
CPallini23-Nov-07 3:00
mveCPallini23-Nov-07 3:00 
AnswerRe: Including is an error? Pin
Florin Crişan23-Nov-07 4:47
Florin Crişan23-Nov-07 4:47 
GeneralRe: Including is an error? Pin
CPallini27-Nov-07 21:43
mveCPallini27-Nov-07 21:43 
QuestionHow to add control variables to control placed on ATL composite control Pin
viswanadhr22-Nov-07 4:14
viswanadhr22-Nov-07 4:14 
QuestionMMC node drag-drop using cut-copy-paste Pin
alien888820-Nov-07 21:07
alien888820-Nov-07 21:07 
Questionmemory leak Pin
anithavikram(manisha)20-Nov-07 20:06
anithavikram(manisha)20-Nov-07 20:06 

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.