On Sat, Jan 4, 2014 at 1:08 AM, Ali Çehreli <acehr...@yahoo.com> wrote:

> 3) The member rangeFront is needed because Tuple does not have opIndex for
> dynamic indexes. I can do range.front[0] but I cannot do
> range.front[currentIndex].

Is there any plan to add indexing on runtime indices to Tuple? It can
be done, by generating a specific runtime opIndex for Tuple, if the
types held in the tuple have a common type.


CommonType!Types opIndex(size_t index)
{
    // generated code, say Types is 3-element long:
    switch(index)
    {
        case 0:
            return values[0];
        case 1:
            return values[1];
        case 2:
            return values[2];
      default:
            throw new OutOfRangeException(...);
    }
}

Reply via email to