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

ATL / WTL / STL

 
GeneralRe: when to/why use Allocator::construct()? Pin
led mike13-Nov-07 6:11
led mike13-Nov-07 6:11 
JokeRe: when to/why use Allocator::construct()? Pin
George L. Jackson13-Nov-07 11:09
George L. Jackson13-Nov-07 11:09 
JokeRe: when to/why use Allocator::construct()? Pin
led mike14-Nov-07 4:46
led mike14-Nov-07 4:46 
QuestionPush File into STL list Pin
Jeffrey Walton9-Nov-07 9:36
Jeffrey Walton9-Nov-07 9:36 
AnswerRe: Push File into STL list [modified] Pin
Rajasekharan Vengalil10-Nov-07 12:51
Rajasekharan Vengalil10-Nov-07 12:51 
GeneralRe: Push File into STL list Pin
Jeffrey Walton10-Nov-07 13:21
Jeffrey Walton10-Nov-07 13:21 
AnswerRe: Push File into STL list Pin
Stephen Hewitt11-Nov-07 15:49
Stephen Hewitt11-Nov-07 15:49 
GeneralRe: Push File into STL list Pin
Jeffrey Walton12-Nov-07 5:09
Jeffrey Walton12-Nov-07 5:09 
Hi Steve,

Thanks for the reply.

Stephen Hewitt wrote:
Using std::list like this is very inefficient;

I should have stated the files are small - less than 5KB. I desired to simplify insertion and extraction. With the list, both operations are O(1) (constant time), with a memory footprint ~= 3 times original files size. I do not need random access (vector). Also, I do not need to search.

Stephen Hewitt wrote:
You'd be better off using a std::vector.

With vector, I loose O(1) extraction (extraction is linear from front or middle). Insertion is O(1) if at the end. But I have to manage an index or pointer. However, size ~= 1x.

Taking from SGI's site on vectors:
Vector is the simplest of the STL container classes, and in many cases the most efficient.
As the docs state, "in most cases". In my case, I am working on a parser/scanner (no need for the tokenizer). I believe if I wanted to lessen memory needs, I could use an slist. But out of habit, I grabbed a list.

In the end, I am willing to trade memory for time (and simplicity).

Thanks for the input,
Jeff
GeneralRe: Push File into STL list Pin
Stuart Dootson12-Nov-07 15:11
professionalStuart Dootson12-Nov-07 15:11 
AnswerRe: Push File into STL list Pin
Stuart Dootson11-Nov-07 22:54
professionalStuart Dootson11-Nov-07 22:54 
GeneralRe: Push File into STL list Pin
Jeffrey Walton12-Nov-07 5:11
Jeffrey Walton12-Nov-07 5:11 
GeneralRe: Push File into STL list Pin
Stuart Dootson12-Nov-07 15:07
professionalStuart Dootson12-Nov-07 15:07 
GeneralRe: Push File into STL list Pin
Jeffrey Walton12-Nov-07 15:37
Jeffrey Walton12-Nov-07 15:37 
AnswerRe: Push File into STL list Pin
Jeffrey Walton12-Nov-07 5:24
Jeffrey Walton12-Nov-07 5:24 
QuestionGive me a sample of a function returning bitset (STL) Pin
Ontanggabe Parulian7-Nov-07 19:53
Ontanggabe Parulian7-Nov-07 19:53 
AnswerRe: Give me a sample of a function returning bitset (STL) Pin
Stuart Dootson7-Nov-07 21:33
professionalStuart Dootson7-Nov-07 21:33 
Answer:) Re: Give me a sample of a function returning bitset (STL) [SOLVED and thanks] Pin
Ontanggabe Parulian7-Nov-07 22:36
Ontanggabe Parulian7-Nov-07 22:36 
GeneralRe: Give me a sample of a function returning bitset (STL) Pin
Rob Caldecott7-Nov-07 23:14
Rob Caldecott7-Nov-07 23:14 
GeneralRe: Give me a sample of a function returning bitset (STL) Pin
Stuart Dootson8-Nov-07 7:04
professionalStuart Dootson8-Nov-07 7:04 
GeneralRe: :) Re: Give me a sample of a function returning bitset (STL) [SOLVED and thanks] Pin
ThatsAlok24-Nov-07 0:18
ThatsAlok24-Nov-07 0:18 
QuestionATL & WTL CString problem Pin
Fernando A. Gomez F.7-Nov-07 11:45
Fernando A. Gomez F.7-Nov-07 11:45 
AnswerRe: ATL & WTL CString problem Pin
George L. Jackson7-Nov-07 14:13
George L. Jackson7-Nov-07 14:13 
GeneralRe: ATL & WTL CString problem Pin
Fernando A. Gomez F.7-Nov-07 14:17
Fernando A. Gomez F.7-Nov-07 14:17 
GeneralRe: ATL & WTL CString problem Pin
George L. Jackson7-Nov-07 14:54
George L. Jackson7-Nov-07 14:54 
GeneralRe: ATL & WTL CString problem Pin
Fernando A. Gomez F.7-Nov-07 15:02
Fernando A. Gomez F.7-Nov-07 15:02 

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.