diff --git a/src/utils.h b/src/utils.h index d02f232ab6..8ec8ffff8f 100644 --- a/src/utils.h +++ b/src/utils.h @@ -2,6 +2,7 @@ #define __UTILS__ #include +#include #define nothing() do {} while (0) @@ -9,4 +10,18 @@ boost::posix_time::ptime ptEpoch(); int iToSeconds(boost::posix_time::ptime ptWhen); boost::posix_time::ptime ptFromSeconds(int iSeconds); +template +std::string strJoin(Iterator first, Iterator last, std::string strSeperator) +{ + std::ostringstream ossValues; + + for (Iterator start = first; first != last; first++) + { + ossValues << str(boost::format("%s%s") % (start == first ? "" : strSeperator) % *first); + } + + return ossValues.str(); +} #endif + +// vim:ts=4