2015年8月26日

摘要: unique_ptr一个unique_ptr拥有它所管理的对象,与shared_ptr不同,unique_ptr指向的对象只能有一个用户。当unique_ptr被销毁后,它所指向的对象也被销毁。定义一个unique_ptr时,需要将其绑定到一个new返回的指针上,类似shared_ptr,初始化un... 阅读全文
posted @ 2015-08-26 21:14 街角的咖啡店 阅读(268) 评论(0) 推荐(0)
 
摘要: 原文链接:点击打开链接Reverse a singly linked listA linked list can be reversed either iteratively or recursively. Could you implement both?struct ListNode* reve... 阅读全文
posted @ 2015-08-26 18:18 街角的咖啡店 阅读(143) 评论(0) 推荐(0)
 
摘要: 单链表头文件 Link_list.h#pragma once#include #include #include struct Node{ int Element; struct Node* Next;};typedef struct Node* List;typedef st... 阅读全文
posted @ 2015-08-26 11:42 街角的咖啡店 阅读(119) 评论(0) 推荐(0)
 
摘要: 原文链接:点击打开链接原题是这样的:Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should ... 阅读全文
posted @ 2015-08-26 11:33 街角的咖啡店 阅读(112) 评论(0) 推荐(0)
 
摘要: shared_ptr和new结合使用一个shared_ptr默认初始化为一个空指针。我们也可以使用new返回的指针来初始化一个shared_ptr:shared_ptr p1;shared_ptr p2(new int(42)); // p2指向一个值为42的int接受指针参数的智能指针构造函数是e... 阅读全文
posted @ 2015-08-26 00:27 街角的咖啡店 阅读(494) 评论(0) 推荐(0)