On Wednesday, 8 October 2014 at 23:28:34 UTC, bearophile wrote:
anonymous:

You can turn the tuples into ranges with `only`:

writef("%(%(%s %)\n%)", zip(indexes, source).map!(t => only(t.expand)));

This is a nice idea. Expand can probably be replaced by a []. I presume this works only if the types inside the tuple are the same.

Expand creates "returns" a TypeTuple though, so it's arguably "free". "[]" allocates a dynamic array, so is costly.

On the flip side, "only" is *entirelly* by value, and carries all its arguments. If the tuple is big, then the range can become quite big.

Reply via email to