Click here to Skip to main content
15,908,166 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: ATL 8 registration troubles Pin
Wes Aday28-Sep-06 5:21
professionalWes Aday28-Sep-06 5:21 
QuestionHow memory efficient is std::set? Pin
Dave Cross18-Sep-06 5:43
professionalDave Cross18-Sep-06 5:43 
AnswerRe: How memory efficient is std::set? Pin
Zac Howland18-Sep-06 6:17
Zac Howland18-Sep-06 6:17 
AnswerRe: How memory efficient is std::set? Pin
Jörgen Sigvardsson18-Sep-06 8:11
Jörgen Sigvardsson18-Sep-06 8:11 
GeneralRe: How memory efficient is std::set? Pin
Dave Cross18-Sep-06 23:15
professionalDave Cross18-Sep-06 23:15 
GeneralRe: How memory efficient is std::set? Pin
Jörgen Sigvardsson18-Sep-06 23:27
Jörgen Sigvardsson18-Sep-06 23:27 
AnswerRe: How memory efficient is std::set? Pin
Jörgen Sigvardsson18-Sep-06 8:12
Jörgen Sigvardsson18-Sep-06 8:12 
AnswerRe: How memory efficient is std::set? Pin
Stuart Dootson18-Sep-06 21:16
professionalStuart Dootson18-Sep-06 21:16 
If you can allocate it all at once, std::vector is the most memory efficient - it allocates a single contiguous block of memory and will have something like 12-16 bytes overhead on top (pointer to allocated memory, size of allocated block, use count of allocated block). If the vector has to reallocate, though, you will have high memory usage while the vector allocates a new (larger) contiguous block and copies elements to it.

std::deque is second in terms of overhead. It allocates memory in large-ish chunks, so if you need more elements, it just allocates a new chunk. Obviously, it needs to keep track of each chunk, so you're likely to have 12-16 bytes overhead per-chunk, possibly (I'm guessing here!).

std::set - mmmm, you don't really want to use that unless you need to utilise its particular properties, i.e. it's an ordered set and it's pretty efficient for checking for the existence of a particular element (given the ordering function you specify). Even then - it's probably more performant to sort a std::vector and one of the algorithms (std::lower_bound to get an iterator somewhere near the element, or std::binary_search to show the existence (but not the location!) of the element)

BTW - you may find Effective STL by Scott Meyers[^] useful for STL related hints and tips - tip number 1 is "Choose your containers with care." - hmmm, sounds relevant Smile | :)

HTH!



GeneralRe: How memory efficient is std::set? Pin
Jörgen Sigvardsson18-Sep-06 21:30
Jörgen Sigvardsson18-Sep-06 21:30 
GeneralRe: How memory efficient is std::set? Pin
Dave Cross18-Sep-06 22:20
professionalDave Cross18-Sep-06 22:20 
GeneralRe: How memory efficient is std::set? [modified] Pin
Stuart Dootson19-Sep-06 0:32
professionalStuart Dootson19-Sep-06 0:32 
GeneralRe: How memory efficient is std::set? Pin
Zac Howland19-Sep-06 3:33
Zac Howland19-Sep-06 3:33 
Questionvariant and BSTR interactions Pin
Samy_Ibraheem_Mo17-Sep-06 10:18
Samy_Ibraheem_Mo17-Sep-06 10:18 
AnswerRe: variant and BSTR interactions Pin
Samy_Ibraheem_Mo17-Sep-06 11:43
Samy_Ibraheem_Mo17-Sep-06 11:43 
GeneralRe: variant and BSTR interactions Pin
Jörgen Sigvardsson17-Sep-06 12:12
Jörgen Sigvardsson17-Sep-06 12:12 
QuestionATL Control Pin
Demian Panello15-Sep-06 2:36
Demian Panello15-Sep-06 2:36 
Questionevent_source(com), event_receiver(com, true) __hooking problem Pin
sman_nz14-Sep-06 7:17
sman_nz14-Sep-06 7:17 
AnswerRe: event_source(com), event_receiver(com, true) __hooking problem Pin
Alex Boyce15-Sep-06 10:41
Alex Boyce15-Sep-06 10:41 
Questionshould we prefer deque over vector Pin
yccheok14-Sep-06 0:28
yccheok14-Sep-06 0:28 
AnswerRe: should we prefer deque over vector Pin
Zac Howland14-Sep-06 3:21
Zac Howland14-Sep-06 3:21 
GeneralRe: should we prefer deque over vector Pin
Jörgen Sigvardsson14-Sep-06 7:30
Jörgen Sigvardsson14-Sep-06 7:30 
Questionwtl window class / aligmnent? Pin
Marcin Parka13-Sep-06 19:58
Marcin Parka13-Sep-06 19:58 
QuestionPassing BSTR from javascript to ATL Pin
rana7413-Sep-06 3:01
rana7413-Sep-06 3:01 
QuestionSTL Algorithms Pin
Zac Howland12-Sep-06 11:11
Zac Howland12-Sep-06 11:11 
AnswerRe: STL Algorithms Pin
Christian Graus12-Sep-06 11:41
protectorChristian Graus12-Sep-06 11:41 

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.