mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-25 06:36:37 +01:00
Can't cash str.begin when "insert" is involved.
This commit is contained in:
@@ -93,12 +93,11 @@ void insertThousandSep(std::string& str, char thSep, char decSep = '.')
|
|||||||
std::string::size_type decPos = str.find(decSep);
|
std::string::size_type decPos = str.find(decSep);
|
||||||
// there's no rinsert, using forward iterator to go backwards
|
// there's no rinsert, using forward iterator to go backwards
|
||||||
std::string::iterator it = str.end();
|
std::string::iterator it = str.end();
|
||||||
std::string::iterator begin = str.begin();
|
|
||||||
if (exPos != std::string::npos) it -= str.size() - exPos;
|
if (exPos != std::string::npos) it -= str.size() - exPos;
|
||||||
|
|
||||||
if (decPos != std::string::npos)
|
if (decPos != std::string::npos)
|
||||||
{
|
{
|
||||||
while (it != begin)
|
while (it != str.begin())
|
||||||
{
|
{
|
||||||
--it;
|
--it;
|
||||||
if (*it == decSep) break;
|
if (*it == decSep) break;
|
||||||
@@ -106,7 +105,7 @@ void insertThousandSep(std::string& str, char thSep, char decSep = '.')
|
|||||||
}
|
}
|
||||||
int thCount = 0;
|
int thCount = 0;
|
||||||
if (it == str.end()) --it;
|
if (it == str.end()) --it;
|
||||||
for (; it != begin;)
|
for (; it != str.begin();)
|
||||||
{
|
{
|
||||||
std::string::iterator pos = it;
|
std::string::iterator pos = it;
|
||||||
std::string::value_type chr = *it;
|
std::string::value_type chr = *it;
|
||||||
|
|||||||
Reference in New Issue
Block a user