Why doesn’t pop_back() have a return value? I have Googled regarding this and found out that it makes it more efficient. Is this the only reason for making it so in the standard?
Why doesn’t pop_back() have a return value? I have Googled regarding this and found
Share
I think there is something related to the fact that copying an instance of the last object could throw an exception. When doing so, you’re losing your object, since pop_back() did remove it from your container. Better with a few lines of code: