Packt

Practical Guide to Mastering C++ Smart Pointers - Part 02

8 days left! Grow your skills with Coursera Plus for $239/year (usually $399). Save now.

Packt

Practical Guide to Mastering C++ Smart Pointers - Part 02

Included with Coursera Plus

Gain insight into a topic and learn the fundamentals.
Intermediate level

Recommended experience

8 hours to complete
Flexible schedule
Learn at your own pace
Gain insight into a topic and learn the fundamentals.
Intermediate level

Recommended experience

8 hours to complete
Flexible schedule
Learn at your own pace

What you'll learn

  • Master std::shared_ptr concepts including reference counting, ownership semantics, and memory lifecycle management in modern C++ applications.

  • Replace raw pointers with smart pointers to prevent memory leaks, dangling pointers, and resource mismanagement in complex systems.

  • Implement advanced smart pointer techniques including custom deleters, control blocks, and cross-library resource handling.

  • Use std::weak_ptr and std::make_shared to manage shared ownership, break cyclic dependencies, and optimize memory allocation.

Details to know

Shareable certificate

Add to your LinkedIn profile

Recently updated!

April 2026

Assessments

8 assignments

Taught in English

See how employees at top companies are mastering in-demand skills

 logos of Petrobras, TATA, Danone, Capgemini, P&G and L'Oreal

There are 7 modules in this course

In this module, we will introduce the course and outline the learning journey for mastering C++ smart pointers. You will gain an overview of the concepts and practical topics that will be explored throughout the course. This section prepares you for deeper learning by explaining the objectives and real-world relevance of smart pointers.

What's included

1 video1 reading

In this module, we will explore the fundamental concepts of std::shared_ptr and its role in modern C++ programming. You will learn how shared ownership works through reference counting and practical coding examples. The section also covers how std::shared_ptr behaves when copied, returned from functions, or passed as arguments.

What's included

8 videos1 assignment

In this module, we will examine the problems associated with raw pointers and how std::shared_ptr provides safer alternatives. You will learn how to prevent memory leaks, dangling pointers, and uninitialized pointer issues. The section also demonstrates real-world usage in containers, polymorphism, and multithreaded applications.

What's included

10 videos1 assignment

In this module, we will dive into practical applications of std::shared_ptr for real-world resource management. You will explore control blocks, custom deleters, and advanced memory management mechanisms. The section also demonstrates how to safely manage system resources like file handles, DLLs, and OS-level objects.

What's included

10 videos1 assignment

In this module, we will explore the internal workings of custom deleters and how they integrate with std::shared_ptr. You will learn how smart pointers behave across DLL boundaries and different runtime environments. This section also explains advanced scenarios involving C runtime libraries and cross-module resource management.

What's included

7 videos1 assignment

In this module, we will explore the efficient construction of shared pointers using std::make_shared. You will learn how it improves memory allocation and simplifies object creation compared to traditional methods. The section also examines control block layout and memory optimization techniques.

What's included

9 videos1 assignment

In this module, we will explore the role of std::weak_ptr in managing shared resources without owning them. You will learn how weak pointers help avoid cyclic dependencies and enable temporary access to shared objects. The section also demonstrates advanced patterns combining std::shared_ptr, std::weak_ptr, and std::make_shared for robust memory management.

What's included

18 videos3 assignments

Instructor

Packt - Course Instructors
Packt
1,674 Courses477,715 learners

Offered by

Packt

Why people choose Coursera for their career

Felipe M.

Learner since 2018
"To be able to take courses at my own pace and rhythm has been an amazing experience. I can learn whenever it fits my schedule and mood."

Jennifer J.

Learner since 2020
"I directly applied the concepts and skills I learned from my courses to an exciting new project at work."

Larry W.

Learner since 2021
"When I need courses on topics that my university doesn't offer, Coursera is one of the best places to go."

Chaitanya A.

"Learning isn't just about being better at your job: it's so much more than that. Coursera allows me to learn without limits."
Coursera Plus

Open new doors with Coursera Plus

Unlimited access to 10,000+ world-class courses, hands-on projects, and job-ready certificate programs - all included in your subscription

Advance your career with an online degree

Earn a degree from world-class universities - 100% online

Join over 3,400 global companies that choose Coursera for Business

Upskill your employees to excel in the digital economy

Frequently asked questions