diff options
author | Chris Dyer <redpony@gmail.com> | 2014-02-09 20:50:41 -0500 |
---|---|---|
committer | Chris Dyer <redpony@gmail.com> | 2014-02-09 20:50:41 -0500 |
commit | 9b83a2e82aba73b5ff0e848182a8726481a10485 (patch) | |
tree | 81e7ade548bdffaa8534705c2d34beb8c752dc24 /utils/stringlib.h | |
parent | 702591b3296af472cc5c7c4720f1c21b2a6e34b1 (diff) |
adaptive hope-fear learner
Diffstat (limited to 'utils/stringlib.h')
-rw-r--r-- | utils/stringlib.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/utils/stringlib.h b/utils/stringlib.h index f60b7867..2fdbfff8 100644 --- a/utils/stringlib.h +++ b/utils/stringlib.h @@ -242,6 +242,21 @@ void VisitTokens(std::string const& s,F f) { VisitTokens(mp.p,mp.p+s.size(),f); } +template <class F> +void VisitTokens(std::string const& s,F f, unsigned start) { + if (0) { + std::vector<std::string> ss=SplitOnWhitespace(s); + for (unsigned i=0;i<ss.size();++i) + f(ss[i]); + return; + } + //FIXME: + if (s.empty()) return; + mutable_c_str mp(s); + SLIBDBG("mp="<<mp.p); + VisitTokens(mp.p+start,mp.p+s.size(),f); +} + inline void SplitCommandAndParam(const std::string& in, std::string* cmd, std::string* param) { cmd->clear(); param->clear(); |