On 06/19/2012 12:01 AM, Andrej Mitrovic wrote:
On 6/18/12, Timon Gehr<timon.g...@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
Indeed. If you are interested, I'll make it work with qualified types as
well. =)