Jump to content
  • Advertisement
Sign in to follow this  
mrmrcoleman

STL problems...

This topic is 4950 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!