void
RRTS::recompute_cc_for_predecessors_and(RRTNode* g)
{
- assert(this->_path.size() == 0);
+ std::vector<RRTNode*> path;
+ path.reserve(this->_path.size());
while (g != nullptr) {
- this->_path.push_back(g);
+ path.push_back(g);
g = g->p();
}
- std::reverse(this->_path.begin(), this->_path.end());
- for (unsigned int i = 1; i < this->_path.size(); i++) {
- this->_path[i]->c(this->cost_build(
- *this->_path[i - 1],
- *this->_path[i]));
+ std::reverse(path.begin(), path.end());
+ for (unsigned int i = 1; i < path.size(); i++) {
+ path[i]->c(this->cost_build(*path[i - 1], *path[i]));
}
- this->_path.clear();
}
void