Subject: Re: a trait for contextual convertible to bool?
From: Ville Voutilainen (ville.voutilainen_at_[hidden])
Date: 2021-01-18 03:33:01
On Mon, 18 Jan 2021 at 11:26, Peter Sommerlad (C++) via Std-Discussion
> while trying to implement a better Bool than bool (no implicit
> artithmetic, no implicit conversion from arithmetic types) I figured
> that there is no trait that models contextual convertibility to bool,
> i.e., std::istream& is contextual convertible to bool, but
> std::is_convertible<std::istream&,bool> is false_type as well as
> std::convertible_to<std::istream&,bool> fails.
> Do other feel the need to have such a trait modelling contextual
> conversion to bool, or is there a trait that would allow that?
> I implemented my own that provides explicit conversion to bool from
> class types and pointers, which is what I want to support for my Bool type.
Why would I need such a trait? Is it something more than
STD-DISCUSSION list run by email@example.com
Older Archives on Google Groups