STL类的引用计数指针? [英] STL class for reference-counted pointers?
问题描述
这应该是微不足道的,但我似乎找不到它(除非没有这样的类存在!)
This should be trivial but I can't seem to find it (unless no such class exists!)
什么是STL类智能指针?
What's the STL class (or set of classes) for smart pointers?
UPDATE
感谢您的回应,
我必须说我很惊讶没有标准的实现。
Thanks for the responses,
I must say I'm surprised there's no standard implementation.
我最后使用这个: http://archive.gamedev.net/reference/articles/article1060.asp
推荐答案
除了已经提到的TR1 shared_ptr,在STL中没有引用计数指针。
With the exception of the already mentionned TR1 shared_ptr, there is no reference-counted pointer in STL.
我建议你使用boost :: shared_ptr (下载boost就足够了,没有什么可以编译,它的实现是header-only)。
I suggest you use boost::shared_ptr (downloading boost will be enough, there is nothing to compile, its implementation is header-only).
你可能还想看看Loki库的智能指针(再次,仅有标题的实现)。
You may also want to have a look at smart pointers from Loki libraries (again, header-only implementation).
有关可用智能指针的概述,请参阅那里。
For an overview of available smart pointers, see there.
这篇关于STL类的引用计数指针?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!