开发者

Is there a C++/CLI smart pointer project (e.g. scoped_ptr)?

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_gcroot

  • containment of a managed handle in a managed class: auto_handle

The above two are similar to auto_ptr or unique_ptr.

  • I gave skeleton code for a counted_handle here, similar to shared_ptr

But all these are for disposing manag开发者_开发技巧ed ref class instances, not for freeing native objects.


This one looks fairly complete, but I'm not looking for silent transfer of ownership ala auto_ptr.


I've posted my version under a rather permissive license over at codereview.se

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜