Swap furthest element type of an array
Andrej Mitrovic
andrej.mitrovich at gmail.com
Mon Jun 18 15:01:03 PDT 2012
On 6/18/12, Timon Gehr <timon.gehr at gmx.ch> wrote:
> template SwapElem(A, E){
> static if(is(A X:X[N],size_t N)) alias SwapElem!(X,E)[N] R;
> else static if(is(A X:X[])) alias SwapElem!(X,E)[] R;
> else static if(is(A X:X*)) alias SwapElem!(X,E)* R;
> else alias E R;
> alias R SwapElem;
> }
>
> pragma(msg, SwapElem!(int[]*[3][]*[2][]*[1][], float));
>
Niiiice! Did you just come up with this right now? :D
More information about the Digitalmars-d-learn
mailing list