[Libreoffice-commits] core.git: include/vcl
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jan 27 06:41:55 UTC 2021
include/vcl/errcode.hxx | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
New commits:
commit 92365b925c5b05ad92ca592b158ae7e8492c3a4a
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Tue Jan 26 09:43:32 2021 +0100
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Jan 27 07:41:16 2021 +0100
Simplify ErrCode::anyOf using binary left fold
This accepts arguments with implicit operator== available
Change-Id: Ibaf750471798948bf419e463252f67d470b485de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109884
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/include/vcl/errcode.hxx b/include/vcl/errcode.hxx
index d189f038539b..e43b6b65dd49 100644
--- a/include/vcl/errcode.hxx
+++ b/include/vcl/errcode.hxx
@@ -141,14 +141,12 @@ public:
return "0x" + OUString::number(m_value, 16);
}
- bool anyOf(ErrCode v) const {
- return *this == v;
+ template <typename... Args> bool anyOf(Args... args) const
+ {
+ static_assert(sizeof...(args) > 0);
+ return (... || (*this == args));
}
- template<typename... Args>
- bool anyOf(ErrCode first, Args... args) const {
- return *this == first || anyOf(args...);
- }
private:
sal_uInt32 m_value;
};
More information about the Libreoffice-commits
mailing list