summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-10-23 23:11:34 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2021-10-24 00:04:58 +0200
commit667c2499d861cfcd26935fc0512cb5aaf602c4c5 (patch)
tree1573a6f8dc6f0aa2343c08ed621d89ff1a65e1f5 /include
parentb66ed4cb3707800b8bd9ab0f397c226037e10fbf (diff)
Use std::transform instead of loop
Change-Id: I1fa2eaec67bd5e85d09d4d662deede34d3388176 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124016 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/comphelper/sequence.hxx10
1 files changed, 4 insertions, 6 deletions
diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx
index d446894574e5..ada6ee27b4ef 100644
--- a/include/comphelper/sequence.hxx
+++ b/include/comphelper/sequence.hxx
@@ -291,9 +291,8 @@ namespace comphelper
inline css::uno::Sequence< typename M::key_type > mapKeysToSequence( M const& map )
{
css::uno::Sequence< typename M::key_type > ret( static_cast<sal_Int32>(map.size()) );
- typename M::key_type* pArray = ret.getArray();
- for (const auto& i : map)
- *pArray++ = i.first;
+ std::transform(map.begin(), map.end(), ret.getArray(),
+ [](const auto& i) { return i.first; });
return ret;
}
@@ -301,9 +300,8 @@ namespace comphelper
inline css::uno::Sequence< typename M::mapped_type > mapValuesToSequence( M const& map )
{
css::uno::Sequence< typename M::mapped_type > ret( static_cast<sal_Int32>(map.size()) );
- typename M::mapped_type* pArray = ret.getArray();
- for (const auto& i : map)
- *pArray++ = i.second;
+ std::transform(map.begin(), map.end(), ret.getArray(),
+ [](const auto& i) { return i.second; });
return ret;
}