nWayUnion(tuple)?

Chris Cain clcain at uncg.edu
Wed Feb 27 16:35:11 PST 2013


On Wednesday, 27 February 2013 at 23:54:31 UTC, Chris Cain wrote:
> I'm not sure how common the use case is, but I think it'd be 
> fairly easy to support.
>
> Just internally have an array of indices to the tuple and use 
> the heap with a less defined like "myTup[a] < myTup[b]" to use 
> the indices to look into the tuple to sort the indices 
> appropriately. Just add some compile-time checks to make sure 
> all of the ElementTypes of the tuple agree and it's essentially 
> the same thing as already implemented.
>
> It actually probably wouldn't be a terrible idea to write a 
> wrapper range that does this type of process so that it may be 
> used with anything and the wrapper range could be a 
> RandomAccessRange... this would (probably) make it possible to 
> use tuples in a lot of places it isn't exactly allowed right 
> now.

I thought about this a bit more and I see that this is simply not 
a solution to the problem at all. I'm playing around with some 
things and if I come up with a solution in code, I'll post it.


More information about the Digitalmars-d-learn mailing list