On Sunday, 8 May 2016 at 22:37:44 UTC, Dicebot wrote:
On Sunday, 8 May 2016 at 14:11:31 UTC, Ali Çehreli wrote:
        E front() {
            final switch (index) {
                /* static */ foreach (i, arg; Args) {
                    case i:
                        return arg;
                }
            }
        }

AFAIK, this will do funny things with referencing stack if arguments are variables and not literals.

Thanks! The static array version works for me too. It would be good to understand more about what is going on. It looks like the cost of the static array is an extra copy for each element. Maybe there is still a way to avoid that.

Reply via email to