是否有C ++ / CLI智能指针项目(例如scoped_ptr)? [英] Is there a C++/CLI smart pointer project (e.g. scoped_ptr)?

查看:247
本文介绍了是否有C ++ / CLI智能指针项目(例如scoped_ptr)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有C ++ / CLI RAII智能指针类,用于在托管类型中包含本机指针?只是想知道,在我写自己的 clr_scoped_ptr 值类模板。



我知道Microsoft-提供:





上面两个类似于 auto_ptr unique_ptr





但是所有这些都是用于处理托管ref类实例,而不是用于释放本机对象。

解决方案

这一个看起来相当完整,但我不是在寻找静默转移所有权ala auto_ptr 。 / p>




我已经在一个相当宽松的许可证下发布了我的版本 codereview.se


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:

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.

解决方案

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

这篇关于是否有C ++ / CLI智能指针项目(例如scoped_ptr)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆