How to specialize templates for l-value and non-l-value arguments?

Roman D. Boiko rb at d-coding.com
Thu Jun 14 09:08:53 PDT 2012


On Thursday, 14 June 2012 at 16:05:52 UTC, Timon Gehr wrote:
> You can overload based on 'ref'.
>
> auto just(ref immutable(T) data) { return Maybe!T(&data); }
> auto just(immutable(T) data) { return Maybe!T([data].ptr); }
Great! Thanks


More information about the Digitalmars-d-learn mailing list