DEV Community

Discussion on: Bitwise enumerations

Collapse
 
pgradot profile image
Pierre Gradot

In this function:

    const bool isRhsSet = std::any_of(mxs.begin(), mxs.end(), [lhs](CarOptions option) {
        return static_cast<bool>(lhs & option);
    });
Enter fullscreen mode Exit fullscreen mode

shouldn't we capture rhs instead?

I wonder if the function is also correctly named. Could it be named isRhsExclusive?

Collapse
 
sandordargo profile image
Sandor Dargo

Thanks, Pierre! Indeed, I shouldn't have duplicated the lines! I updated. The name could also be better, let me update it.
Thanks for the remarks.

Collapse
 
pgradot profile image
Pierre Gradot

You're welcome :)