@@ -295,7 +295,7 @@ using namespace N; // Make T visible without N::
295295shared_ptr<int > x; // Empty shared_ptr to a integer on heap. Uses reference counting for cleaning up objects.
296296x = make_shared<int >(12 ); // Allocate value 12 on heap
297297shared_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'
299299if (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}
309309y = 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'
312312weak_ptr<int > w; // Create empty weak pointer
313313w = y; // w has weak reference to y.
314314if (shared_ptr<int > s = w.lock()) { // Has to be copied into a shared_ptr before usage
@@ -527,4 +527,4 @@ thread t3(pingPongFn, "boing");
527527future<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