This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: vector<> can probably never grow to it's maximum size!


Jonathan Wakely <cow@compsoc.man.ac.uk> writes:

| On Mon, Oct 18, 2004 at 06:59:28PM +0530, Dhruv Matani wrote:
| 
| > 4. The post on google also hints at changing the behaviour of
| > new_allocator<> for in-built types so that copying is not required if
| > realloc is used. This is probably a not so related issue, so clubbing
| > these would probably not be right.
| 
| But it also explains why realloc() is not possible for C++ objects.
| You need something other than realloc, so that if the existing block
| can't be grown then allocation fails. You must not allocate a new block
| and move the contents.

I think I disagree with your comments.

I consider the allocate() with hint as something implementable in
current C++.  I tried it on linux-based systems.  The big thing is to
have knowledge about cookies malloc/realloc interaction.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]