Thread overview | |||||
---|---|---|---|---|---|
|
April 16, 2019 How do I pass a template type as parameter? | ||||
---|---|---|---|---|
| ||||
I've tried those syntaxes: void f(appender!string buffer) { } void f(A = appender)(A!string buffer) { } but no luck... how do I do that? |
April 16, 2019 Re: How do I pass a template type as parameter? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Machine Code | On Tuesday, 16 April 2019 at 21:07:51 UTC, Machine Code wrote: > void f(appender!string buffer) { } appender isn't a type, it is a helper function that returns a type called Appender: http://dpldocs.info/experimental-docs/std.array.appender.1.html http://dpldocs.info/experimental-docs/std.array.Appender.html So try like `void f(Appender!string buffer) {}` |
April 16, 2019 Re: How do I pass a template type as parameter? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Tuesday, 16 April 2019 at 21:24:54 UTC, Adam D. Ruppe wrote:
> On Tuesday, 16 April 2019 at 21:07:51 UTC, Machine Code wrote:
>> void f(appender!string buffer) { }
>
> appender isn't a type, it is a helper function that returns a type called Appender:
>
> http://dpldocs.info/experimental-docs/std.array.appender.1.html
>
> http://dpldocs.info/experimental-docs/std.array.Appender.html
>
>
>
> So try like `void f(Appender!string buffer) {}`
I see. Thank you!
|
Copyright © 1999-2021 by the D Language Foundation