From e377e9de738773d03e600681b0f0d2797df717c6 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Mon, 10 Oct 2011 22:39:41 +0200 Subject: speed --- dtrain/dtrain.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'dtrain/dtrain.h') 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& 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); } -- cgit v1.2.3