- 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.
推薦閱讀
- Git Version Control Cookbook
- C# 從入門到項目實踐(超值版)
- 面向STEM的Scratch創新課程
- Unity 5.x By Example
- SQL Server 2012數據庫管理與開發項目教程
- Python機器學習基礎教程
- SQL基礎教程(第2版)
- HTML+CSS+JavaScript網頁設計從入門到精通 (清華社"視頻大講堂"大系·網絡開發視頻大講堂)
- The Statistics and Calculus with Python Workshop
- 視窗軟件設計和開發自動化:可視化D++語言
- Microsoft HoloLens By Example
- 編程風格:程序設計與系統構建的藝術(原書第2版)
- jBPM6 Developer Guide
- C語言進階:重點、難點與疑點解析
- Scratch 3.0少兒積木式編程(6~10歲)