diff options
-rw-r--r-- | slicer/slicer/metadata.h | 13 |
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(); |