Topic: [q] [lib.containers]
Author: lars.farm@nts.mh.se (Lars Farm)
Date: 1995/06/08 Raw View
A couple of questions about the containers library:
(1) Bounds on memory usage are open for interpretation. I can't find
anything on it. Presumably speed is considered more important than memory
usage. Not every computer running C++ programs has unlimited amounts of RAM
and to some of us it is important that unused RAM is recycled. Just as
important as speed. HP's implementation seems to be in agreement with the
draft and it never shrinks the amount of allocated memory (at least
vector/list). Shouldn't it be required to do that? For instance after
erase()/pop_back() capacity() should never exceed 2*size() or some such. If
a user wants to sacrifice RAM for speed isn't that what the allocators are
for and a choice to be made by users by providing a fast and wastefull
allocator?
(2) vector and deque have been extended with
reference at( size_type n );
const_reference at( size_type n ) const;
I suppose they are alternatives to operator[]. Perhaps one of them is range
checked and the other not.
23.2.5.5 vector element access [lib.vector.access]
is empty. What should vector::operator[]/vector::at() do?
- lars
--
lars.farm@nts.mh.se