On 10/6/06, Gordon Tomlinson <[EMAIL PROTECTED]> wrote:
I would not expect myList.push_back(object); to increase the ref count of
object

unless you provide your own overloaded list and method ::push_back

Um... the std::list is a list of ref_ptr<> when it copies the ref_ptr<> into the list in does use a copy constructor, and ref_ptr<> copy constructor *will* ensure that the ref count is upped.

osg::Group::addChild( osg::Node* ) knows that an osg::Node is a reference
count class so it can do a node->ref();

Actually osg::Group doesn't node its ref counted, it just adds it to an internal std::vector< ref_ptr<Node> >, just like in Olivers example.


But a std::list knows nothing about an osg::Node or osg::ref_ptr

I knows everything it needs to know - the ref_ptr<> constructors, destructor and copy operator, the rest happens automatically thanks to ref_ptr<> safely managing ref()/unref().

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to