by arunc · 6y ago · 0 comments
- Want to access member in a aggregate (class/struct)? Use .
- Want to access member in pointer to an aggregate? Use .
- Want to access member in a module? Use .
- Want to access reference (not free standing)? Use .
This makes switching between different implementations pretty easy. Coupled with UFCS, this is pretty fantastic!
Just do a template
void zeros(T)(ref T arr) { arr.each!"a = 0"; }
someArr.zeros;