Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2007-12-12 07:57:45

on Tue Dec 11 2007, Thorsten Ottosen <> wrote:

> David Abrahams skrev:
>> on Sun Dec 09 2007, Thorsten Ottosen <> wrote:
>>> says that erase() does not throw for ordered containers (which is
>>> correct). Anyway, this means any argument used to assume that predicate
>>> evaluation is a no-throw should be the same for unordered containers.
>> No, the ordered containers don't do any predicate evaluation in
>> erase().
> How can you implement
> std::set<T>::erase( const T& )
> then, if you are not going to find the equivalent elements by evaluating
> Pred(x,y)?

Sorry, I forgot about that one; I was just thinking of
erase(iterator1, iterator2) and erase(iterator)

>>> Why does erase( const_iterator ) (and range version), not provide the
>>> no-throw guarantee?
>> Why should it? Vector/deque erase don't.
> Because it is a node based container.

Yeah, but it might rehash.

>>> Does erase give the strong guarantee otherwise?
>>> Since erase(const Key&) for ordered containers cannot throw, so I guess
>>> it is implicitly required that Pred(x,y) must not throw?
>> Nope, see above.
> Still don't get it.

Hmm, I need to go back and check the draft standard.

Dave Abrahams
Boost Consulting

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