reference-count

STL class for reference-counted pointers?

This should be trivial but I can't seem to find it (unless no such class exists!) 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. I ended up using this one: http://www.gamedev.net/reference/articles/article1060.asp ...

dynamic_cast of a COM object to a COM interface doesn't bump the reference count, does it?

If I have a C++ class, X, which implements the COM interfaces IY and IZ, and I have a pointer y to the IY interface of an object of type X, and I do this: IZ *z = dynamic_cast<IZ *> ( y ); That doesn't bump the object's reference count, does it? I don't have to do a Release() to account for it, right? If it matters, I'm using ATL/COM...

What does assigning a literal string to an NSString with "=" actually do?

Greetings, I'm sure that this is probably an incredibly stupid question, but... What does the following line actually do? string = @"Some text"; Assuming that "string" is declared thusly in the header: NSString *string; What does the "=" actually do here? What does it do to "string"'s reference count? In particular, assuming th...

Reference Counted Objects and multiple Allocators

Hi Guys. This is a design question, assuming C++ and a reference counted object hierarchy. A lot of classes in my codebase derive from a common base class (ObjectBase), which implements retain() and release() methods to increase and decrease the reference count of an object instance. Every instance of an object may be created on the st...