Re: Adding overloaded methods

2012-02-22 Thread BLM
After messing around for a while, I figured out what is making DMD choke on my file. The methods were defined in the base class using template mixins, and apparently DMD doesn't like it when mixins, inheritance, overloading, and aliases are all in the same piece of code :)

Re: Adding overloaded methods

2012-02-21 Thread BLM
Hmm... I guess I'll have to figure out why my code is behaving differently and put a test case together. Strange... Thanks for fixing the semicolons. Old C++ habits die hard, even if one has written very little C++ :)

Re: Adding overloaded methods

2012-02-21 Thread BLM
I've submitted it to the DMD developers. Hopefully it won't take too long to get fixed; it looks like it would be a _fairly_ simple fix to make. (Since when is a compiler fix simple?)

Re: Adding overloaded methods

2012-02-21 Thread BLM
I tried using override and it complained that the functions weren't overriding anything. I think that the main problem is that the alias solution was designed to allow derived classes to use overloads that had already been defined in the base class, not for the derived classes to add _new_ overloa

Adding overloaded methods

2012-02-21 Thread BLM
I'm working on a project where I'm using overloaded virtual methods, and I've run into a challenge with overload sets. My code looks something like this: class Base { void get(ubyte b) {}; } class Derived: Base { //alias Base.get get; void get(string s) {}; } I've tried using an alias declar

Re: Avoiding const?

2012-02-21 Thread BLM
If you have a const array, you can create a non-const copy of the array using the .dup property of the array. The reason that you need this is that dynamic-length arrays share data when you assign them between variables, and you can't have a non-const variable using something else's const data wit

Re: Template Inheritance

2012-02-21 Thread BLM
That last one looks a lot better than my solution. It's certainly a lot clearer. One problem I discovered with using templates was that I ended up needing virtual functions, which means that I had to convert the template functions to mixins and just instantiate them for each type (at least there