I have this function that I'd like to use for a container of strings, like vector<string>
or set<string>
. Obviously templating seems like the best solution here but I'm not sure how to template the container. I tried this but it doesn't work:
template<class T>
string pack_addrs(T<string>& caddrs) {
string res = "";
for (string addr : caddrs) {
res += addr + ",";
}
return res.substr(0, res.size()-1);
}