Cannot use local xxx as parameter to non-global template.
simendsjo
simen.endsjo at pandavre.com
Mon Aug 9 16:53:19 PDT 2010
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...)
More information about the Digitalmars-d-learn
mailing list