Pointers or copies?

Tom S h3r3tic at remove.mat.uni.torun.pl
Wed Dec 20 15:07:41 PST 2006


Orgoton wrote:
> And when I want to remove the reference? Something like
> 
> void remove(in object target)
> the_for:
> for (i=0; i<queue.length; i++)
> {
> if target==queue[i]
> {
> queue[i]=queue[$-1];
> queue.length-=1;
> break the_for;
> }
> }
> 
> the compare will work fine, right? I mean, in C++ it would just compare a 4 byte
> integer, how much data will D compare? hopefully, not he full object data ... ... ...

Use 'is' instead of '=='. It will compare references.



More information about the Digitalmars-d mailing list