On Mon, 2009-03-16 at 14:05 -0500, Allen Bierbaum wrote:
> On Mon, Mar 16, 2009 at 10:44 AM, Dirk Reiners <[email protected]> wrote:
> > Marcus Lindblom wrote:
> >> Allen Bierbaum wrote:
> >>> Hello all:
> >>>
> >>> I am just starting to play with the new WeakPtr types in OpenSG.  Very 
> >>> nice.
> >>>
> >>> I have one suggestion for the documentation.  I think we should
> >>> recommend a usage idiom for people to only use WeakPtr's if they have
> >>> first been converted to Rec/Ref Ptrs.  This would be similar to the
> >>> recommended usage of boost weak pointers.
> >>> (http://www.boost.org/doc/libs/1_38_0/libs/smart_ptr/weak_ptr.htm)
> >>>
> >> +1.
> >
> > Can we enforce this by not having conversions for weak pointers or is that 
> > too
> > much of a hassle?
> 
> I would follow boost's lead and make a method like ".lock()" that
> returns the RecPtr version.  Then the user has to explicitly use that
> to get anything.
> 
> 
> NodeWeakPtr n = someOtherRef;
> NodeRefPtr temp_ref = n.lock();
> 
> if(temp_ref != NULL)
> {
>    std::cout << "temp_ref points to a live Node" << std::endl;
> }
> 

for apps I would understand this, but during the traversal and inside
the backend I don't really want to constantly create tmp ref ptrs. If
you manage to invalidate a pointer while the traversal is on you are in
deep waters anyway because the internal interfaces use raw pointers, so
there will be a conversion no matter what.

So at maximum I would got for the .get() version. Between get and
auto-conversion I don't really have a preference. 

kind regards,
  gerrit



------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core

Reply via email to