Merge pull request #1190 from georgthegreat/find-performance

Optimize std::string::find performance a bit
This commit is contained in:
Vissarion Fisikopoulos 2023-08-28 12:42:24 +03:00 committed by GitHub
commit 956998d37d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -456,7 +456,7 @@ public :
<< " x=\"" << get<0>(map_point) + offset_x << "\"" << " x=\"" << get<0>(map_point) + offset_x << "\""
<< " y=\"" << get<1>(map_point) + offset_y << "\"" << " y=\"" << get<1>(map_point) + offset_y << "\""
<< ">"; << ">";
if (s.find("\n") == std::string::npos) if (s.find('\n') == std::string::npos)
{ {
m_stream << s; m_stream << s;
} }

View File

@ -60,10 +60,10 @@ struct coordinate_cast<rational<T> >
// Note: decimal comma is not (yet) supported, it does (and should) not // Note: decimal comma is not (yet) supported, it does (and should) not
// occur in a WKT, where points are comma separated. // occur in a WKT, where points are comma separated.
std::string::size_type p = source.find("."); std::string::size_type p = source.find('.');
if (p == std::string::npos) if (p == std::string::npos)
{ {
p = source.find("/"); p = source.find('/');
if (p == std::string::npos) if (p == std::string::npos)
{ {
return rational<T>(atol(source.c_str())); return rational<T>(atol(source.c_str()));