I am trying to compile some code, in one of my headers I have the following function in the global namespace:
template <class T> inline T to_type<T> (const std::string& string) { std::stringstream ss(string); T value; ss >> value; return value; }
But for some reason this causes the g ++ expected initializer before '<' token
error (I changed one of the quotes to resolve the conflict with SO formatting)
I do not understand this error. Why is to_type
not a valid initializer? This is the first time this symbol has been used. How to fix this fragment?
source share