File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -27,13 +27,15 @@ bool DeltaAlgorithm::GetTestResult(const changeset_ty &Changes) {
27
27
28
28
void DeltaAlgorithm::Split (const changeset_ty &S, changesetlist_ty &Res) {
29
29
// FIXME: Allow clients to provide heuristics for improved splitting.
30
+ // Get the iterator to the middle.
31
+ unsigned N = S.size () / 2 ;
32
+ changeset_ty::iterator middle (S.begin ());
33
+ std::advance (middle, N);
34
+
35
+ // Create each vector using the middle as the split.
36
+ changeset_ty LHS (S.begin (), middle);
37
+ changeset_ty RHS (middle, S.end ());
30
38
31
- // FIXME: This is really slow.
32
- changeset_ty LHS, RHS;
33
- unsigned idx = 0 , N = S.size () / 2 ;
34
- for (changeset_ty::const_iterator it = S.begin (),
35
- ie = S.end (); it != ie; ++it, ++idx)
36
- ((idx < N) ? LHS : RHS).insert (*it);
37
39
if (!LHS.empty ())
38
40
Res.push_back (LHS);
39
41
if (!RHS.empty ())
You can’t perform that action at this time.
0 commit comments