Click here to Skip to main content
15,891,777 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: Store STL iterator in CListBox Pin
LionAM17-Jan-12 5:16
LionAM17-Jan-12 5:16 
GeneralRe: Store STL iterator in CListBox Pin
Richard MacCutchan17-Jan-12 5:22
mveRichard MacCutchan17-Jan-12 5:22 
GeneralRe: Store STL iterator in CListBox Pin
LionAM17-Jan-12 9:09
LionAM17-Jan-12 9:09 
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 
Thank you for your answer.

Surely, I am adding and removing elements from the STL (doubly linked) list. That is the purpose of the CListBox control.

The STL list lives, in principle, for the whole program lifetime. If I want to change the contents of the list, I create a child window with the CListBox control and populate it with the items of the list (together with the iterator). To add a new item before/after the currently selected item in the CListBox control, I use the iterator to find the corresponding item in the STL list. When I want to delete an item, its the same.

This works, as the iterators of the STL list are guaranteed to be valid as long as you don't delete the corresponding item.

For my case, a map would not work as it does not remember the ordering of the items. To store the indices of the vector would not make sense as these change if one item is inserted or removed. The doubly linked list seems, in principle, to be the best choice due to the constant insert/remove time.

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

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.