[cfe-dev] [libc++] Should std::max allow types that require explicit bool conversion?
Tim Northover via cfe-dev
cfe-dev at lists.llvm.org
Thu Jul 5 11:39:46 PDT 2018
On Thu, 5 Jul 2018 at 19:23, Jö Fahlke via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
> I was surprised to find that I cannot use libc++'s `std::max(a, b)` if `a<b`
> yields an object with an explicit operator bool. Is that intended, or should
> I file a bug?
std::max is defined to work on types that are "LessThanComparable",
which in turn requires the result of "a < b" to be *implicitly*
convertible to bool
"explicit operator bool" (fairly unsurprisingly) doesn't qualify.
More information about the cfe-dev