Rebind template

Engine Machine via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 20 15:18:57 PDT 2016


On Saturday, 20 August 2016 at 22:11:40 UTC, Engine Machine wrote:
> Is there a way to rebind the arguments of a template?
>
> template foo(X)
> {
>    // X is like A!(a,b,c)
>    Y = Rebind!(X,d,e,f);
>    // Y is like A!(d,e,f);
> }
>
> foo(A!(a,b,c));
>
> ?

I'd also be happy if I could just remove the last element from A.

template EraseLast(X)
{
     // returns A!(a,b) when X = A!(a,b,c)
}


More information about the Digitalmars-d-learn mailing list