On Sat, Jun 03, 2017 at 10:38:31PM +, Mark via Digitalmars-d-learn wrote:
[...]
> Ok. So by using '==' it should compare the addresses of the objects?
[...]
No, `==` is for comparing the *contents* of the objects. You need to
implement opEquals() for the objects being compared in order to
On Saturday, 3 June 2017 at 23:32:44 UTC, Ali Çehreli wrote:
...
Ali
Awesome, that might be handy in the near future.
Thanks.
On 06/03/2017 03:38 PM, Mark wrote:
> Ok. So by using '==' it should compare the addresses of the objects?
That's the default behavior. You can change it with opEquals:
http://ddili.org/ders/d.en/object.html#ix_object.opEquals
I think you want to use the 'is' operator:
On Saturday, 3 June 2017 at 22:52:42 UTC, Mark wrote:
Thanks again.
Nevermind, I got it.
On Saturday, 3 June 2017 at 22:38:31 UTC, Mark wrote:
In the future I'll include a compilable example. I was having
problems with a class I made which is about 45 lines, that
might be a lot of code for a post.
You can use external resources such as:
https://d.godbolt.org/
On Saturday, 3 June 2017 at 22:38:31 UTC, Mark wrote:
...
Thanks.
Actually, I got another question,
how Can I obtain the actual memory address of a class?
I'll still need to solve the problem of taking ints/floats/reals
etc., as well as structs and classes and sending them right/left
in
On Saturday, 3 June 2017 at 20:24:44 UTC, ag0aep6g wrote:
By default, they act the same. But you can change how `==`
behaves by overriding `opEquals`. You cannot override `is`.
Ok. So by using '==' it should compare the addresses of the
objects?
I think I didn't include the other file as
On 06/03/2017 10:02 PM, Mark wrote:
auto A = new Box();
auto B = new Box();
if(A.opEquals(B)) {}
gives the error
test.o:(.data.rel.ro+0x18): undefined reference to
`_D5Stack12__ModuleInfoZ'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
Your code works for
On Saturday, 3 June 2017 at 20:02:13 UTC, Mark wrote:
On Saturday, 3 June 2017 at 19:57:47 UTC, Mark wrote:
Hello again.
I'm designing a template version of a BST.
Because of this, I want to be able to compare if two objects
of the same class type are references to the same anonymous
class
On Saturday, 3 June 2017 at 20:02:13 UTC, Mark wrote:
On Saturday, 3 June 2017 at 19:57:47 UTC, Mark wrote:
Hello again.
I'm designing a template version of a BST.
Because of this, I want to be able to compare if two objects
of the same class type are references to the same anonymous
class
On Saturday, 3 June 2017 at 19:57:47 UTC, Mark wrote:
Hello again.
I'm designing a template version of a BST.
Because of this, I want to be able to compare if two objects of
the same class type are references to the same anonymous class
on the heap somewhere.
Example:
Not sure what
Hello again.
I'm designing a template version of a BST.
Because of this, I want to be able to compare if two objects of
the same class type are references to the same anonymous class on
the heap somewhere.
Example:
12 matches
Mail list logo