diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2020-12-17 01:00:07 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2020-12-17 01:00:07 +0000 |
commit | eb0a0641fe2a576a743d7ec36a4b2bfec1ec37d7 (patch) | |
tree | fce408b577698bae8a623880aae3ec91b7f301c5 | |
parent | Fix implicit-dependency on types library (diff) | |
download | slicer-1.10.5.1.tar.bz2 slicer-1.10.5.1.tar.xz slicer-1.10.5.1.zip |
Fix case where prefix view could be of a moved stringslicer-1.10.5.1
-rw-r--r-- | slicer/tool/icemetadata.cpp | 6 |
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(); |