Reputation: 18614
I want to use smart pointers instead of raw pointers. How can I convert this function accordingly?
Node * List::next(const Node * n) const {
return n->next;
}
Upvotes: 0
Views: 1513
Reputation: 793369
Like this:
Node * List::next(const Node * n) const {
return n->next;
}
As far as I can tell the function next
doesn't not perform any transfer of ownership so it doesn't need to concern itself with means of ownership of Node
objects so it doesn't need to change. (It doesn't need to be a member of List
or it could be a static
member.)
Upvotes: 6