Trouble with SList for generic Stack class

Mark via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jun 2 16:05:43 PDT 2017


Awesome. That worked.

On Friday, 2 June 2017 at 22:30:28 UTC, Stefan Koch wrote:
> On Friday, 2 June 2017 at 22:21:07 UTC, Mark wrote:
>> Hello,
>>
>> I am trying to make a class that can accept any type as an 
>> argument.
>>
>> [...]
>
> the stack class needs to be a template as well.
> This is not java ;)



Stefan, what do you mean that it must be a template?

Am I supposed to write template Struct(T) { class Stack { ... } }?

I got that from programming in D, in the more templates section.

This worked as well.

What is the benefit of using the full syntax for templates?

I'm new to templates, this is the first time I've ever used them.

Thanks.


More information about the Digitalmars-d-learn mailing list