哪里是shared_ptr的? [英] Where is shared_ptr?

查看:151
本文介绍了哪里是shared_ptr的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在感到很沮丧几个小时,试图寻找到shared_ptr的所在了。我看到的例子没有显示完整的code到包括的shared_ptr 的标题(和工作)。只是在陈述 STD TR1 <内存> 是没有帮助了!我已经下载并提升所有,但仍然没有显示出来!有人可以帮助我正好告诉哪里找呢?

I am so frustrated right now after several hours trying to find where shared_ptr is located. None of the examples I see show complete code to include the headers for shared_ptr (and working). Simply stating std, tr1 and <memory> is not helping at all! I have downloaded boosts and all but still it doesn't show up! Can someone help me by telling exactly where to find it?

谢谢你让我发泄我的不满!

Thanks for letting me vent my frustrations!

编辑:
我看到我的标题已经改变。对于那个很抱歉。
所以......这也是因为它不是清楚,我认为是的shared_ptrC ++版本依赖 - >这就是为什么我没有说出我的环境 - >因此也许就是为什么它是如此我很难找到它

I see my title has been changed. Sorry about that. So... it was also because it was not clear to me that shared_ptr is "C++ version dependant" --> that's why I did not state my environment --> therefore probably why it was so difficult for me to find it.

我的工作MSVS2008。

I am working on MSVS2008.

编辑2:
我不知道为什么,但我是包括[内存]和[升压/ TR1 / memory.hpp]和[升压/ TR1 / TR1 /内存],而到处寻找,当然shared_ptr的..,我不能。

EDIT 2: I don't know why, but I was including [memory] and [boost/tr1/memory.hpp] and [boost/tr1/tr1/memory] while looking everywhere for the shared_ptr.. of course, i couldn't.

感谢所有的反应。

推荐答案

有至少有三个地方,你可能会发现的shared_ptr

There are at least three places where you may find shared_ptr:


  1. 如果你的C ++实现支持C ++ 11(或至少是C ++ 11 的shared_ptr ),那么的std :: shared_ptr的将在&LT;存储方式&gt;

如果你的C ++实现支持C ++ TR1库扩展,那么的std :: tr1 :: shared_ptr的可能会在&LT;内存&GT; (微软的Visual C ++)或&LT; TR1 /显存GT&; (G ++的的libstdc ++)。升压还提供了可以使用TR1的实现。

If your C++ implementation supports the C++ TR1 library extensions, then std::tr1::shared_ptr will likely be in <memory> (Microsoft Visual C++) or <tr1/memory> (g++'s libstdc++). Boost also provides a TR1 implementation that you can use.

否则,你可以得到Boost库,并使用的boost :: shared_ptr的,它可以在&LT找到;升压/ shared_ptr的.HPP方式&gt;

Otherwise, you can obtain the Boost libraries and use boost::shared_ptr, which can be found in <boost/shared_ptr.hpp>.

这篇关于哪里是shared_ptr的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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