diff options
author | Patrick Simianer <p@simianer.de> | 2011-10-10 22:39:41 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2011-10-10 22:39:41 +0200 |
commit | e377e9de738773d03e600681b0f0d2797df717c6 (patch) | |
tree | 4bd4a32c498c115886ae3b1165a469678241cc00 /dtrain/dtrain.h | |
parent | abc2919ccf6cb57dd0320716cad378866b08054a (diff) |
speed
Diffstat (limited to 'dtrain/dtrain.h')
-rw-r--r-- | dtrain/dtrain.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/dtrain/dtrain.h b/dtrain/dtrain.h index 34464e3c..e98ef470 100644 --- a/dtrain/dtrain.h +++ b/dtrain/dtrain.h @@ -38,6 +38,18 @@ inline string gettmpf(const string path, const string infix, const string suffix return string(fn); } +inline void split_in(string& s, vector<string>& parts) +{ + unsigned f = 0; + for(unsigned i = 0; i < 3; i++) { + unsigned e = f; + f = s.find("\t", f+1); + if (e != 0) parts.push_back(s.substr(e+1, f-e-1)); + else parts.push_back(s.substr(0, f)); + } + s.erase(0, f+1); +} + inline ostream& _np(ostream& out) { return out << resetiosflags(ios::showpos); } inline ostream& _p(ostream& out) { return out << setiosflags(ios::showpos); } inline ostream& _p2(ostream& out) { return out << setprecision(2); } |