On 11/10/2015 11:24 PM, Xidorn Quan wrote: > On Wed, Nov 11, 2015 at 6:21 PM, Daniel Holbert <[email protected]> wrote: >> >> P.S. (I can work around this by adding an "operator bool" to the >> CastableTypedEnumResult type-definition in mfbt/TypedEnumBits.h. Maybe >> that's something we should do.) > > We should just add "explicit operator bool() const;" to > CastableTypedEnumResult, which we are allowed to use since VS2012 > support was dropped.
Cool -- though, are you sure we'd want "explicit"? The point of my email was that *implicit* conversion to bool is convenient & desirable (IMO) for these bitmask types, particularly when passing them as a boolean function-argument. I don't see too much danger from bool-conversion here, and I'd much rather type: SomeFunc(foo | MyMaskType::SomeBit); ...rather than having to use explicit conversion like: SomeFunc(static_cast<bool>(foo | MyMaskType::SomeBit))); If we use the "explicit" keyword, then we'd have to resort to the second example here. (or we'd have to use "!!", or we'd have to rewrite SomeFunc to stop taking a bool) ~Daniel _______________________________________________ dev-tech-layout mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-layout

