Hi!
Andrei Alexandrescu schrieb:
Again: I have
coded applications that I got bored *waiting* next to without in-place
expansion. They wouldn't terminate. With in-place expansion they would
complete in minutes.
If I was to code an application which might fill its address space with
useful data (as your application seems to do), e.g. reading from a file
or socket (where I don't know the size of the data in advance) I
wouldn't even think of using a vector but instead I would use a deque. A
deque can enlarge itself without copying existing elements, it can use
free blocks of memory regardless whether they happen to be just behind
any existing allocation (!!meaning usage of ANY free block!!), it
algorithmically performs equally well or even better (push_back) than a
vector.
So why are you using a vector and not a deque for this kind of tasks? I
think a deque obsoletes the need of "realloc".
price that I cannot afford. I need to compute large dot products,
operation that is available in optimized form for contiguous storage.
[ comp.lang.c++.moderated. First time posters: Do this! ]