Boost logo

Boost :

From: Daniel James (daniel_james_at_[hidden])
Date: 2007-12-10 11:19:34


On 10/12/2007, Thorsten Ottosen <thorsten.ottosen_at_[hidden]> wrote:
> Daniel James skrev:
> >
> > This implementation actually does provide the no throw guarantee. But
> > Jeremy Maitin-Shepard's version (on which it is based) didn't because
> > the iterators didn't store the bucket, and required the hash to be
> > calculated to work out which bucket the elements to be deleted are in.
> > Which I think the standard allows.
>
> Ok, I think you right the standard allows that. But this is also
> a bit irritating, because I cannot portable take advantage of your
> stronger guarantee. feThis again begs the question of how much the
> stronger guarantee affects performance?

I don't think it affects performance at all, I think if it was
required it would reduce the implementation choices. For example, if a
container could rehash without invalidating iterators then I think it
can currently do that when erase is called, but not if the stronger
guarantee is required and hash can throw.

Also, I made a mistake in the documentation, I said that a call to
Hash or Pred can throw. But re-reading the standard, it looks like it
doesn't have to be a call, it can be any member of the function
objects.

> yes, but my question was: *if an exception is thrown*, then what? I
> assume you give the basic guarantee?

Sorry, I misunderstood. This implementation gives the strong
guarantee, the standard gives the basic guarantee.

Daniel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk