[Libreoffice-commits] core.git: include/comphelper
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jan 13 20:32:58 UTC 2021
include/comphelper/stl_types.hxx | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
New commits:
commit 1a24fef6b3e24645dccfa7f13dd71d8f5019dd94
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Wed Jan 13 15:17:44 2021 +0100
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Jan 13 21:32:16 2021 +0100
Simplify comphelper::ContainerUniquePtrEquals
Change-Id: I93ac0a1879559aad146b9b846ba33a18467afb95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109126
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/include/comphelper/stl_types.hxx b/include/comphelper/stl_types.hxx
index 73e16e1a6d03..613644ad218a 100644
--- a/include/comphelper/stl_types.hxx
+++ b/include/comphelper/stl_types.hxx
@@ -21,6 +21,7 @@
#include <sal/config.h>
+#include <algorithm>
#include <memory>
#include <string_view>
@@ -81,20 +82,9 @@ bool ContainerUniquePtrEquals(
C<std::unique_ptr<T>, Etc...> const& lhs,
C<std::unique_ptr<T>, Etc...> const& rhs)
{
- if (lhs.size() != rhs.size())
- {
- return false;
- }
- for (auto iter1 = lhs.begin(), iter2 = rhs.begin();
- iter1 != lhs.end();
- ++iter1, ++iter2)
- {
- if (!(**iter1 == **iter2))
- {
- return false;
- }
- }
- return true;
+ return lhs.size() == rhs.size()
+ && std::equal(lhs.begin(), lhs.end(), rhs.begin(),
+ [](auto& p1, auto& p2) { return *p1 == *p2; });
};
More information about the Libreoffice-commits
mailing list