diff options
author | Ales Tamchyna <tamchyna@ufal.mff.cuni.cz> | 2015-01-06 17:19:34 +0300 |
---|---|---|
committer | Ales Tamchyna <tamchyna@ufal.mff.cuni.cz> | 2015-01-06 17:19:34 +0300 |
commit | e864a8d8df56740feb406fc005e3e50bae414191 (patch) | |
tree | 8749fe8a35417a78345a2394293594173c4b3285 /moses/Util.h | |
parent | d84094a4e0216257f12185b98d9486597e64d347 (diff) |
another utility function
Diffstat (limited to 'moses/Util.h')
-rw-r--r-- | moses/Util.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/moses/Util.h b/moses/Util.h index a595e9a3f..12038468e 100644 --- a/moses/Util.h +++ b/moses/Util.h @@ -331,6 +331,20 @@ std::string Join(const std::string& delimiter, const std::vector<T>& items) return outstr.str(); } +/* + * Convert any container to string + */ +template<typename It> +std::string Join(const std::string &delim, It begin, It end) +{ + std::ostringstream outstr; + if (begin != end) + outstr << *begin++; + for ( ; begin != end; ++begin) + outstr << delim << *begin; + return outstr.str(); +} + //! transform prob to natural log score inline float TransformScore(float prob) { |