challenge: implement the max function

Lionello Lunesu lionello at lunesu.remove.com
Sun Jan 21 12:21:41 PST 2007


"Andrei Alexandrescu (See Website For Email)" 
<SeeWebsiteForEmail at erdani.org> wrote in message 
news:45B3B243.2010103 at erdani.org...
> Here's a simple challenge: implement the max function. Requirements:
>
> a) generic
> b) efficient
> c) preserve lvalueness when possible such that one can write e.g.
>
> max(arr[0], arr[1]) *= 0.9;

...when would that be useful? And, what happens if arr[0]==arr[1] ?

L. 





More information about the Digitalmars-d mailing list