On Wednesday, July 01, 2015 09:29:56 via Digitalmars-d-learn wrote: > On Tuesday, 30 June 2015 at 21:06:58 UTC, WhatMeWorry wrote: > > Bonus question: Isn't a Zero-parameter template declaration > > pretty much worthless? > > Functions in templates get certain attributes inferred > automatically, like `@nogc`, `pure`, `nothrow`, `@safe`. Some > people use them for that purpose. (Because of IFTI, functions > with empty template parameters can be called with the same syntax > as normal functions, they don't need the `!()`.)
That and it lets you use auto ref. It also can be necessary when overloading templated functions. It used to be that you couldn't overlooad a templated function with a non-templated function, forcing you to have functions with no template parameters if you wanted to have what would normally be a non-templated function overload a templated function. That's now been fixed, but the overload rules aren't quite the same between a non-templated functions and a templated function with no parameters, so sometimes you still need to templatize a function with empty parameters depending on what you're trying to do with your function overloads. - Jonathan M Davis