How would i remove flags from my enum
I can add them easy with m_Buttons | (button);
enum WindowButton
{
None = 0,
Minimize = (1 << 0),
Maximize = (1 << 1),
Close = (1 << 2),
};
inline WindowButton operator|(WindowButton a, WindowButton b)
{
return static_cast<WindowButton>(static_cast<int>(a) | static_cast<int>(b));
}
inline WindowButton& operator |= (WindowButton& lhs, WindowButton rhs)
{
return lhs = static_cast<WindowButton>(static_cast<WindowButton>(lhs) | static_cast<WindowButton>(rhs));
}
This is the function where im trying to add / remove
void Window::SetButton(WindowButton button, bool show)
{
if (show)
m_Buttons |= (button);
else
m_Buttons | ~(button); // This is not working to remove flags
}