Commit f9c5138b authored by Robert Ricci's avatar Robert Ricci

Resize the resolutions vector (which is used to hold potential link

resolutions) if there turn out to be more than we had initially
estimated.

This was a bit of a bonehead bug - I was under the impression that
indexing into an STL vector would autmoatcially grow the vector to
the size of your index. This turns out not to be the case.
parent 02dc3fe4
......@@ -955,6 +955,13 @@ int add_node(vvertex vv,pvertex pv, bool deterministic, bool is_fixed)
}
resolutions[resolution_index].switches.push_front(*switch_it);
resolution_index++;
if (resolution_index <= resolutions.size()) {
if (resolutions.capacity() > resolutions.size()) {
resolutions.resize(resolutions.capacity());
} else {
resolutions.resize(resolutions.size() * 2);
}
}
total_weight += LINK_RESOLVE_INTRASWITCH;
SDEBUG(cerr << " intraswitch " << first << " and " << second << endl);
}
......@@ -1028,6 +1035,13 @@ int add_node(vvertex vv,pvertex pv, bool deterministic, bool is_fixed)
}
}
resolution_index++;
if (resolution_index <= resolutions.size()) {
if (resolutions.capacity() > resolutions.size()) {
resolutions.resize(resolutions.capacity());
} else {
resolutions.resize(resolutions.size() * 2);
}
}
total_weight += LINK_RESOLVE_INTERSWITCH;
SDEBUG(cerr << " interswitch " <<
get(pvertex_pmap,*source_switch_it)->name << " and " <<
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment