Per Ångström <d-n...@autark.se> wrote:
/++ Simulates type-returning or-expression +/ template or(T) { T _(T a, lazy T b) {T tmp = a; return tmp ? tmp : b;} }
You should probably use a function template[1] or at least an eponymous template here:
// function template: auto or( T )( T a, lazy T b ) { return a ? a : b; } // eponymous template: template or( T ) { auto or( T a, lazy T b ) { return a ? a : b; } } [1]: http://digitalmars.com/d/2.0/template.html#function-templates -- Simen