Hi Guys,

I know there has been a lack of visible activity lately in the field of newCTFE.

But fear not, there is progress; even if it is much slower then before.

I just implemented support for varadic function templates.

(which produces a curious AST in which you have more arguments then parameters ;))

luckily this was easily fixed because dmd provides a way to iterate over the expanded parameter tuple. The elusively named (Parameter.getNth) function.

which looks like this:

    /***************************************
     * Get nth Parameter, folding in tuples.
     * Returns:
     *      Parameter*      nth Parameter
* NULL not found, *pn gets incremented by the number
     *                      of Parameters
     */
static Parameter getNth(Parameters* parameters, size_t nth, size_t* pn = null)
    {
        Parameter param;

        int getNthParamDg(size_t n, Parameter p)
        {
            if (n == nth)
            {
                param = p;
                return 1;
            }
            return 0;
        }

        int res = _foreach(parameters, &getNthParamDg);
        return res ? param : null;
    }

Notice how pn is never actually touched!
and therefore will not get incremented.

Reply via email to