C++ equivellant to if <> Self
BlitzMax Forums/BlitzMax Programming/C++ equivellant to if <> Self
| ||
Hi I hope I'm not being cheeky here but I'm hoping there is a c++ programmer here that could help me, I'm after the Blitzmax equivillant to:if object:Object <> Self Then So that the object isn't comparing itself in the code, the object:Object is from a for look looking through a list. This is what I have come up with so far but they dont work:
if(*iter ? !this : false){
if((*iter) != this){
The iterator is similar to the object:Object, it's something to flick through a list. Thanks. |
| ||
| if obj:object<>object(self) I think you will have to do the cast to compare, but maybe not |
| ||
Function DrawAll() Local ThisSprite:Sprite ' Draw sprites. For ThisSprite = EachIn SpriteList ThisSprite.Draw() Next End Function I don't code in C++, but if I understand you right, you're doing a loop like that, but in a method instead of a function? If that's the case, then I think all you need is to say If ThisSprite <> Self. [edit] I think I misunderstood you though. You're trying to do this with generic objects, like those the List type works with. So it's not as simple as that. In that case I can't help ya, I don't do that sort of thing much. [/edit] |
| ||
| Except he asked for an example in C++ :-) |
| ||
Yeah here is that in c++
void drawAll()
{
list<Sprite*>::iterator iter;
for(iter = this->m_list.begin(); iter != this->m_list.end(); iter++)
{
(*iter)->draw();
}
}
|
| ||
Yeah the problem is an equivillent to
For obj:TObject = Eachin obj_list
If obj <> Self Then
in c |