User talk:9rnsr/DIP: Template Parameter Constraint

From D Wiki
Revision as of 15:04, 2 April 2016 by NickTreleaven (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

(Page found through random Google search).

I really like the inline constraint feature:

auto foo(R if isInputRange)(R range);

Would love to see this giving cleaner errors.

Similar syntax could make the auto function parameter proposal more useful:

auto foo()(auto range if isInputRange);

Beside being easier to read (DRY), this disallows the user from supplying a type for R, and clearly documents the fact the user isn't expected to provide a type.

--NickTreleaven (talk) 15:03, 2 April 2016 (UTC)