Nullable or Optional? Or something else?

Rainer Deyke rainerd at eldwood.com
Tue Sep 8 16:28:07 PDT 2009


Rainer Deyke wrote:
> struct AlgebraicFunction {
>   double getMaximum() {

This 'double' was obviously supposed to be 'Optional!double'.

>     if (isNull(this.cachedMaximum)) {
>       this.cachedMaximum = this.veryExpensiveCalculation();
>     }
>     return *this.cachedMaximum;
>   }
> 
>   private Optional!(Optional!double) cachedMaximum;
> }


-- 
Rainer Deyke - rainerd at eldwood.com



More information about the Digitalmars-d mailing list