On Saturday, 10 June 2017 at 14:35:48 UTC, ag0aep6g wrote:
...
Just that you shouldn't take my version of addNode and rely on
it without double checking that it's correct.
Ah, Okay. I rechecked that everything is working. The size is
correct, and the membership is correct for every
On 06/10/2017 06:57 AM, Mark wrote:
On Friday, 9 June 2017 at 15:12:04 UTC, ag0aep6g wrote:
...
Note that this is only supposed to show how to do the special casing
for classes. addNode probably doesn't do exactly what it's supposed to
do in your tree.
I'm not sure what you mean by this?
Ok. WOW!
I was way off. I adapted your code to my BST and it works
perfectly.
Thanks!
I didn't know what static if was. I should experiment with it.
For the code that I mentioned, I'd have to retype it. I wrote,
tried and deleted those pieces of code several days ago because
it really
On 06/09/2017 04:08 PM, Mark wrote:
Possibly. but I can't use those methods on primitive types.
Those methods implement operators. In your code you use the usual
comparison operators: '==', '<', etc.
Also, I
tried implementing a internal method to determine if it is a class, or
primitive,
On Friday, 9 June 2017 at 05:53:11 UTC, ag0aep6g wrote:
...
Get rid of `real val;` and just compare `payload`s. For
classes, you can detect them with `static if (is(T == class))`
or some such, and cast to void* when comparing.
But when you cast to void*, you're ignoring an opEquals or
opCmp
On 06/09/2017 05:32 AM, Mark wrote:
https://dpaste.dzfl.pl/ff58876ce213
[...]
What Id like to do is this:
auto tree = new BSTbase!int;
...
tree.insert(7);
and
auto Tree2 = new BSTbase!Aclass;
...
Tree2.insert(Aclassobject);
What I have is:
Tree.insert(7, cast(real) 7);
and
Ok.
So I have a BST template, and it passes my tests.
However, if you look at how I insert the data into the BST,
you'll quickly notice the problem I have.
https://dpaste.dzfl.pl/ff58876ce213
Keep in mind I just pasted that stack in there because I use it
in my last unittest at the bottom.