make (a < b < c) illegal?

Derek Parnell derek at psych.ward
Thu Feb 8 02:42:41 PST 2007


On Thu, 8 Feb 2007 16:36:47 +1100, Derek Parnell wrote:

> On Wed, 07 Feb 2007 19:51:06 -0800, Andrei Alexandrescu (See Website For
> Email) wrote:
> 
> 
>> It's really simple:
>> 
>> bool ordered(T, U, V)(T a, U b, V c)
>> {
>>    return a < b && b < c;
>> }
>> Expanding this to multiple arguments is also quite simple, but left as 
>> an exercise. :o)
> 
> Okay, I'll give it a go, but I'm not confident. 

I give up. I can't work out how to create this functionality for an
arbitary number of arguments. 

 e.g. When I code ...

  ordered(a,b,c,d,e)

I want generated ...

  (a < b) && (b < c) && (c < d) && (d < e)

I can't work out how to loop through the tuple. 

I started with 

  template ordered(T ...)
  {
  }

And everything I tried after that just didn't work.

-- 
Derek Parnell
Melbourne, Australia
"Justice for David Hicks!"
skype: derek.j.parnell



More information about the Digitalmars-d mailing list