]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Add ConvToInt() template to go with ConvToStr() that we've had for a while
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 22 Dec 2006 20:45:38 +0000 (20:45 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 22 Dec 2006 20:45:38 +0000 (20:45 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6064 e03df62e-2008-0410-955e-edbf42e46eb7

include/inspircd.h

index 6c078b1d5ca56292e74a46145ca532efde2274d2..4648eaf69140b84325bb28a516af9c9480fa15c5 100644 (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.