summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2018-12-12 20:34:46 +0000
committerPeter Powell <petpow@saberuk.com>2018-12-12 21:43:24 +0000
commit0f7cfd46ef2d277f5f82e34a2852c75212d75261 (patch)
tree73445b54ad2ce50ae75999ec9f939ff1097b057a /include
parent4e0cb28c1913c4ef76dd06b04fe321afe310f232 (diff)
Fix conversion issues by replacing ConvToInt with ConvToNum<T>.
The former was a thin wrapper around atol and brought with it all of the weird parsing logic of atol which is almost never what is actually wanted. It also almost never returned the numeric type which is actually wanted which can cause weird issues when casting.
Diffstat (limited to 'include')
-rw-r--r--include/convto.h11
1 files changed, 1 insertions, 10 deletions
diff --git a/include/convto.h b/include/convto.h
index c306283fc..3332580ed 100644
--- a/include/convto.h
+++ b/include/convto.h
@@ -89,17 +89,8 @@ template <class T> inline std::string ConvToStr(const T& in)
return tmp.str();
}
-/** Template function to convert any input type to any other type
- * (usually an integer or numeric type)
+/** Template function to convert a std::string to any numeric type.
*/
-template<typename T> inline long ConvToInt(const T& in)
-{
- std::stringstream tmp;
- if (!(tmp << in))
- return 0;
- return atol(tmp.str().c_str());
-}
-
template<typename TOut> inline TOut ConvToNum(const std::string& in)
{
TOut ret;