Advertisement

Container Holy Wars (from realloc thread)

Started by February 24, 2000 01:49 PM
22 comments, last by Stoffel 24 years, 6 months ago
You''re right, osmanb, if you will insert or delete in the end of the container, a vector will be faster than a linked list, when I wrote that post, I was thinking in an insertion on the middle of the container, in that case, a linked list will be faster.
quote: If you do have very strict memory management requirements, remember that every container takes an extra template parameter, allowing YOU to supply the allocator.


You''re a better person than I. I break out in cold sweats when I have to write function objects; I can''t imagine writing an allocator.
Advertisement
I never said I actually WRITE allocators. Unfortunately, they are the one part of STL that is severely underdocumented, even in Austern''s book, and on SGI''s site. Nonetheless, it is possible. I LOVE making function objects to do my dirty work, though. (Especially in conjunction with the generic algorithms from STL.)

-Brian
Just a note - for my bigvector<> i didn''t write an allocator. I just wrote a vector implementation from scratch that had the subset of the vector interface that I needed. I found that easier than supplying an allocator in this particular case.

-vince


-vince


This topic is closed to new replies.

Advertisement