digitalmars.D - std.contracts.enforceEx
- Steve Teale (17/17) Feb 08 2010 Perhaps a bug? If this is written as a normal function template it seems...
- Andrei Alexandrescu (3/23) Feb 08 2010 The function was indeed written that way to navigate around a limitation...
Perhaps a bug? If this is written as a normal function template it seems to work the same way, but has the advantage of generating better Ddoc information. That is: T enforceEx(E, T)(T value, lazy string msg = "") { if (!value) throw new E(msg); return value; } instead of: template enforceEx(E) { T enforceEx(T)(T value, lazy string msg = "") { if (!value) throw new E(msg); return value; } }
Feb 08 2010
Steve Teale wrote:Perhaps a bug? If this is written as a normal function template it seems to work the same way, but has the advantage of generating better Ddoc information. That is: T enforceEx(E, T)(T value, lazy string msg = "") { if (!value) throw new E(msg); return value; } instead of: template enforceEx(E) { T enforceEx(T)(T value, lazy string msg = "") { if (!value) throw new E(msg); return value; } }The function was indeed written that way to navigate around a limitation. Andrei
Feb 08 2010