Skip to content

Commit 612312a

Browse files
committed
Fix typo s/Deference/Dereference
1 parent aa0c4b2 commit 612312a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ using namespace N; // Make T visible without N::
310310
shared_ptr<int> x; // Empty shared_ptr to a integer on heap. Uses reference counting for cleaning up objects.
311311
x = make_shared<int>(12); // Allocate value 12 on heap
312312
shared_ptr<int> y = x; // Copy shared_ptr, implicit changes reference count to 2.
313-
cout << *y; // Deference y to print '12'
313+
cout << *y; // Dereference y to print '12'
314314
if (y.get() == x.get()) { // Raw pointers (here x == y)
315315
cout << "Same";
316316
}
@@ -322,8 +322,8 @@ if (y == nullptr) { // Can compare against nullptr (here returns true)
322322
cout << "Empty";
323323
}
324324
y = make_shared<int>(15); // Assign new value
325-
cout << *y; // Deference x to print '15'
326-
cout << *x; // Deference x to print '12'
325+
cout << *y; // Dereference x to print '15'
326+
cout << *x; // Dereference x to print '12'
327327
weak_ptr<int> w; // Create empty weak pointer
328328
w = y; // w has weak reference to y.
329329
if (shared_ptr<int> s = w.lock()) { // Has to be copied into a shared_ptr before usage
@@ -573,4 +573,4 @@ future<int> fut = // result of async function
573573
async(launch::async, fib, 4); // start async function in other thread
574574
// do some other work
575575
cout << fut.get(); // get result of async function. Wait if needed.
576-
```
576+
```

cheatsheet-as-sourcefile.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ using namespace N; // Make T visible without N::
295295
shared_ptr<int> x; // Empty shared_ptr to a integer on heap. Uses reference counting for cleaning up objects.
296296
x = make_shared<int>(12); // Allocate value 12 on heap
297297
shared_ptr<int> y = x; // Copy shared_ptr, implicit changes reference count to 2.
298-
cout << *y; // Deference y to print '12'
298+
cout << *y; // Dereference y to print '12'
299299
if (y.get() == x.get()) { // Raw pointers (here x == y)
300300
cout << "Same";
301301
}
@@ -307,8 +307,8 @@ if (y == nullptr) { // Can compare against nullptr (here returns true)
307307
cout << "Empty";
308308
}
309309
y = make_shared<int>(15); // Assign new value
310-
cout << *y; // Deference x to print '15'
311-
cout << *x; // Deference x to print '12'
310+
cout << *y; // Dereference x to print '15'
311+
cout << *x; // Dereference x to print '12'
312312
weak_ptr<int> w; // Create empty weak pointer
313313
w = y; // w has weak reference to y.
314314
if (shared_ptr<int> s = w.lock()) { // Has to be copied into a shared_ptr before usage
@@ -527,4 +527,4 @@ thread t3(pingPongFn, "boing");
527527
future<int> fut = // result of async function
528528
async(launch::async, fib, 4); // start async function in other thread
529529
// do some other work
530-
cout << fut.get(); // get result of async function. Wait if needed.
530+
cout << fut.get(); // get result of async function. Wait if needed.

0 commit comments

Comments
 (0)