tuple of ranges - findSplit

Tove tove at fransson.se
Wed May 23 14:56:35 PDT 2012


I'm currently designing an interface, which conceptually is 
similar to findSplit... so I decided to peek at/learn from 
Phobos...

"findSplit returns a tuple result containing three ranges"

tuple(haystack[0 .. pos1],haystack[pos1 .. pos2], haystack[pos2 
.. haystack.length]);

As one easiliy can spot, pos1 and pos2 occurs twice... in 
isolated cases it doesn't matter, but in my case I was planning 
to generate a number of these.

Hmmm... just wondering, did anyone already design/implement a 
pretty/efficient interface ontop of a structure similar to below?

struct
{
   uint r0;
   union
   {
     uint r1
     uint r2
   }
   union
   {
     uint r3
     uint r4
   }
   uint r5;
}



More information about the Digitalmars-d mailing list