The new ?? and ??? operators

Janice Caron caron800 at googlemail.com
Tue Sep 25 04:45:18 PDT 2007


> Or chaining lots of tests together
>
> long id = *( get("A") || get("B") || get("C") || get("D") || &default );

Oh wait! That won't work, because you can't overload ||. Still, it was good try.

I think it would be kinda cool if || could be overloaded to accept
pointer inputs. That is, if the LHS and RHS were both of type T* then
the expression (lhs || rhs) could also have type T*, and would mean
((lhs !is null) ? lhs : rhs).

That would be much nicer than introducing new operators. (It's still a
change to the language though).



More information about the Digitalmars-d mailing list