diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-05-29 21:16:15 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-05-29 21:16:15 +0400 |
commit | 6249432407af8730c10bccc7894c0725fcaf5e47 (patch) | |
tree | 3ac1f094b9fdc199b04bc5ef209ce00e3596e37d /moses/Util.h | |
parent | 59bd7deb4b6b9c4f7b3b7dbb055783528fbc31ca (diff) |
beautify
Diffstat (limited to 'moses/Util.h')
-rw-r--r-- | moses/Util.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/moses/Util.h b/moses/Util.h index 9f43d9dc3..e5bdc820a 100644 --- a/moses/Util.h +++ b/moses/Util.h @@ -363,27 +363,27 @@ std::string PassthroughSGML(std::string &line, const std::string tagName,const s */ inline std::string GetFirstString(const std::string& str, int& first_pos, const std::string& delimiters = " \t") { - - std::string first_str; - // Skip delimiters at beginning. - std::string::size_type lastPos = str.find_first_not_of(delimiters, first_pos); - - // Find first "non-delimiter". - std::string::size_type pos = str.find_first_of(delimiters, lastPos); - - if (std::string::npos != pos || std::string::npos != lastPos){ - - first_str = str.substr(lastPos, pos - lastPos); - - // Skip delimiters. Note the "not_of" - lastPos = str.find_first_not_of(delimiters, pos); - - } - - first_pos = lastPos; - return first_str; + + std::string first_str; + // Skip delimiters at beginning. + std::string::size_type lastPos = str.find_first_not_of(delimiters, first_pos); + + // Find first "non-delimiter". + std::string::size_type pos = str.find_first_of(delimiters, lastPos); + + if (std::string::npos != pos || std::string::npos != lastPos) { + + first_str = str.substr(lastPos, pos - lastPos); + + // Skip delimiters. Note the "not_of" + lastPos = str.find_first_not_of(delimiters, pos); + + } + + first_pos = lastPos; + return first_str; } - + template<class T> T log_sum (T log_a, T log_b) { |