Packt

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

Packt

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

访问权限由 Coursera Learning Team 提供

深入了解一个主题并学习基础知识。
中级 等级

推荐体验

8 小时 完成
灵活的计划
自行安排学习进度
深入了解一个主题并学习基础知识。
中级 等级

推荐体验

8 小时 完成
灵活的计划
自行安排学习进度

您将学到什么

  • 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.

要了解的详细信息

可分享的证书

添加到您的领英档案

作业

8 项作业

授课语言:英语(English)
最近已更新!

April 2026

了解顶级公司的员工如何掌握热门技能

Petrobras, TATA, Danone, Capgemini, P&G 和 L'Oreal 的徽标

该课程共有7个模块

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.

涵盖的内容

1个视频1篇阅读材料

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.

涵盖的内容

8个视频1个作业

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.

涵盖的内容

10个视频1个作业

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.

涵盖的内容

10个视频1个作业

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.

涵盖的内容

7个视频1个作业

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.

涵盖的内容

9个视频1个作业

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.

涵盖的内容

18个视频3个作业

位教师

Packt - Course Instructors
Packt
1,895 门课程531,687 名学生

提供方

Packt

人们为什么选择 Coursera 来帮助自己实现职业发展

Felipe M.

自 2018开始学习的学生
''能够按照自己的速度和节奏学习课程是一次很棒的经历。只要符合自己的时间表和心情,我就可以学习。'

Jennifer J.

自 2020开始学习的学生
''我直接将从课程中学到的概念和技能应用到一个令人兴奋的新工作项目中。'

Larry W.

自 2021开始学习的学生
''如果我的大学不提供我需要的主题课程,Coursera 便是最好的去处之一。'

Chaitanya A.

''学习不仅仅是在工作中做的更好:它远不止于此。Coursera 让我无限制地学习。'