I'm new, so this is most certainly my fault I guess, but I cannot understand the error message...
I wish to slice an array and store the slices in a tuple.

auto partitionArray(T)(T[] array, int offset, int len)
{
        auto pre = array[0 .. offset];
        auto slice = array[offset .. offset+len];
        auto post = array[offset+len .. $];
        
        return Tuple!(pre, slice, post);
}
unittest
{
        auto val = partitionArray([1,2,3,4], 1, 2);
}

typecons.d(255): Error: template instance cannot use local 'post' as parameter to non-global template A(U...)

Reply via email to