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

You're welcome!

Best regards,
Pat.

##### 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 on other sites
Enigma...

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

Mark Coleman

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628356
• Total Posts
2982252

• 10
• 9
• 13
• 24
• 11