On Sun, 2011-03-06 at 14:57 +0100, Simen kjaeraas wrote:
[ . . . ]
> You should use std.range.iota(0,numberOfThreads) instead of
> 0..numberOfThreads. Having a..b return a general interval range
> has been proposed numerous times, but nothing has been implemented as
> of yet.

Thanks for this pointer.

> If you like syntactic sugar, this is likely the closest you'll get at
> this point:
> 
> import std.range;
> 
> struct _ {
>      auto opSlice(B,E)(B begin, E end) {
>          return iota(begin, end);
>      }
> }
> 
> // Example:
> map!foo( _[0..numberOfThreads] );

Interesting.  I am not sure I would do this, instead just going with the
explicit iota.

It would be better though if x..y (and x..<y) were standard parts of the
syntax. 

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:[email protected]
41 Buckmaster Road    m: +44 7770 465 077   xmpp: [email protected]
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to