
12 Feb
2005
12 Feb
'05
12:26 a.m.
Daniel James wrote:
[...] 'For unordered associative containers, no swap function throws an exception unless that exception is thrown by the copy constructor or copy assignment operator of the container's Hash or [equality] Pred object (if any).' [...]
Frankly, I don't understand why Hash or Pred should be copied at all during a swap. If swapping Hash or Pred via std::swap() would throw, it seems like a no-brainer that the authors of Hash and Pred should provide a non-throwing swap() which can be discovered via ADL. In fact, I don't see any good reason why the standard shouldn't simply require that Hash and Pred provide a non-throwing swap() if std::swap() would throw. Dave