n will be deleted but its copy that is in the list will get copied again and returned as part of the list. That's why you need to implement the copy constructor for your class. And if you make Number an implicitly shared class, only the facade part of the object will be allocated on the stack and the real data will reside on heap and will not be copied whenever the object itself is copied.
Bookmarks