How to specialize templates for l-value and non-l-value arguments?
Timon Gehr
timon.gehr at gmx.ch
Thu Jun 14 09:05:51 PDT 2012
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); }
More information about the Digitalmars-d-learn
mailing list