Vittorio Romeo expands the Dive into C++14 series with a new video covering the implementation of a generic "unique resource" wrapper.
Dive into C++14 - [3]
About the tutorial:
This new tutorial covers the implementation of a generic "unique resource" class, with the same ownership semantics as
std::unique_ptr
.
std::unique_ptr
is not limited to pointer-like handles - by adapting other kinds of handles to the `NullablePointer` concept, it can still be used. Nevertheless, for educational purposes and to understand the commonalities between resource types and handle types, we're going to implement our ownstd::unique_ptr
-like generic "unique wrapper".The video shows the implementation of the resource class and the abstraction of the behavior of several example resource types (heap-allocated pointers, OpenGL VBOs, int-based-handle APIs).
All the code is available on GitHub. The code segments are thoroughly commented and can be read as a tutorial without watching the video, if preferred.
Add a Comment
Comments are closed.