You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// moves str into container, str is no longer used
23
+
// moves str into the container, str is no longer used
22
24
```
23
25
24
26
___
@@ -28,12 +30,12 @@ ___
28
30
* <!-- .element: class="fragment fade-in" --> Transfer all data from the source to the target
29
31
* <!-- .element: class="fragment fade-in" --> Leave the source object in an unknown, but safe to delete state
30
32
* <!-- .element: class="fragment fade-in" --> The source object should never be used
31
-
* <!-- .element: class="fragment fade-in" --> The source object can only be safely destroyed or, if possible, new resource can be assigned to it (eg. <code>reset()</code>)
33
+
* <!-- .element: class="fragment fade-in" --> The source object can only be safely destroyed or, if possible, a new resource can be assigned to it (eg. <code>reset()</code>)
@@ -38,7 +38,7 @@ Do not implement any of Rule of 5 functions 😎
38
38
If you use RAII handlers (like smart pointers), all the copy and move operations will be generated (or deleted) implicitly.
39
39
<!-- .element: class="fragment fade-in" -->
40
40
41
-
Eg. when you have unique_ptr as your class member, copy operations of your class will be automatically blocked, but move operations will be supported.
41
+
For example, when you have a `unique_ptr` as your class member, copy operations of your class will be automatically blocked, but move operations will be supported.
42
42
<!-- .element: class="fragment fade-in" -->
43
43
44
44
___
@@ -47,12 +47,12 @@ ___
47
47
48
48
Aim: learn how to refactor code to use RAII and Rule of 0
49
49
50
-
Write a template class which holds a pointer
50
+
Write a template class that holds a pointer
51
51
52
-
*<!-- .element: class="fragment fade-in" --> use raw pointer to manage resource of a template type
52
+
*<!-- .element: class="fragment fade-in" --> use a raw pointer to manage the resource of a template type
53
53
*<!-- .element: class="fragment fade-in" --> implement constructor to acquire a resource
54
-
*<!-- .element: class="fragment fade-in" --> implement Rule of 3
55
-
*<!-- .element: class="fragment fade-in" --> implement Rule of 5
56
-
*<!-- .element: class="fragment fade-in" --> implement Rule of 0
57
-
* use proper smart pointer instead of raw pointer
54
+
*<!-- .element: class="fragment fade-in" --> implement the Rule of 3
55
+
*<!-- .element: class="fragment fade-in" --> implement the Rule of 5
56
+
*<!-- .element: class="fragment fade-in" --> implement the Rule of 0
57
+
* use a roper smart pointer instead of the raw pointer
0 commit comments