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 out that it makes it more efficient. Is this the only reason for making it so in the standard?
Efficiency has little (or nothing, really) to do with it.
This design is the outcome of an important paper by Tom Cargill, published in the 90s, that raised quite a few eyebrows back then. IIRC, in it Cargill showed that it is impossible to design an exception safe stack pop function.