Hello all,
This is a quick and general question. I have been wondering about how to idiomatically wrap an object-oriented C++ library that uses destructors excessively.
Let's take SFML as an example.
Some classes, like Texture clearly deserve a ref type because they can be shared. Other classes, though, are not POD and also not always shared. One such class is VertexBuffer. In C++ it is probably going to be stored on the stack, but it has a destructor.
How do most Nim developers handle this? The manual suggests not worrying, because the C++ compiler backend will still call the destructor. However, in what contexts will this happen? Will the C++ destructor be called if the VertexBuffer is stored by ref?
Will the C++ destructor be called if the VertexBuffer is stored by ref?
No. For that you need to use a finalizer.