Just an additional note, in case it's not obvious,

all sp<> needs to work is the incStrong() and decStrong() methods.
Since it's a template, it doesn't require the target object to derive
from RefBase().
In other words, you can use sp<T> as long as T::incStrong() and
T::decStrong() exist and are implemented properly.

mathias



On May 19, 12:43 am, Dianne Hackborn <hack...@android.com> wrote:
> sp == strong pointer, wp == weak pointer.
>
> The object will remain around while there are strong pointers; it is
> destroyed once the last one is released.  All you can do with a weak pointer
> is comparison and attempting to promote to a strong pointer; the latter will
> fail if there are no other strong pointers on the object.
>
>
>
> On Mon, May 18, 2009 at 11:56 PM, xie <yili....@gmail.com> wrote:
>
> > Dear all :
>
> > when i read the android source, i find that "<sp>" is not only a smart
> > pointer,it manage a strong ref count and i also find that the <wp>
> > manage a weak ref count .
>
> > who can tell me how the two kinds of pointer works together, when will
> > the object be freed?
>
> > thanks a lot
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"android-framework" group.
To post to this group, send email to android-framework@googlegroups.com
To unsubscribe from this group, send email to 
android-framework+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to