C++ Crash Course: A Fast-Paced Introduction by Josh Lospinoso

C++ Crash Course: A Fast-Paced Introduction by Josh Lospinoso

Author:Josh Lospinoso
Language: eng
Format: mobi, epub, pdf
ISBN: 9781593278892
Publisher: No Starch Press, Inc.
Published: 2019-12-28T16:00:00+00:00


Shared Arrays

A shared array is a shared pointer that owns a dynamic array and supports operator[]. It works just like a unique array except it has non-exclusive ownership.

Deleters

Deleters work the same way for shared pointers as they do for unique pointers except you don’t need to provide a template parameter with the deleter’s type. Simply pass the deleter as the second constructor argument. For example, to convert Listing 11-12 to use a shared pointer, you simply drop in the following type alias:

using FileGuard = std::shared_ptr<FILE>;

Now, you’re managing FILE* file handles with shared ownership.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.