Project Elvis

Ola Fosheim Grøstad ola.fosheim.grostad+dlang at gmail.com
Sun Oct 29 14:35:15 UTC 2017


On Sunday, 29 October 2017 at 14:27:34 UTC, Ola Fosheim Grøstad 
wrote:
> On Sunday, 29 October 2017 at 11:23:19 UTC, Steven 
> Schveighoffer wrote:
>>> So, what will the member function be called? «opElvis»? No…
>>
>> opCast for bool.
>
> That means you cannot create your own type-safe filtering 
> mechanism, but will be forced to provide opCast for bool.

That breaks down if you want do filter out invalid values where 
zero is a valid value. For instance if you have an integer type 
that tracks overflow:

calc(maybe_overflow_integer :? 0)

So casting to bool is a poor choice for the typical use context.



More information about the Digitalmars-d mailing list