std.date proposal
    Walter Bright 
    newshound at digitalmars.com
       
    Thu Apr  6 00:24:35 PDT 2006
    
    
  
Fredrik Olsson wrote:
> Perhaps a better example:
> Item[] itemsInRange(Item[] items, d_date start, d_date end) {
>   Item[] ret;
>   foreach (Item item; items) {
>     if (isInRange(item.date, start, end)
>       ret ~= item;
>   }
>   return ret;
> }
> 
> Introducing itemsBefore() and itemsAfter() could be done, but less code 
> for the same functionality would be to simply send "infinity" to 
> itemsInTange's start or end. And now it would be nice with a set 
> standard for "what is infinity".
You can use d_time.max and d_time.min. I also don't understand why use 
isInRange rather than < and >.
> Best would be if the properties min and max could be made for typedefs, 
> and maybe introduce your own, such as nad for "not a date".
There's already a d_time_nan for just that purpose.
    
    
More information about the Digitalmars-d-announce
mailing list