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

ATL / WTL / STL

 
QuestionProlem with rich edit control. ITextService's TxGetNaturalSize doesnt give me the right value.. [modified] Pin
Arif Siddiquee5-Dec-07 1:25
Arif Siddiquee5-Dec-07 1:25 
QuestionContextMenu HWND in a Shell Extension Dll Pin
Jeffrey Walton30-Nov-07 23:45
Jeffrey Walton30-Nov-07 23:45 
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 
Sorry for the late answer, I haven't been accessing the forums lately.

I must admit I had to actually try it in the debugger to understand what is happening Shucks | :-\

The problem is that your ListOfElements function always returns a copy of the list. So ListOfElements().begin() and ListOfElements().end() are two iterators pointing to different containers.

You have to rememeber that, unlike C#, Java and many others, C++ does not treat variables as references. X x is not a reference to an X, but an object on the stack, just like int x.

You should modify your function's signature to const list & ListOfElements(void) const. Just list & will not work, since your function is const. This will still enable you to copy the container, when you want: list a = obj.ListOfElements().

A note about style: don't use names starting with an underscore. From MSDN[^]:
Use of two sequential underscore characters ( __ ) at the beginning of an identifier, or a single leading underscore followed by a capital letter, is reserved for C++ implementations in all scopes. You should avoid using one leading underscore followed by a lowercase letter for names with file scope because of possible conflicts with current or future reserved identifiers.


Florin Crisan

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 
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 

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.