Why does string::pop_back() return void?

Viewed 47

When I think of the term "pop", I think of popping something off a stack. So it is no longer on the stack, but you are in possession of it.

Tonight I was writing a class to handle temperature values and auto-convert units. I wanted one of my constructors which accepts strings such as "347.23c" or "923.40R", where if the last character value was an upper or lower case F, C, K, R value, it would be removed and used to process the calculation.

I know there are other ways to do this, that's not the issue. My question / concern is that this seems to be a deviation from the accepted definition of the POP action. Is there a reasonable argument for why this method was made void?

0 Answers
Related