Cannot compare object.opEquals is not nogc

Rufus Smith via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 31 11:43:22 PDT 2016


On Saturday, 23 July 2016 at 13:18:03 UTC, Rufus Smith wrote:
> Trying to compare a *ptr value with a value in nogc code 
> results in the error:
>
> Error: @nogc function '...' cannot call non- at nogc function 
> 'object.opEquals'		
>
> Shouldn't object opEquals be marked?

So, I need to compare two objects in a no-gc context? How to do 
this? There are several checks to be done? Memory compare good 
enough? (not if opEquals is defined for structs, etc...)

Unfortunately, regardless of what some people say, There is a 
need to compare objects in a nogc context... I have the case for 
one.

e.g., I have a nogc container and a remove(T obj). I can't search 
for obj and remove it because opEquals is not marked nogc. So I 
need an alternative that is somewhat robust.






More information about the Digitalmars-d-learn mailing list