Date: Mon, 18 Jan 2021 10:54:33 +0100
Thanks Ville,
that was the trait I was looking for
Peter.
Ville Voutilainen wrote on 18.01.21 10:33:
> On Mon, 18 Jan 2021 at 11:26, Peter Sommerlad (C++) via Std-Discussion
> <std-discussion_at_[hidden]> wrote:
>>
>> Hi
>>
>> 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
> constructible_from<bool, T>?
>
that was the trait I was looking for
Peter.
Ville Voutilainen wrote on 18.01.21 10:33:
> On Mon, 18 Jan 2021 at 11:26, Peter Sommerlad (C++) via Std-Discussion
> <std-discussion_at_[hidden]> wrote:
>>
>> Hi
>>
>> 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
> constructible_from<bool, T>?
>
-- Peter Sommerlad Better Software: Consulting, Training, Reviews Modern, Safe & Agile C++ peter.cpp_at_[hidden] +41 79 432 23 32
Received on 2021-01-18 03:54:39