Possible Duplicate:
STL containers element destruction order
Is there a guarantee the the elements of an std::vector would be destroyed from last to first?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
2003:5.3.5/6 says about
delete[]:So if your
std::vectorobject’s allocator usesdelete[]then, yes, it is bound to destroy elements in reverse order.However, there is no guarantee that your
std::vectorwill work this way (and, in fact, it most likely does not), and I can’t find any citations specific to the container.Really, I think it’s all down to your allocator and 2003:20.1.5 (which lists the requirements placed upon allocators) doesn’t appear to say anything about it.