Date: Mon, 18 Jan 2021 10:25:14 +0100
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.
Thoughts
Regards
Peter.
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.
Thoughts
Regards
Peter.
-- 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:25:22