This seems like more than a performance fix - the API itself seems a little
problematic. If buildSegments was called more than once on the same
SegmentBuilder, tehre would be trouble, right? (before this patch, it could
build on top of existing segments - after this patch it will use a
moved-from-vector which might be in some non-empty state (moved from
objects are in a "valid but unspecified" state - I'm not sure there's
anything other than empty that a vector could be in, but it's still a bit
Could the API be redesigned so it doesn't have this problem?
I agree with dblaikie, the API could be a bit cleaner. Wdyt of this:
- Have the SegmentBuilder constructor accept a vector<CoverageSegment>&; assert that it's empty.
- Replace Segments = SegmentBuilder().buildSegments(...) with SegmentBuilder(Segments).build(...).