selectall.cc

来自「2007年机器人足球世界杯3D仿真组亚军」· CC 代码 · 共 41 行

CC
41
字号
#include "predicate.ih"unsigned Predicate::selectAll(vector<rPredicate> &_res, Path const &_select){  vector<rPredicate> search_space;  Path p = _select;  if (p.path.empty())    return 0;  if (p.path.front() == "/") {    // Search in all predicates with value path[0] which are in    // the top level of the tree.    p.path.pop_front();    if (p.path.empty()) {      _res.insert(_res.end(),children.begin(),children.end());      return children.size();    } else      findAll(search_space,p.path.front());  } else {    // Search in all predicates with value path[0].    findAllDeep(search_space,p.path.front());  }  p.path.pop_front();  unsigned cnt = 0;  for (vector<rPredicate>::iterator i = search_space.begin();       i != search_space.end(); ++i) {    if (p.path.empty()) {      _res.push_back(*i);      ++cnt;    } else      cnt += (*i)->selectAll(_res,p);  }  return cnt;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?