STL problems...

Started by
4 comments, last by mrmrcoleman 19 years, 4 months ago
I have recently moved my project away from UNICODE for various reasons. I have now noticed a few errors in the STL sections of my code, for example reference vector.end() causes an error so I have to use end()-1. Also push_back is now causing an error... Has anybody heard of this before? Thanks for any advice. Mark Coleman
Advertisement
Sounds odd. Did you do a full rebuild of your project? It could be that the object code of some components is still UNICODE and therefore causes memory corruptions due to the different value size (applies to strings only).
Hmm, I did a full rebuild but I still have the same problem. However a bit of digging around reveals that push_back is actually working elsewhere in the program... I will have to look at this more closely.

Thanks for the suggestion darookie.

Kind regards.

Mark Coleman
You're welcome!

Best regards,
Pat.
Quote:Original post by mrmrcoleman
...reference vector.end() causes an error...

Do you mean doing:
std::vector<Type>::iterator iterator = myVector.end();iterator->function();

or
std::vector<Type>::iterator iterator = myVector.end();function(*iterator);

?
Both of these are errors. vector.end() returns an iterator one past the end of the vector, so vector.end() - 1 is the last element in the container.

Enigma
Enigma...

Yes, I looked bacl through my code and it was indeed missing a -1. I am having a hard day!

Mark Coleman

This topic is closed to new replies.

Advertisement