The new ?? and ??? operators

Janice Caron caron800 at googlemail.com
Tue Sep 25 05:16:37 PDT 2007


How about this..

T maybe(T)(T * ptr, lazy T default)
{
	if (ptr !is null) return *ptr;
	return default;
}

long p = maybe(get("A"), maybe(get("B"), maybe(get("C"),
maybe(get("D"), maybe(get("E"), 0 )))));



More information about the Digitalmars-d mailing list