Template specialization (boost::lexical_cast)
问题 I want to extend the lexical_cast method for vector<uint> types, but it's not working. I tried the following code: #include <boost/lexical_cast.hpp> namespace boost { template <> inline string lexical_cast <string>(vector<uint> source) { string tmp; for (size_t i = 0; i < source.size(); ++i) if (i < source.size() - 1) tmp += boost::lexical_cast<string>(source[i]) + "|"; else tmp += boost::lexical_cast<string>(source[i]); return tmp; } } I got following error: error: template-id ‘lexical_cast’