smart pointers
#3558
Replies: 1 comment
-
On further reflection, it might be a bit more flexible if the destroyer class were another template parameter of
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Filament has various kinds of pointers that must be cleaned up by calling an
Engine::destroy
method. Making sure that such pointers get cleaned up, but not too soon, suggests to me that smart pointers should be used. It is possible to usestd::shared_ptr
with a deleter object passed to the constructor andreset
method, but you'd have to remember to always use the deleter. Here's what I came up with. First, make a deleter object class, like:and then define a smart pointer template:
Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions