Passing Templated Function Arguments Solely by Reference

"Nordlöw" via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 11 03:38:16 PDT 2014


On Wednesday, 9 July 2014 at 07:43:57 UTC, Ali Çehreli wrote:
> Ali

This

https://github.com/nordlow/justd/blob/master/random_ex.d

is what I have so far. Does this look ok to you?

Question: Can I somehow avoid the duplication of logic in

- auto ref randInPlace(R)(R x) @safe if (hasAssignableElements!R)
- auto ref randInPlace(T)(ref T x) @safe if (isStaticArray!T)

?


More information about the Digitalmars-d-learn mailing list