smart-pointers
Avoid copying a map's key without raw pointers
Every time you insert a pair in a std::map whose key is a std::string, it makes two copies. You can avoid using raw pointers but it is exception-unsafe. Is there some way to use a smart pointer instea[详细]
2023-02-08 17:28 分类:问答Are there "smart pointers" in Java?
Are there a开发者_如何学Cnything along the lines of C++ smart pointers in Java?All of Java\'s \'pointers\' (references) are Smart Pointers.[详细]
2023-02-06 16:33 分类:问答Letting go of auto_ptr
Occasionally, for fleeting moments, I think auto_ptr is cool.But most of the time I recognize that there are much simpler techniques that make it irrelevant.For example, if I want to have an object fr[详细]
2023-02-06 14:51 分类:问答Smart Pointers, Forward Declaration, and C4150
So as part of a large hobby learning project I have implemented a mostly complete smart pointer implementation.It does practically every thing I ask of it, except for one minor detail that may prove t[详细]
2023-02-06 02:00 分类:问答Propagate constness to data pointed by member variables
It is often quite confusing to C++ newcomers that const member functions are allowed to call non-const methods on objects referenced by the class (either by pointer or reference). For example, the fol[详细]
2023-02-05 15:02 分类:问答Smart pointer: runtime crash in VS 9 running WinXP-Sp3
I am getting run time crash in the following piece of code and not able to debug also. Please review and let me know what\'s going on.[详细]
2023-02-05 10:21 分类:问答Does it exist: smart pointer, owned by one object allowing access
I\'m wondering if anyone\'s run across anything that exists which would fill this need. Object A contains an object B.It wants to provide access to that B to clients through a pointer (maybe there\'s[详细]
2023-02-04 03:16 分类:问答C++ -- Is there an implicit cast here from Fred* to auto_ptr<Fred>?
I saw the following code, #include <new> #include <memory> using namespace std; class Fred;// Forward declaration[详细]
2023-02-02 15:27 分类:问答Anyone know of any plans to make ^ a shorthand for shared_ptr<T>?
For example: shared_ptr<const shared_ptr<const int> > pp; is fairly intimidating... wh开发者_运维问答ereas[详细]
2023-02-01 19:00 分类:问答Smart pointers usage
I have a project and I want make smart pointers usage better. The main idea is to use them when returning new object from function. The question is what smart pointer to use? auto_ptr or shared_ptr f[详细]
2023-02-01 08:49 分类:问答
加载中,请稍侯......