- 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.
推薦閱讀
- Oracle Exadata性能優化
- Python Tools for Visual Studio
- Hands-On Microservices with Kotlin
- Kali Linux Wireless Penetration Testing Beginner's Guide(Third Edition)
- Serverless架構
- 自然語言處理Python進階
- Flutter跨平臺開發入門與實戰
- jQuery炫酷應用實例集錦
- Python極簡講義:一本書入門數據分析與機器學習
- C++寶典
- Neo4j 3.x入門經典
- WordPress Search Engine Optimization(Second Edition)
- Java程序設計教程
- Building UIs with Wijmo
- iOS Development with Xamarin Cookbook