Sign in to follow this  
mrmrcoleman

STL problems...

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this