- Learning C++ Functional Programming
- Wisnu Anggoro
- 127字
- 2021-07-02 20:51:38
Avoiding manual memory management with smart pointers
The smart pointers are highly useful and have an essential knowledge in using C++ efficiently. C++11 added many new abilities for the smart pointer we can find in the memory header file. For a long time, before C++11, we used auto_ptr as a smart pointer. However, it was quite unsafe since it had incompatible copy semantics. It's also deprecated now, and we should not use it anymore. Fortunately, C++ has presented unique_ptr, which has a similar functionality, but with additional features, such as adding deleters and support for arrays. Anything we can do with auto_pt, we can and should do with unique_ptr instead. We will discuss unique_ptr in depth along with other new smart pointers in C++11--shared_ptr and weak_ptr.
推薦閱讀
- Clojure Programming Cookbook
- Mastering Zabbix(Second Edition)
- Rake Task Management Essentials
- Vue.js 3.x從入門到精通(視頻教學版)
- 精通搜索分析
- R的極客理想:工具篇
- JavaScript入門經典
- Unity Game Development Scripting
- Mastering Linux Security and Hardening
- Azure Serverless Computing Cookbook
- Learning Material Design
- ExtJS Web應用程序開發指南第2版
- IoT Projects with Bluetooth Low Energy
- Building Microservices with Go
- Learning NHibernate 4