Modern C++ Tutorial: C++11/14/17/20 On the FlyRAII and Reference Counting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 5.2 std::shared_ptr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 process. More clearly and indicate the life cycle of resources. 57 5.2 std::shared_ptr CHAPTER 05 SMART POINTERS AND MEMORY MANAGEMENT 5.2 std::shared_ptr std::shared_ptr is a smart pointer that records POINTERS AND MEMORY MANAGEMENT Figure 3: Figure 5.2 increase in the reference count. When a weak reference is used, the final release process is shown in Figure 5.2: In the above figure, only B is left in0 码力 | 92 页 | 1.79 MB | 1 年前3
现代C++ 教程:高速上手C++11/14/17/20RAII 与引用计数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 5.2 std::shared_ptr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 露而产生的。基本想法是对于动态分配的对象,进行引用计数,每当增加一次对同一个对象的引用,那 么引用对象的引用计数就会增加一次,每删除一次引用,引用计数就会减一,当一个对象的引用计数减 为零时,就自动删除指向的堆内存。 52 5.2 std::shared_ptr 第 5 章智能指针与内存管理 在传统 C++ 中,『记得』手动释放资源,总不是最佳实践。因为我们很有可能就忘记了去释放资源 而导致泄露。所以通常的做法是对于一个 使用它们需要包含头文件。 注意:引用计数不是垃圾回收,引用计数能够尽快收回不再被使用的对象,同时在回收的过 程中也不会造成长时间的等待,更能够清晰明确的表明资源的生命周期。 5.2 std::shared_ptr std::shared_ptr 是一种智能指针,它能够记录多少个 shared_ptr 共同指向一个对象,从而消除 显式的调用 delete,当引用计数变为零的时候就会将对象自动删除。 0 码力 | 83 页 | 2.42 MB | 1 年前3
Conan 2.0 DocumentationConanCenter packages in production environments . . . . . . . . . . . . . . . . . . . . . . . 139 5.2 Backing up third-party sources with Conan . . . . . . . . . . . . . . . . . . . . . . . . . . . . them from the secondary “test” repository to your main production repository to start using them. 5.2 Backing up third-party sources with Conan For recipes and build scripts for open source, publicly found in remote backup https://myteam.myorg.com/artifactory/backup-sources (continues on next page) 5.2. Backing up third-party sources with Conan 143 Conan Documentation, Release 2.0.17 (continued from0 码力 | 652 页 | 4.00 MB | 1 年前3
Conan 1.21 DocumentationStarted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 5.2 Recipe and Sources in a Different Repo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . check out our FAQ section or . 36 Chapter 5. Creating Packages Conan Documentation, Release 1.21.3 5.2 Recipe and Sources in a Different Repo In the previous section, we fetched the sources of our library still use it to patch something or retrieve more sources, but it is not necessary in most cases. 5.2. Recipe and Sources in a Different Repo 37 Conan Documentation, Release 1.21.3 5.3 Recipe and Sources0 码力 | 621 页 | 4.92 MB | 1 年前3
Conan 1.22 DocumentationStarted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 5.2 Recipe and Sources in a Different Repo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . check out our FAQ section or . 36 Chapter 5. Creating Packages Conan Documentation, Release 1.22.3 5.2 Recipe and Sources in a Different Repo In the previous section, we fetched the sources of our library still use it to patch something or retrieve more sources, but it is not necessary in most cases. 5.2. Recipe and Sources in a Different Repo 37 Conan Documentation, Release 1.22.3 5.3 Recipe and Sources0 码力 | 629 页 | 4.98 MB | 1 年前3
Conan 1.23 DocumentationStarted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 5.2 Recipe and Sources in a Different Repo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . check out our FAQ section or . 36 Chapter 5. Creating Packages Conan Documentation, Release 1.23.0 5.2 Recipe and Sources in a Different Repo In the previous section, we fetched the sources of our library still use it to patch something or retrieve more sources, but it is not necessary in most cases. 5.2. Recipe and Sources in a Different Repo 37 Conan Documentation, Release 1.23.0 5.3 Recipe and Sources0 码力 | 637 页 | 5.04 MB | 1 年前3
Conan 1.18 DocumentationStarted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 5.2 Recipe and Sources in a Different Repo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . check out our FAQ section or . 36 Chapter 5. Creating Packages conan Documentation, Release 1.18.5 5.2 Recipe and Sources in a Different Repo In the previous section, we fetched the sources of our library still use it to patch something or retrieve more sources, but it is not necessary in most cases. 5.2. Recipe and Sources in a Different Repo 37 conan Documentation, Release 1.18.5 5.3 Recipe and Sources0 码力 | 584 页 | 4.80 MB | 1 年前3
Conan 1.19 DocumentationStarted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 5.2 Recipe and Sources in a Different Repo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . check out our FAQ section or . 36 Chapter 5. Creating Packages Conan Documentation, Release 1.19.3 5.2 Recipe and Sources in a Different Repo In the previous section, we fetched the sources of our library still use it to patch something or retrieve more sources, but it is not necessary in most cases. 5.2. Recipe and Sources in a Different Repo 37 Conan Documentation, Release 1.19.3 5.3 Recipe and Sources0 码力 | 609 页 | 4.88 MB | 1 年前3
Conan 1.20 DocumentationStarted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 5.2 Recipe and Sources in a Different Repo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . check out our FAQ section or . 36 Chapter 5. Creating Packages Conan Documentation, Release 1.20.5 5.2 Recipe and Sources in a Different Repo In the previous section, we fetched the sources of our library still use it to patch something or retrieve more sources, but it is not necessary in most cases. 5.2. Recipe and Sources in a Different Repo 37 Conan Documentation, Release 1.20.5 5.3 Recipe and Sources0 码力 | 611 页 | 4.89 MB | 1 年前3
Conan 2.1 DocumentationConanCenter packages in production environments . . . . . . . . . . . . . . . . . . . . . . . 143 5.2 Backing up third-party sources with Conan . . . . . . . . . . . . . . . . . . . . . . . . . . . . them from the secondary “test” repository to your main production repository to start using them. 5.2 Backing up third-party sources with Conan For recipes and build scripts for open source, publicly found in remote backup https://myteam.myorg.com/artifactory/backup-sources (continues on next page) 5.2. Backing up third-party sources with Conan 147 Conan Documentation, Release 2.1.0 (continued from0 码力 | 694 页 | 4.13 MB | 1 年前3
共 86 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9













