Sorry, I forgot to change that. My example Obsolete was a function, so I used the parentheses. Your Obsolete is a bool variable, so you should remove the parentheses:
if ((*currentLaser)->Obsolete)
The reason ++i is preferred over i++ is that in general, when you use i++, the code must make a copy of i, then increment it, then return the copy. Even if you don't use the returned value, the code that figures it out might still be run. When you use ++i, i is incremented first, and then returned without a copy being made. Since you are ignoring the return value, you don't care what is returned, the pre-incremented value or the post-incremented value. Since you don't care, it is better to go with the one that won't require an unnecessary copy. It is possible that the extra copy is optimized away, but I wouldn't count on it and there is no reason to since there is really no difference to you in writing one or the other. This isn't a big deal, just another suggested good habit.



LinkBack URL
About LinkBacks







Okay I said, lets make the loop counter (b =) to temp. and it works. Not very well, because I must be doing somthing wrong with the size, because you have to make, ~100 lasers before they start to show, but at least it works. Every Vector sizer(eg: temp) is different. And only one starts at 0. So i'm assuming that this isn't normal/right aka: whats causing my problems. I also tried testing for the laser.empty() property, and that didn't really work. Soo....the point to this ramble is, any idea why this is so whacked? Because when I go currentLaser-> , the auto complete thingy pops up, but not when I do, (*currentLaser)->.......soo......any help would be very much appreciated, because, I quite frankly, have no idea what i'm doing when it comes to vectors( and quite possibly, c++!