Add ConvToInt() template to go with ConvToStr() that we've had for a while

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6064 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
brain 2006-12-22 20:45:38 +00:00
parent b3a11cb400
commit 79939d71ba

View File

@ -71,6 +71,13 @@ template<typename T> inline std::string ConvToStr(const T &in)
return tmp.str();
}
template<typename T> inline long ConvToInt(const T &in)
{
std::stringstream tmp;
if (!(tmp << in)) return 0;
return atoi(tmp.str().c_str());
}
/** This class contains various STATS counters
* It is used by the InspIRCd class, which internally
* has an instance of it.