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@collabora.com>
This commit is contained in:
parent
ed6765d318
commit
92365b925c
1 changed files with 4 additions and 6 deletions
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue