| 195 | // Note: If `flag` equals 0, it returns false, as 0 is not a flag. |
| 196 | template <typename E> |
| 197 | constexpr auto enum_flags_test(E flags, E flag) noexcept -> detail::enable_if_t<E, bool> { |
| 198 | using U = underlying_type_t<E>; |
| 199 | |
| 200 | return static_cast<U>(flag) && ((static_cast<U>(flags) & static_cast<U>(flag)) == static_cast<U>(flag)); |
| 201 | } |
| 202 | |
| 203 | // Returns true if `lhs flags set` and `rhs flags set` have common flags. |
| 204 | // Note: If `lhs flags set` or `rhs flags set` equals 0, it returns false, as 0 is not a flag, and therfore cannot have any matching flag. |