Hi Thibault, On Wed, May 14, 2008 at 4:02 PM, Thibault Genessay <[EMAIL PROTECTED]> wrote: > I really don't know why it is this way - I had actually never noticed > that ref_ptr<> had this "feature". It makes more sense to me how the > observer_ptr<> is implemented because ref_ptr and observer_ptr are > just proxies that should IMHO behave like ordinary references or > pointers when we call operator*() or operator->(). (I'm sure a C++ > guru could slap me for what I've said, but I'd enjoy it if it came > with an explanation :)
Which version of the OSG are you using? In 2.4 the observer_ptr<> is consistent with ref_ptr<> i.e. inline T& operator*() const { return *_ptr; } inline T* operator->() const { return _ptr; } inline T* get() const { return _ptr; } The next question is this wacky world is why does ref_ptr<> and observer_ptr<> do this trick? Try: typedef std::set< osg::ref_ptr<Node> > MySet; Then try to access members of it, and you'll find out they are in fact now a const ref_ptr<> and you can't access any non const methods of Node. What the const method here is const of the ref_ptr<> not const of what its pointing to. If you meant this then you'd have osg::ref_ptr<const Node>. However, it all can get a bit sticky, as sometimes you intend const osg::ref_ptr<Node> to be const osg::ref_ptr<const Node> in which case the relaxation of the the above accessors misses this. Robert. _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org