line breaks
This commit is contained in:
@@ -22,6 +22,8 @@ have performance and memory usage disadvantages.
|
||||
|
||||
- For our discussion today, we’ll assume that all program data is stored in dynamically-allocated instances of the
|
||||
following simple class. This class can be used to build linked lists, trees, and graphs with cycles:
|
||||
|
||||
```cpp
|
||||
class Node {
|
||||
public:
|
||||
Node(char v, Node* l, Node* r) :
|
||||
@@ -30,6 +32,7 @@ public:
|
||||
Node* left;
|
||||
Node* right;
|
||||
};
|
||||
```
|
||||
|
||||
## 25.3 Garbage Collection Technique #1: Reference Counting
|
||||
|
||||
@@ -167,11 +170,11 @@ also when we are developing big complex programs that process and rearrange lots
|
||||
enormous beast of a programming language (but that doesn’t stop people from trying!). So is there anything
|
||||
we can do? Yes, we can use Smart Pointers to gain some of the features of garbage collection.
|
||||
Some examples below are modified from these nice online references:
|
||||
http://ootips.org/yonat/4dev/smart-pointers.html
|
||||
http://www.codeproject.com/KB/stl/boostsmartptr.aspx
|
||||
http://en.wikipedia.org/wiki/Smart_pointer
|
||||
http://www.boost.org/doc/libs/1_48_0/libs/smart_ptr/smart_ptr.htm
|
||||
http://www.acodersjourney.com/2016/05/top-10-dumb-mistakes-avoid-c-11-smart-pointers/
|
||||
[http://ootips.org/yonat/4dev/smart-pointers.html](http://ootips.org/yonat/4dev/smart-pointers.html)
|
||||
[http://www.codeproject.com/KB/stl/boostsmartptr.aspx](http://www.codeproject.com/KB/stl/boostsmartptr.aspx)
|
||||
[http://en.wikipedia.org/wiki/Smart_pointer](http://en.wikipedia.org/wiki/Smart_pointer)
|
||||
[http://www.boost.org/doc/libs/1_48_0/libs/smart_ptr/smart_ptr.htm](http://www.boost.org/doc/libs/1_48_0/libs/smart_ptr/smart_ptr.htm)
|
||||
[http://www.acodersjourney.com/2016/05/top-10-dumb-mistakes-avoid-c-11-smart-pointers/](http://www.acodersjourney.com/2016/05/top-10-dumb-mistakes-avoid-c-11-smart-pointers/)
|
||||
|
||||
## 25.12 What’s a Smart Pointer?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user