Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用智能指针而不是原始指针。如何相应地转换此功能?
Node * List::next(const Node * n) const { return n->next; }
像这样:
据我所知,该函数next不执行任何所有权转移,因此它不需要关心Node对象的所有权方式,因此不需要更改。(它不需要是成员,List也可以是static成员。)
next
Node
List
static