Difference between revisions of "User talk:9rnsr/DIP: Template Parameter Constraint"

From D Wiki
Jump to: navigation, search
(pipedream: auto function parameter with inline constraint)
(No difference)

Revision as of 15:03, 2 April 2016

(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, 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)