14 Mar
2015
14 Mar
'15
1:10 p.m.
Peter Dimov wrote:
Phil Endecott wrote:
I think we discussed this before. My preferred approach is
flat_set S; { flat_set::batch b(S); b.insert(xxx); b.insert(yyy); } // b's dtor does the merge
What do you do when b.insert(yyy) throws?
You have at least a couple of choices, e.g. the dtor merges the successfully-inserted values or it discards everything. Of course the next question is whether either merging or discarding can also throw. I would hope that discarding (i.e. truncating the vector back to its original size) could reasonably be expected never to throw, right? Merging would require that the comparisons cannot throw. Regards, Phil.