Need help in templates
Simen kjaeraas
simen.kjaras at gmail.com
Thu Mar 24 22:46:38 PDT 2011
On Fri, 25 Mar 2011 06:18:21 +0100, Ishan Thilina <ishanthilina at gmail.com>
wrote:
> Hi,
>
> I'm still new to D. I tried to implement a stack using templates. But I
> get an
> "Access Violation" error when I try to run a test on the stack that I
> made.The
> source code is attached with this mail. Can somebody please point out the
> error of this code?
Line 10:
> Stack! (int) myStack;
Stack!(int) is a class, hence you have to initialize it with new. So this
line should be:
> Stack! (int) myStack = new Stack! (int);
or (perhaps more idiomatic):
> auto myStack = new Stack! (int);
--
Simen
More information about the Digitalmars-d-learn
mailing list