== Quote from Simen Kjaeraas ([email protected])'s article
> StaticFilter definitely should be in Phobos. StaticReduce too, but you
> don't seem to have it on your list. I also often use StaticIota.
> For more handy templates I feel should be in Phobos, see
> Philippe Sigaud's dranges:
> http://www.dsource.org/projects/dranges
> -- =
>    Simen

Seconded.  StaticIota is extremely useful for loop unrolling optimizations, 
e.g.:

T sum(T)(T[] nums) {
    enum nILP = 6;
    auto ilpTuple = StaticIota!nILP;
    T[nILP] ret = 0;

    for(size_t i = 0; i + nILP < nums.length; i += nILP) {
        foreach(j; ilpTuple) {
            // Static, automatically unrolled.
            ret[j] += nums[i + j];
        }
    }

    foreach(i; nums.length / nILP * nILP..nums.length) {
        ret[0] += nums[i];
    }

    foreach(i; 1..nILP) {
        ret[0] += ret[i];
    }

    return ret[0];
}

Reply via email to