QFlags::setFlag: don't go through Int, go through QFlags itself
Avoid a "detour" outside QFlags' type safety: operator~ is defined on QFlags already, use that one. Change-Id: Iedd07d1652b8f92e3881298ceafcd5c761346bb0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
e4ed47ef4a
commit
3e2e0dde47
@ -143,7 +143,7 @@ public:
|
|||||||
constexpr inline bool testFlag(Enum flag) const noexcept { return (i & Int(flag)) == Int(flag) && (Int(flag) != 0 || i == Int(flag) ); }
|
constexpr inline bool testFlag(Enum flag) const noexcept { return (i & Int(flag)) == Int(flag) && (Int(flag) != 0 || i == Int(flag) ); }
|
||||||
constexpr inline QFlags &setFlag(Enum flag, bool on = true) noexcept
|
constexpr inline QFlags &setFlag(Enum flag, bool on = true) noexcept
|
||||||
{
|
{
|
||||||
return on ? (*this |= flag) : (*this &= ~Int(flag));
|
return on ? (*this |= flag) : (*this &= ~QFlags(flag));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user