summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2020-12-17 01:00:07 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2020-12-17 01:00:07 +0000
commiteb0a0641fe2a576a743d7ec36a4b2bfec1ec37d7 (patch)
treefce408b577698bae8a623880aae3ec91b7f301c5
parentFix implicit-dependency on types library (diff)
downloadslicer-eb0a0641fe2a576a743d7ec36a4b2bfec1ec37d7.tar.bz2
slicer-eb0a0641fe2a576a743d7ec36a4b2bfec1ec37d7.tar.xz
slicer-eb0a0641fe2a576a743d7ec36a4b2bfec1ec37d7.zip
Fix case where prefix view could be of a moved stringslicer-1.10.5.1
-rw-r--r--slicer/tool/icemetadata.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/slicer/tool/icemetadata.cpp b/slicer/tool/icemetadata.cpp
index 64806d6..0d8d7bc 100644
--- a/slicer/tool/icemetadata.cpp
+++ b/slicer/tool/icemetadata.cpp
@@ -5,9 +5,9 @@ namespace Slicer {
IceMetaData::IceMetaData(Slice::StringList && a)
{
arr.reserve(a.size());
- std::transform(a.begin(), a.end(), std::back_inserter(arr), [](auto a) {
- auto prefix = std::string_view(a).substr(0, a.rfind(':'));
- return std::make_pair(std::move(a), prefix);
+ std::for_each(a.begin(), a.end(), [this](auto && a) {
+ auto & md = arr.emplace_back(a, std::string_view {});
+ md.second = std::string_view(md.first).substr(0, md.first.rfind(':'));
});
_begin = arr.begin();
_end = arr.end();