mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-29 06:52:34 +03:00
Use stringstream operation instead of atoi and atof to prevent error and overflow
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@2934 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
parent
50c22f1e42
commit
133f18bd90
@ -76,20 +76,6 @@ inline T Scan(const std::string &input)
|
||||
return ret;
|
||||
}
|
||||
|
||||
//! Specialisation for performance
|
||||
template<>
|
||||
inline int Scan<int>(const std::string &input)
|
||||
{
|
||||
return atoi(input.c_str());
|
||||
}
|
||||
|
||||
//! Specialisation for performance
|
||||
template<>
|
||||
inline float Scan<float>(const std::string &input)
|
||||
{
|
||||
return (float) atof(input.c_str());
|
||||
}
|
||||
|
||||
//! just return input
|
||||
template<>
|
||||
inline std::string Scan<std::string>(const std::string &input)
|
||||
|
Loading…
Reference in New Issue
Block a user