virtual ~WalkThrough() { } void setJumper(const StateJumper j) { Jumper = j; } void setMatcher(const Matcher m) { IsMatch = m; } void setState(const State& s) { curState = s; } State getState() const { return curState; } bool getNextFilter(); bool isOver() const { return overFlag; } private: State curState; bool overFlag; StateJumper Jumper; Matcher IsMatch; }; template <class State> bool WalkThrough<State>::getNextFilter() { if (overFlag) // 若已完成遍历,则直接返回 return false; if (!Jumper || !IsMatch) // 若用户未定义Jumper或IsMatch函数,则返回 {
|
正在阅读:经验分享:闲谈C++算法封装之穷举法经验分享:闲谈C++算法封装之穷举法
2004-03-26 10:05
出处:CSDN
责任编辑:linjixiong
键盘也能翻页,试试“← →”键