Boost logo

Boost :

Subject: Re: [boost] [unordered] please don't allocate memory in the default constructor
From: Daniel James (daniel_james_at_[hidden])
Date: 2009-08-24 16:25:48

2009/8/24 Thorsten Ottosen <thorsten.ottosen_at_[hidden]>:
> don't the implementation already check when it needs to rehash the
> container?  Can't that check be reused for growing from an empty container
> just like with vector?

No, because you have to check for any method that accesses the buckets
- most of which can't rehash. And you do have to always have at least
one bucket, otherwise you couldn't meet the post conditions of some
methods eg. 'b.bucket(k)' has to return a value in the range '[0,
b.bucket_count())' which is impossible if 'bucket_count()' is 0.

>> I'm not sure if the trade off is worth it.
> Is it noticable slower?

Dunno, I haven't implemented it. This isn't really something you'd
expect from the way the unordered containers are specified.


Boost list run by bdawes at, gregod at, cpdaniel at, john at