aboutsummaryrefslogtreecommitdiffstats
path: root/libdevcore
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-08-15 03:38:07 +0800
committerGitHub <noreply@github.com>2018-08-15 03:38:07 +0800
commitcc54f6c4256cdccf4b25586ed63800caa836d9c6 (patch)
tree11fe607f1acbc6daaa8d17b30ac45db2f7981d77 /libdevcore
parent8f27fb1f4a14f369e8feb3ea22a38d50998cad5c (diff)
parent14e116c1d57e1797e7206299d0fdfed2aa03cdf2 (diff)
downloaddexon-solidity-cc54f6c4256cdccf4b25586ed63800caa836d9c6.tar.gz
dexon-solidity-cc54f6c4256cdccf4b25586ed63800caa836d9c6.tar.zst
dexon-solidity-cc54f6c4256cdccf4b25586ed63800caa836d9c6.zip
Merge pull request #4738 from ethereum/dataloc_merged
Enforce data location.
Diffstat (limited to 'libdevcore')
-rw-r--r--libdevcore/StringUtils.h28
1 files changed, 12 insertions, 16 deletions
diff --git a/libdevcore/StringUtils.h b/libdevcore/StringUtils.h
index 94c6e3c5..f05a426b 100644
--- a/libdevcore/StringUtils.h
+++ b/libdevcore/StringUtils.h
@@ -49,27 +49,23 @@ std::string joinHumanReadable
std::string const& _lastSeparator = ""
)
{
- auto it = begin(_list);
- auto itEnd = end(_list);
+ auto const itEnd = end(_list);
std::string result;
- // append first string
- if (it != itEnd)
+ for (auto it = begin(_list); it != itEnd; )
{
- result += *it;
+ std::string element = *it;
+ bool first = (it == begin(_list));
++it;
- }
-
- for (;it != itEnd; ++it)
- {
- if ((std::next(it) == itEnd) && !_lastSeparator.empty())
- result += _lastSeparator; // last iteration
- else
- result += _separator;
-
- // append string
- result += *it;
+ if (!first)
+ {
+ if (it == itEnd && !_lastSeparator.empty())
+ result += _lastSeparator; // last iteration
+ else
+ result += _separator;
+ }
+ result += std::move(element);
}
return result;