Boost logo

Boost :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2007-12-07 14:00:22


Thorsten Ottosen wrote:
> I vote to accept this library. The documentation is very nice.

Thanks for the vote.

> One thing puzzled me though:
> (see http://igaztanaga.drivehq.com/unordered/unordered/comparison.html)
>
> "The containers hash or predicate function can throw exceptions from erase"
>
> Under what cicumstances can/should/would I construct a ahsh or predicate
> that throws? I mean, the hash computes an integer, and comparisons reads
> data to determine its answer.
>
> This migth be what the standard requires, but it certainly seems
> non-intuitive. Why not just require that neither hash nor predicates can
> throw?

The same could be said about Predicate for ordered containers like
std::set/map. I haven't seen a practical case where the comparison could
throw. But standard library experts should answer this better than me.

Certainly, Daniel has tried to achieve strong exception guarantees and
the implementation becomes quite complicated if comparison/hash throws.
Double buffering and other tricks are needed. I think this is a very
good question both for boosters and people from the LWG.

> -Thorsten

Regards,

Ion


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