Thoughts on return type from template container classes.
I'd like to hear some thoughts on a recommended approach to return types from template container classes. If I for example create a template stack class implemented with a linked list, I want my pop() function to return the item and delete the node.
Returning a local variable is not suitable I guess, I can not return the value since it's a template and no assumptions can be made about the type, (it could be a struct and so on). Returning a pointer seems dumb since it's not convenient for simple types such as ints. How can this (can it?) be solved in the most generic manner?