Overload function template for rectangular array

John Chapman johnch_atms at hotmail.com
Mon May 25 08:20:48 UTC 2020


Is it possible to overload a function template for rectangular 
arrays? Is there any way to tell them apart from normal ones?

void foo(T)(T[] a) {}
void foo(T)(T[][] a) {}

auto ra = new int[][](5, 5);
ra.foo(); // matches both

Thanks for any hints.


More information about the Digitalmars-d-learn mailing list