Click here to Skip to main content
15,888,351 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: Store STL iterator in CListBox Pin
Richard MacCutchan17-Jan-12 9:31
mveRichard MacCutchan17-Jan-12 9:31 
AnswerRe: Store STL iterator in CListBox Pin
«_Superman_»18-Jan-12 18:23
professional«_Superman_»18-Jan-12 18:23 
GeneralRe: Store STL iterator in CListBox Pin
LionAM19-Jan-12 9:04
LionAM19-Jan-12 9:04 
AnswerRe: Store STL iterator in CListBox Pin
Orjan Westin19-Jan-12 4:24
professionalOrjan Westin19-Jan-12 4:24 
GeneralRe: Store STL iterator in CListBox Pin
LionAM19-Jan-12 8:54
LionAM19-Jan-12 8:54 
GeneralRe: Store STL iterator in CListBox Pin
Orjan Westin19-Jan-12 23:38
professionalOrjan Westin19-Jan-12 23:38 
GeneralRe: Store STL iterator in CListBox Pin
LionAM20-Jan-12 11:04
LionAM20-Jan-12 11:04 
AnswerRe: Store STL iterator in CListBox Pin
Emilio Garavaglia25-Jan-12 21:22
Emilio Garavaglia25-Jan-12 21:22 
The iterator members aren't granted to remain the same, and the iterator itself can be wider than just a pointer (it may have some other members for checkup).

The standard grants that list::itrerator will always be valid until the element they refer remain in the list. An list grants that the element retain their placement in memory until they remain in the list.

Instead of store the iterator, store the pointer to the value the iterator refers to:

SetItedDataPtr(&*iter);


You can -at this pioint- access the element directly through the pointer.
Just make sure to update the list and the list-box coherently.

(Note: if *iter has a unary-& overload, just use std::address_of(*iter) )

2 bugs found.
> recompile ...
65534 bugs found.
D'Oh! | :doh:


AnswerRe: Store STL iterator in CListBox Pin
nv314-Mar-12 13:05
nv314-Mar-12 13:05 
GeneralRe: Store STL iterator in CListBox Pin
LionAM16-Mar-12 12:34
LionAM16-Mar-12 12:34 
QuestionHow to get the address of resource data in an execute file? Pin
whiteclouds15-Jan-12 21:49
whiteclouds15-Jan-12 21:49 
AnswerRe: How to get the address of resource data in an execute file? Pin
Richard MacCutchan15-Jan-12 23:00
mveRichard MacCutchan15-Jan-12 23:00 
GeneralRe: How to get the address of resource data in an execute file? Pin
whiteclouds16-Jan-12 20:59
whiteclouds16-Jan-12 20:59 
QuestionBoost iterators in TR1/C++11 Pin
Orjan Westin13-Jan-12 5:37
professionalOrjan Westin13-Jan-12 5:37 
Questioncompression/decompression using GZip.exe(3rd party) Pin
KASR111-Jan-12 0:13
KASR111-Jan-12 0:13 
AnswerRe: compression/decompression using GZip.exe(3rd party) Pin
Richard MacCutchan11-Jan-12 2:39
mveRichard MacCutchan11-Jan-12 2:39 
AnswerRe: compression/decompression using GZip.exe(3rd party) Pin
Albert Holguin17-Jan-12 9:30
professionalAlbert Holguin17-Jan-12 9:30 
QuestionFireEvent method not returning cancelchange status correctly. Pin
keloth879-Jan-12 22:35
keloth879-Jan-12 22:35 
QuestionVS2010 CLR double to String, String to double MSVC/C++ methods? Pin
meace12345-Jan-12 22:14
meace12345-Jan-12 22:14 
AnswerRe: VS2010 CLR double to String, String to double MSVC/C++ methods? Pin
Richard MacCutchan5-Jan-12 23:13
mveRichard MacCutchan5-Jan-12 23:13 
GeneralRe: VS2010 CLR double to String, String to double MSVC/C++ methods? Pin
meace12345-Jan-12 23:25
meace12345-Jan-12 23:25 
GeneralRe: VS2010 CLR double to String, String to double MSVC/C++ methods? Pin
Richard MacCutchan5-Jan-12 23:54
mveRichard MacCutchan5-Jan-12 23:54 
GeneralRe: VS2010 CLR double to String, String to double MSVC/C++ methods? Pin
meace12345-Jan-12 23:59
meace12345-Jan-12 23:59 
GeneralRe: VS2010 CLR double to String, String to double MSVC/C++ methods? Pin
Richard MacCutchan6-Jan-12 0:16
mveRichard MacCutchan6-Jan-12 0:16 
GeneralRe: VS2010 CLR double to String, String to double MSVC/C++ methods? Pin
meace12347-Jan-12 19:27
meace12347-Jan-12 19:27 

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.