Grouping variadic parameter tuples on offset and stride

Nordlöw via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 22 02:32:20 PST 2016


On Thursday, 21 January 2016 at 22:35:09 UTC, H. S. Teoh wrote:
> Try this:
>
> 	import std.meta;
>
> 	template Stride(size_t stride, size_t offset, Args...)
> 	    if (stride > 0)
> 	{
> 	    static if (offset >= Args.length)
> 	        alias Stride = AliasSeq!();
> 	    else static if (stride >= Args.length)
> 	        alias Stride = AliasSeq!(Args[offset]);
> 	    else
> 	        alias Stride = AliasSeq!(Args[offset],
> 	                                 Stride!(stride, offset, 
> Args[stride .. $]));
> 	}

Made it work. Thx


More information about the Digitalmars-d-learn mailing list