Neargye / magic_enum

Static reflection for enums (to string, from string, iteration) for modern C++, work with any enum type without any macro or boilerplate code
MIT License
4.99k stars 445 forks source link

Implicit conversion from containers::bitset to bool #285

Closed labankallgren closed 1 year ago

labankallgren commented 1 year ago

Is there anyway to implicitly check the boolean value of a containers::bitset, or must one use containers::bitset::any() method for that? What I'd like to do:

containers::bitset<T> A{};
containers::bitset<T> B{};
if(A & B) {
  // ...
}
Neargye commented 1 year ago

I looked at the problem in detail, the std::bitset does not have such bool operator, it is better to really use any().