This is the mail archive of the
mailing list for the GCC project.
Re: [v3 PATCH] Implement P0307R2, Making Optional Greater Equal Again.
2016-07-13 12:05 GMT+02:00 Ville Voutilainen <email@example.com>:
> On 13 July 2016 at 01:31, Jonathan Wakely <firstname.lastname@example.org> wrote:
>> On 11/07/16 23:41 +0300, Ville Voutilainen wrote:
>>> @@ -785,41 +785,60 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>>> + template<typename _Tp>
>>> + using __optional_relop_t =
>>> + enable_if_t<is_constructible<bool, _Tp>::value, bool>;
>> Should this be is_convertible<_Tp, bool> instead?
> Yeah.. it would be more reasonable to return a type explicitly
> convertible to bool from a relop
> if a non-bool is returned, but since built-in operators are not
> that "protection" wouldn't buy much. And since the implementation
> doesn't really do bool-wrappings
> everywhere, let's go with is_convertible and change that if someone complains.
How would you feel about the introduction of an internal trait
__is_boolean_testable, that would test both is_convertible<const T&,
bool> and is_constructible<bool, const T&> for now, so that we could
reuse that at places like these and others pointed out by LWG 2114?
If you like that idea, I would work on a contribution.