summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-04-15 17:28:06 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2022-04-15 17:28:06 +0100
commitf94674e9a8bc3e19d45f071818e787c32153585f (patch)
tree30270d6dd89f4376c26ff27e3768dbe1e6a8c3e6
parentFixup parameter forwarding (diff)
downloadslicer-f94674e9a8bc3e19d45f071818e787c32153585f.tar.bz2
slicer-f94674e9a8bc3e19d45f071818e787c32153585f.tar.xz
slicer-f94674e9a8bc3e19d45f071818e787c32153585f.zip
Fix shadowing in metadata and simplify
-rw-r--r--slicer/slicer/metadata.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/slicer/slicer/metadata.h b/slicer/slicer/metadata.h
index 8aa65c9..bf2fcef 100644
--- a/slicer/slicer/metadata.h
+++ b/slicer/slicer/metadata.h
@@ -110,14 +110,11 @@ namespace Slicer {
using Arr = ContainerBase<N>;
constexpr inline explicit MetaDataImpl(const std::array<std::string_view, N> & a) :
arr {[&a]() {
- Arr arr;
- auto out = arr.begin();
- for (const auto & md : a) {
- out->first = md;
- out->second = out->first.substr(0, out->first.rfind(':'));
- out++;
- }
- return arr;
+ Arr rtn;
+ std::transform(a.begin(), a.end(), rtn.begin(), [](const auto & md) -> typename Arr::value_type {
+ return {md, md.substr(0, md.rfind(':'))};
+ });
+ return rtn;
}()}
{
_begin = arr.begin();