Is there a C++/CLI RAII smart pointer class for containment of a native pointer in a managed type? Just wondering, before I go write my own clr_scoped_ptr value class template.
I'm aware of the Microsoft-provided:
containment of a managed handle in a native class:
auto_gcrootcontainment of a managed handle in a managed class:
auto_handle
The above two are similar to auto_ptr or unique_ptr.
But all these are for disposing managed ref class instances, not for freeing native objects.
clr_scoped_ptr, please post it as an answer. - ali_bahooshared_ptrin my case) in a C++/CLI class. I'm sorry if the linked question wasn't helpful to you, but it helped me and I thought it may help others with similar needs who may come across this question. Are you aware of a more suitable solution for use withshared_ptr? - Rotsiser Mho