Difference between revisions of "User talk:9rnsr/DIP: Template Parameter Constraint"
(pipedream: auto function parameter with inline constraint) |
m |
||
Line 11: | Line 11: | ||
<code>auto foo()(auto range if isInputRange);</code> | <code>auto foo()(auto range if isInputRange);</code> | ||
− | 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. | + | 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. |
--[[User:NickTreleaven|NickTreleaven]] ([[User talk:NickTreleaven|talk]]) 15:03, 2 April 2016 (UTC) | --[[User:NickTreleaven|NickTreleaven]] ([[User talk:NickTreleaven|talk]]) 15:03, 2 April 2016 (UTC) | ||
---- | ---- |
Latest revision as of 15:04, 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 (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)