QList generic join() function with template
问题 I am trying to make a generic join() function for QList (like join() for QStringList) in order to make a toString() function for a QList of any type. This function takes a QList, a separator and a function to dertermine how to print items. Consider this code : #include <QList> #include <QDebug> template <class T> static QString join(const QList<T> &list, const QString &separator, const std::function< QString (const T &item) > toStringFunction) { QString out; for(int i = 0; i<list.size(); i++)