I'm trying to write a function to "stringify" parameters for logging purpose. For example, I'd like to write something like this:
vector<string> queries;
set<uint_8> filters;
LOG(INFO) << stringify<vector, string>(queries);
LOG(INFO) << stringify<set, uint_8>(filters);
Here is the function template I wrote:
template <typename containerType, typename elemType>
string _stringify(const string name, const containerType<elemType> &elems) {
ostringstream os;
os << name << ": [";
BOOST_FOREACH(elemType elem, elems) {
os << elem << ",";
}
os << "]";
return os.str();
}
Here is the error message I got: error: ‘containerType’ is not a template
Thanks, Alex