summaryrefslogtreecommitdiff
path: root/src/utils/stringutils.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-05 02:20:12 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-05 02:20:12 +0300
commit54fd7526e6a1d2d161fda10bccd609ec078b8fa9 (patch)
treeb2ef7a31891a0351f1053f6804a8abe4ff1ea895 /src/utils/stringutils.h
parentbc4957b24e6939f4e681e9412f9bbdd483a6bc35 (diff)
downloadManaVerse-54fd7526e6a1d2d161fda10bccd609ec078b8fa9.tar.gz
ManaVerse-54fd7526e6a1d2d161fda10bccd609ec078b8fa9.tar.bz2
ManaVerse-54fd7526e6a1d2d161fda10bccd609ec078b8fa9.tar.xz
ManaVerse-54fd7526e6a1d2d161fda10bccd609ec078b8fa9.zip
Add fast versions for function toString for different types.
Diffstat (limited to 'src/utils/stringutils.h')
-rw-r--r--src/utils/stringutils.h25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index da75a42fa..cc479d80c 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -64,20 +64,25 @@ std::string &toUpper(std::string &str);
*/
unsigned int atox(const std::string &str) A_WARN_UNUSED;
-template<typename T> std::string toString(const T &arg) A_WARN_UNUSED;
-
/**
- * Converts the given value to a string using std::stringstream.
+ * Converts the given value to a string.
*
- * @param arg the value to convert to a string
+ * @param num the value to convert to a string
* @return the string representation of arg
*/
-template<typename T> std::string toString(const T &arg)
-{
- std::stringstream ss;
- ss << arg;
- return ss.str();
-}
+std::string toString(unsigned int num);
+
+std::string toString(size_t num);
+
+std::string toString(unsigned char num);
+
+std::string toString(int num);
+
+std::string toString(uint16_t num);
+
+std::string toString(float num);
+
+std::string toString(double num);
std::string toStringPrint(const unsigned int val);