Trouble initializing a templated class

2014-07-05 Thread quakkels via Digitalmars-d-learn
I'm going through Adam Wilson's talk 'C# to D' and I've gotten hung up by one of his examples regarding generic programming in D. Specifically, I'm trying to implement the code example found here: http://youtu.be/6_xdfSVRrKo?t=16m44s. I created a templateExp.d file that looks like this:

Re: Trouble initializing a templated class

2014-07-05 Thread quakkels via Digitalmars-d-learn
When I run the dmd compiler, I get this error: >dmd templateExp.d teamplteExp.d(12): Error: class teamplteExp.SomeClass(T : BaseClass) is used as a type This is actually: templateExp.d(12): Error: class templateExp.SomeClass(T : BaseClass) is used as a type

Re: Trouble initializing a templated class

2014-07-05 Thread quakkels via Digitalmars-d-learn
try SomeClass (T): BaseClass Not sure which line you want me to change. I don't want SomeClass to inherit from BaseClass. Rather, I want T to be restricted to classes that inherit from BaseClass. When I change `class SomeClass(T : BaseClass)` to `class SomeClass(T) : BaseClass` I still get

Re: Trouble initializing a templated class

2014-07-05 Thread quakkels via Digitalmars-d-learn
ah, sorry, I misunderstood. It looks like you need to change the lin auto sc = new SomeClass (); to auto sc = new SomeClass!BaseClass (); The compiler complains because SomeClass is a template when you call SomeClass() without !() template parameters. It only becomes a type once instantiate

Trouble linking to static library with Visual D

2014-08-01 Thread quakkels via Digitalmars-d-learn
Hello D'ers, I've been really impressed with Visual D and I've decided to undertake my first D project using Visual D in Visual Studio 2012. However, I've had trouble trying to figure out how to link a static library. I've outlined my situation in this Stack Overflow question. http://s

Re: Trouble linking to static library with Visual D

2014-08-02 Thread quakkels via Digitalmars-d-learn
When you get to the link stage, you'll probably run into undefined symbols: you'll have to add a dependency in the "Project Dependencies" dialog to add the static library to the linker command line of the executable. Thank you for that tip! After a fair bit of frustration (and your help) I've