On Monday, 19 February 2018 at 17:22:04 UTC, Nathan S. wrote:
On Monday, 19 February 2018 at 15:12:15 UTC, Tony wrote:
But, assuming there is a use case for it, what if you want to restrict to a type that is either boolean, or a struct/class that can substitute for boolean - how do you do that without using the "private" BooleanTypeOf thing?



In that case you can just write `is(T : bool)`.

Thanks.

Assuming it would substitute, that should probably be used on this page in place of BooleanTypeOf since BooleanTypeOf is not supposed to be public:

https://dlang.org/library/std/traits/is_boolean.html

"enum isBoolean(T) = is(BooleanTypeOf!T) && !isAggregateType!T;"


Reply via email to